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 /indt0 { bullmarg exch moveto bfont bwidth showstreamjust } def
262 /indt1 { bullmarg exch moveto bfont bwidth showstreamjust } def
263 /indt2 { bullmarg exch moveto bfont showstream } def
264 /indt3 { bullmarg exch moveto bfont showstream } def
266 /bquo0 { bullmarg exch moveto qfont bwidth showstreamjust } def
267 /bquo1 { bullmarg exch moveto qfont bwidth showstreamjust } def
268 /bquo2 { bullmarg exch moveto qfont showstream } def
269 /bquo3 { bullmarg exch moveto qfont showstream } def
271 /tocw0 lwidth tocpnz sub def
272 /tocw1 tocw0 tocind sub def
273 /tocw2 tocw1 tocind sub def
276 /tocx1 tocx0 tocind add def
277 /tocx2 tocx1 tocind add def
283 /x s stringwidth pop pagewidth rmarg sub exch sub def
284 currentpoint /y exch def
285 lmarg sub tocdots div ceiling tocdots mul lmarg add
287 y moveto (.) 0 linkshow
289 x y moveto s 0 linkshow
294 /toc00 { tocx0 exch moveto 0 rmoveto bfont showstream } def
295 /toc01 { tocx0 exch moveto
296 linkbegindest bfont0 setfont 0 linkshow bfont showstream } def
297 /toc02 { tocx0 exch moveto 3 1 roll
298 0 rmoveto bfont showstream tocpn } def
299 /toc03 { tocx0 exch moveto 4 1 roll
300 linkbegindest bfont0 setfont 0 linkshow bfont showstream tocpn } def
302 /toc10 { tocx1 exch moveto 0 rmoveto bfont showstream } def
303 /toc11 { tocx1 exch moveto
304 linkbegindest bfont0 setfont 0 linkshow bfont showstream } def
305 /toc12 { tocx1 exch moveto 3 1 roll
306 0 rmoveto bfont showstream tocpn } def
307 /toc13 { tocx1 exch moveto 4 1 roll
308 linkbegindest bfont0 setfont 0 linkshow bfont showstream tocpn } def
310 /toc20 { tocx2 exch moveto 0 rmoveto bfont showstream } def
311 /toc21 { tocx2 exch moveto
312 linkbegindest bfont0 setfont 0 linkshow bfont showstream } def
313 /toc22 { tocx2 exch moveto 3 1 roll
314 0 rmoveto bfont showstream tocpn } def
315 /toc23 { tocx2 exch moveto 4 1 roll
316 linkbegindest bfont0 setfont 0 linkshow bfont showstream tocpn } def
318 % Spacing between index columns
319 /indexcolumn pagewidth lmarg sub rmarg sub idxgutter add idxcolumns div def
320 % Width of an individual index column
321 /indexcolwid indexcolumn idxgutter sub def
325 indexcolumn mul lmarg add
326 /x exch def /y exch def x y moveto
327 exch bfont showstream
328 dup bfont streamwidth
329 x indexcolwid add exch sub exch pop y moveto
339 indexcolumn mul lmarg add idxindent add
340 /x exch def /y exch def x y moveto
341 exch bfont showstream
342 dup bfont streamwidth
343 x indexcolwid idxindent sub add exch sub exch pop y moveto
354 /pagey botmarg pymarg sub def
355 /pagel lmarg plmarg sub def
356 /pager pagewidth rmarg sub prmarg add def
358 /pageeven { pagel pagey moveto bfont1 setfont show } def
359 /pageodd { bfont1 setfont dup stringwidth pop pager exch sub
360 pagey moveto show } def
363 % Functions invoked during parsing
366 /pa { 0 pageheight moveto linkdest } def
367 /xl { linkbegindest } def
368 /wl { linkbeginuri } def
369 /pl { linkbeginpage } def
375 [/PageMode /UseOutlines /DOCVIEW pdfmark % Display bookmarks
378 % Functions to include EPS
381 /Before_EPSF_State save def
382 /dict_count countdictstack def
383 /op_count count 1 sub def
386 0 setgray 0 setlinecap
387 1 setlinewidth 0 setlinejoin
388 10 setmiterlimit [ ] 0 setdash newpath
393 false setstrokeadjust false setoverprint
398 count op_count sub {pop} repeat
399 countdictstack dict_count sub {end} repeat
400 Before_EPSF_State restore