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
44 colorlinks { 0 0 0.4 setrgbcolor } if
63 % string spacepadding --
66 /lspad exch def /lss exch def
68 gsave lss true charpath flattenpath pathbbox grestore
71 lss spacecount lspad mul add /lkurx exch def
76 lkury max /lkury exch def
77 lss spacecount lspad mul add lkurx max /lkurx exch def
78 lklly min /lklly exch def
79 lkllx min /lkllx exch def
82 lspad 0 space lss widthshow
90 /Action 2 dict dup /Subtype /URI put dup /URI lktarget put
95 /Rect [ lkllx lkxmarg sub
102 colorlinks { 0 setgray } if
109 /View [ /XYZ currentpoint null ]
113 % A "fontset" is an array of fonts; a "stream" is an array of strings
114 % and numbers or procedures:
115 % [ 0 (Foo) ( ) (mani) ( ) 1 (padme) 0 ( ) (hum.) ]
116 % A number choses a font from the current fontset.
117 % A procedure is invoked as-is when printing the stream.
119 % When printing justified, an equal amount of space is added in
120 % between each string.
122 % string -- spacecount
123 % Count space characters in a string
126 space eq { 1 add } if
130 % stream fontset -- spacecount width
131 % Get the width of a stream in the given fontset, and the
132 % number of space characters in the stream
144 dup stringwidth pop w add /w exch def
145 spacecount s add /s exch def
147 /arraytype { pop } def
148 % The input stream is on the top of the stack now
157 % stream fontset spacer --
158 % Show the stream in the given fontset, but add a certain amount
159 % of space to each space character
174 % Now stream is on the top of the stack
182 % Show the stream in the given fontset, with no extra spacing
187 % stream fontset totalspace --
188 % Show the stream justified to fit into a certain number of pixels
191 /ts exch def /fs exch def /st exch def
193 st fs streamwidth ts exch sub exch
194 dup 0 gt { div } { pop } ifelse
199 /bullmarg lmarg bulladj add def
200 /lwidth pagewidth lmarg sub rmarg sub def
201 /bwidth lwidth bulladj sub def
204 % The various paragraph types
205 % The number at the end indicates start (1) of para, end (2) of para
208 currentpoint exch pop 10 sub lmarg exch moveto
209 0 setlinecap 3 setlinewidth
210 lwidth 0 rlineto stroke
213 /chap0 { lmarg exch moveto cfont lwidth showstreamjust } def
214 /chap1 { lmarg exch moveto cfont lwidth showstreamjust } def
215 /chap2 { lmarg exch moveto cfont showstream chapline } def
216 /chap3 { lmarg exch moveto cfont showstream chapline } def
223 % lbl ypos fontset -- ypos
225 3 -1 roll [exch ( )] exch % ypos strm fontset
226 2 copy % ypos strm fontset strm fontset
227 streamwidth % ypos strm fontset spccount width
228 lmarg exch sub % ypos strm fontset spccount xpos
229 4 index % ypos strm fontset spccount xpos ypos
230 moveto % ypos strm fontset spccount
231 pop % ypos strm fontset spccount
235 /head0 { lmarg exch moveto hfont lwidth showstreamjust } def
236 /head1 { hfont headlbl lmarg exch moveto hfont lwidth showstreamjust } def
237 /head2 { lmarg exch moveto hfont showstream } def
238 /head3 { hfont headlbl lmarg exch moveto hfont showstream } def
240 /subh0 { lmarg exch moveto sfont lwidth showstreamjust } def
241 /subh1 { sfont headlbl lmarg exch moveto sfont lwidth showstreamjust } def
242 /subh2 { lmarg exch moveto sfont showstream } def
243 /subh3 { sfont headlbl lmarg exch moveto sfont showstream } def
245 /norm0 { lmarg exch moveto bfont lwidth showstreamjust } def
246 /norm1 { lmarg exch moveto bfont lwidth showstreamjust } def
247 /norm2 { lmarg exch moveto bfont showstream } def
248 /norm3 { lmarg exch moveto bfont showstream } def
250 /code0 { lmarg exch moveto bfont showstream } def
251 /code1 { lmarg exch moveto bfont showstream } def
252 /code2 { lmarg exch moveto bfont showstream } def
253 /code3 { lmarg exch moveto bfont showstream } def
257 /bull0 { bullmarg exch moveto bfont bwidth showstreamjust } def
258 /bull1 { dup lmarg exch moveto bullet bfont showstream
259 bullmarg exch moveto bfont bwidth showstreamjust } def
260 /bull2 { bullmarg exch moveto bfont showstream } def
261 /bull3 { dup lmarg exch moveto bullet bfont showstream
262 bullmarg exch moveto bfont showstream } def
264 /tocw0 lwidth tocpnz sub def
265 /tocw1 tocw0 tocind sub def
266 /tocw2 tocw1 tocind sub def
269 /tocx1 tocx0 tocind add def
270 /tocx2 tocx1 tocind add def
276 /x s stringwidth pop pagewidth rmarg sub exch sub def
277 currentpoint /y exch def
278 lmarg sub tocdots div ceiling tocdots mul lmarg add
280 y moveto (.) 0 linkshow
282 x y moveto s 0 linkshow
287 /toc00 { tocx0 exch moveto 0 rmoveto bfont showstream } def
288 /toc01 { tocx0 exch moveto
289 linkbegindest bfont0 setfont 0 linkshow bfont showstream } def
290 /toc02 { tocx0 exch moveto 3 1 roll
291 0 rmoveto bfont showstream tocpn } def
292 /toc03 { tocx0 exch moveto 4 1 roll
293 linkbegindest bfont0 setfont 0 linkshow bfont showstream tocpn } def
295 /toc10 { tocx1 exch moveto 0 rmoveto bfont showstream } def
296 /toc11 { tocx1 exch moveto
297 linkbegindest bfont0 setfont 0 linkshow bfont showstream } def
298 /toc12 { tocx1 exch moveto 3 1 roll
299 0 rmoveto bfont showstream tocpn } def
300 /toc13 { tocx1 exch moveto 4 1 roll
301 linkbegindest bfont0 setfont 0 linkshow bfont showstream tocpn } def
303 /toc20 { tocx2 exch moveto 0 rmoveto bfont showstream } def
304 /toc21 { tocx2 exch moveto
305 linkbegindest bfont0 setfont 0 linkshow bfont showstream } def
306 /toc22 { tocx2 exch moveto 3 1 roll
307 0 rmoveto bfont showstream tocpn } def
308 /toc23 { tocx2 exch moveto 4 1 roll
309 linkbegindest bfont0 setfont 0 linkshow bfont showstream tocpn } def
311 % Spacing between index columns
312 /indexcolumn pagewidth lmarg sub rmarg sub idxgutter add idxcolumns div def
313 % Width of an individual index column
314 /indexcolwid indexcolumn idxgutter sub def
318 indexcolumn mul lmarg add
319 /x exch def /y exch def x y moveto
320 exch bfont showstream
321 dup bfont streamwidth
322 x indexcolwid add exch sub exch pop y moveto
332 indexcolumn mul lmarg add idxindent add
333 /x exch def /y exch def x y moveto
334 exch bfont showstream
335 dup bfont streamwidth
336 x indexcolwid idxindent sub add exch sub exch pop y moveto
347 /pagey botmarg pymarg sub def
348 /pagel lmarg plmarg sub def
349 /pager pagewidth rmarg sub prmarg add def
351 /pageeven { pagel pagey moveto sfont0 setfont show } def
352 /pageodd { sfont0 setfont dup stringwidth pop pager exch sub
353 pagey moveto show } def
356 % Functions invoked during parsing
359 /pa { 0 pageheight moveto linkdest } def
360 /xl { linkbegindest } def
361 /wl { linkbeginuri } def
362 /pl { linkbeginpage } def
368 [/PageMode /UseOutlines /DOCVIEW pdfmark % Display bookmarks
371 % Functions to include EPS
374 /Before_EPSF_State save def
375 /dict_count countdictstack def
376 /op_count count 1 sub def
379 0 setgray 0 setlinecap
380 1 setlinewidth 0 setlinejoin
381 10 setmiterlimit [ ] 0 setdash newpath
386 false setstrokeadjust false setoverprint
391 count op_count sub {pop} repeat
392 countdictstack dict_count sub {end} repeat
393 Before_EPSF_State restore