2002-05-15 05:59:59 +08:00
|
|
|
%
|
|
|
|
% PostScript header for NASM documentation
|
|
|
|
%
|
|
|
|
|
|
|
|
% Avoid barfing on old PS implementations
|
|
|
|
/pdfmark where
|
|
|
|
{pop} {userdict /pdfmark /cleartomark load put} ifelse
|
|
|
|
/setpagedevice where
|
|
|
|
{pop} {userdict /setpagedevice /pop load put} ifelse
|
|
|
|
|
|
|
|
% Useful definition
|
|
|
|
/space 32 def
|
|
|
|
|
|
|
|
%
|
|
|
|
% This asks the PostScript interpreter for the proper size paper
|
|
|
|
%
|
|
|
|
/setpagesize {
|
|
|
|
1 dict dup /PageSize [pagewidth pageheight] put setpagedevice
|
|
|
|
} def
|
|
|
|
|
|
|
|
%
|
|
|
|
% Code to handle links
|
|
|
|
%
|
|
|
|
/min { 2 copy gt { exch } if pop } def
|
|
|
|
/max { 2 copy lt { exch } if pop } def
|
|
|
|
|
|
|
|
/lkbegun 0 def
|
2002-05-15 15:11:21 +08:00
|
|
|
/lktype null def
|
2002-05-15 05:59:59 +08:00
|
|
|
/lkury 0 def
|
|
|
|
/lkurx 0 def
|
|
|
|
/lklly 0 def
|
|
|
|
/lkllx 0 def
|
|
|
|
/lkxmarg 1 def % Extra space for link in x dir
|
|
|
|
/lkymarg 1 def % Extra space for link in y dir
|
|
|
|
/lktarget () def
|
|
|
|
|
2002-05-15 15:11:21 +08:00
|
|
|
% target type --
|
2002-05-15 05:59:59 +08:00
|
|
|
/linkbegin {
|
|
|
|
userdict begin
|
|
|
|
/lkbegun 1 def
|
2002-05-15 15:11:21 +08:00
|
|
|
/lktype exch def
|
2002-05-15 05:59:59 +08:00
|
|
|
/lktarget exch def
|
2002-05-16 03:02:52 +08:00
|
|
|
colorlinks { 0 0 0.4 setrgbcolor } if
|
2002-05-15 05:59:59 +08:00
|
|
|
end
|
|
|
|
} def
|
|
|
|
|
2002-05-15 15:11:21 +08:00
|
|
|
% target --
|
|
|
|
/linkbegindest {
|
|
|
|
/Dest linkbegin
|
|
|
|
} def
|
|
|
|
|
2002-05-15 05:59:59 +08:00
|
|
|
% uristring --
|
|
|
|
/linkbeginuri {
|
2002-05-15 15:11:21 +08:00
|
|
|
/URI linkbegin
|
|
|
|
} def
|
|
|
|
|
|
|
|
% pageno --
|
|
|
|
/linkbeginpage {
|
|
|
|
/Page linkbegin
|
2002-05-15 05:59:59 +08:00
|
|
|
} def
|
|
|
|
|
|
|
|
% string spacepadding --
|
|
|
|
/linkshow {
|
|
|
|
userdict begin
|
|
|
|
/lspad exch def /lss exch def
|
|
|
|
lkbegun 0 ne {
|
|
|
|
gsave lss true charpath flattenpath pathbbox grestore
|
|
|
|
lkbegun 1 eq {
|
|
|
|
/lkury exch def
|
|
|
|
lss spacecount lspad mul add /lkurx exch def
|
|
|
|
/lklly exch def
|
|
|
|
/lkllx exch def
|
|
|
|
/lkbegun 2 def
|
|
|
|
} {
|
|
|
|
lkury max /lkury exch def
|
|
|
|
lss spacecount lspad mul add lkurx max /lkurx exch def
|
|
|
|
lklly min /lklly exch def
|
|
|
|
lkllx min /lkllx exch def
|
|
|
|
} ifelse
|
|
|
|
} if
|
|
|
|
lspad 0 space lss widthshow
|
|
|
|
end
|
|
|
|
} def
|
|
|
|
|
|
|
|
% --
|
|
|
|
/linkend {
|
|
|
|
userdict begin
|
2002-05-16 03:02:52 +08:00
|
|
|
[ lktype /URI eq {
|
|
|
|
/Action 2 dict dup /Subtype /URI put dup /URI lktarget put
|
2002-05-15 05:59:59 +08:00
|
|
|
} {
|
2002-05-16 03:02:52 +08:00
|
|
|
/Dest lktarget
|
2002-05-15 05:59:59 +08:00
|
|
|
} ifelse
|
|
|
|
/Border [0 0 0]
|
|
|
|
/Rect [ lkllx lkxmarg sub
|
|
|
|
lklly lkymarg sub
|
|
|
|
lkurx lkxmarg add
|
|
|
|
lkury lkymarg add ]
|
|
|
|
/Subtype /Link
|
|
|
|
/ANN pdfmark
|
|
|
|
/lkbegun 0 def
|
2002-05-16 03:02:52 +08:00
|
|
|
colorlinks { 0 setgray } if
|
2002-05-15 05:59:59 +08:00
|
|
|
end
|
|
|
|
} def
|
|
|
|
|
|
|
|
% targetname --
|
|
|
|
/linkdest {
|
|
|
|
[ /Dest 3 -1 roll
|
|
|
|
/View [ /XYZ currentpoint null ]
|
|
|
|
/DEST pdfmark
|
|
|
|
} def
|
|
|
|
|
|
|
|
% A "fontset" is an array of fonts; a "stream" is an array of strings
|
|
|
|
% and numbers or procedures:
|
|
|
|
% [ 0 (Foo) ( ) (mani) ( ) 1 (padme) 0 ( ) (hum.) ]
|
|
|
|
% A number choses a font from the current fontset.
|
|
|
|
% A procedure is invoked as-is when printing the stream.
|
|
|
|
%
|
|
|
|
% When printing justified, an equal amount of space is added in
|
|
|
|
% between each string.
|
|
|
|
|
|
|
|
% string -- spacecount
|
|
|
|
% Count space characters in a string
|
|
|
|
/spacecount {
|
|
|
|
0 exch {
|
|
|
|
space eq { 1 add } if
|
|
|
|
} forall
|
|
|
|
} def
|
|
|
|
|
|
|
|
% stream fontset -- spacecount width
|
|
|
|
% Get the width of a stream in the given fontset, and the
|
|
|
|
% number of space characters in the stream
|
|
|
|
/streamwidth {
|
|
|
|
gsave
|
|
|
|
6 dict begin
|
|
|
|
/f exch def
|
|
|
|
/w 0 def
|
|
|
|
/s 0 def
|
|
|
|
f 0 get setfont
|
|
|
|
/integertype {
|
|
|
|
f exch get setfont
|
|
|
|
} def
|
|
|
|
/stringtype {
|
|
|
|
dup stringwidth pop w add /w exch def
|
|
|
|
spacecount s add /s exch def
|
|
|
|
} def
|
|
|
|
/arraytype { pop } def
|
|
|
|
% The input stream is on the top of the stack now
|
|
|
|
{
|
|
|
|
dup type exec
|
|
|
|
} forall
|
|
|
|
s w
|
|
|
|
end
|
|
|
|
grestore
|
|
|
|
} def
|
|
|
|
|
|
|
|
% stream fontset spacer --
|
|
|
|
% Show the stream in the given fontset, but add a certain amount
|
|
|
|
% of space to each space character
|
|
|
|
/showstreamspc {
|
|
|
|
5 dict begin
|
|
|
|
/spc exch def
|
|
|
|
/f exch def
|
|
|
|
f 0 get setfont
|
|
|
|
/integertype {
|
|
|
|
f exch get setfont
|
|
|
|
} def
|
|
|
|
/stringtype {
|
|
|
|
spc linkshow
|
|
|
|
} def
|
|
|
|
/arraytype {
|
|
|
|
exec
|
|
|
|
} def
|
|
|
|
% Now stream is on the top of the stack
|
|
|
|
{
|
|
|
|
dup type exec
|
|
|
|
} forall
|
|
|
|
end
|
|
|
|
} def
|
|
|
|
|
|
|
|
% stream fontset --
|
|
|
|
% Show the stream in the given fontset, with no extra spacing
|
|
|
|
/showstream {
|
|
|
|
0 showstreamspc
|
|
|
|
} def
|
|
|
|
|
|
|
|
% stream fontset totalspace --
|
|
|
|
% Show the stream justified to fit into a certain number of pixels
|
|
|
|
/showstreamjust {
|
|
|
|
userdict begin
|
|
|
|
/ts exch def /fs exch def /st exch def
|
|
|
|
st fs
|
|
|
|
st fs streamwidth ts exch sub exch
|
|
|
|
dup 0 gt { div } { pop } ifelse
|
|
|
|
showstreamspc
|
|
|
|
end
|
|
|
|
} def
|
|
|
|
|
|
|
|
/bullmarg lmarg bulladj add def
|
|
|
|
/lwidth pagewidth lmarg sub rmarg sub def
|
|
|
|
/bwidth lwidth bulladj sub def
|
|
|
|
|
|
|
|
%
|
|
|
|
% The various paragraph types
|
|
|
|
% The number at the end indicates start (1) of para, end (2) of para
|
|
|
|
%
|
|
|
|
/chapline {
|
|
|
|
currentpoint exch pop 10 sub lmarg exch moveto
|
|
|
|
0 setlinecap 3 setlinewidth
|
|
|
|
lwidth 0 rlineto stroke
|
|
|
|
} def
|
|
|
|
|
|
|
|
/chap0 { lmarg exch moveto cfont lwidth showstreamjust } def
|
|
|
|
/chap1 { lmarg exch moveto cfont lwidth showstreamjust } def
|
|
|
|
/chap2 { lmarg exch moveto cfont showstream chapline } def
|
|
|
|
/chap3 { lmarg exch moveto cfont showstream chapline } def
|
|
|
|
|
|
|
|
/appn0 {chap0} def
|
|
|
|
/appn1 {chap1} def
|
|
|
|
/appn2 {chap2} def
|
|
|
|
/appn3 {chap3} def
|
|
|
|
|
|
|
|
% lbl ypos fontset -- ypos
|
|
|
|
/headlbl {
|
|
|
|
3 -1 roll [exch ( )] exch % ypos strm fontset
|
|
|
|
2 copy % ypos strm fontset strm fontset
|
|
|
|
streamwidth % ypos strm fontset spccount width
|
|
|
|
lmarg exch sub % ypos strm fontset spccount xpos
|
|
|
|
4 index % ypos strm fontset spccount xpos ypos
|
|
|
|
moveto % ypos strm fontset spccount
|
|
|
|
pop % ypos strm fontset spccount
|
|
|
|
showstream % ypos
|
|
|
|
} def
|
|
|
|
|
|
|
|
/head0 { lmarg exch moveto hfont lwidth showstreamjust } def
|
|
|
|
/head1 { hfont headlbl lmarg exch moveto hfont lwidth showstreamjust } def
|
|
|
|
/head2 { lmarg exch moveto hfont showstream } def
|
|
|
|
/head3 { hfont headlbl lmarg exch moveto hfont showstream } def
|
|
|
|
|
|
|
|
/subh0 { lmarg exch moveto sfont lwidth showstreamjust } def
|
|
|
|
/subh1 { sfont headlbl lmarg exch moveto sfont lwidth showstreamjust } def
|
|
|
|
/subh2 { lmarg exch moveto sfont showstream } def
|
|
|
|
/subh3 { sfont headlbl lmarg exch moveto sfont showstream } def
|
|
|
|
|
2002-05-16 10:11:21 +08:00
|
|
|
/norm0 { lmarg exch moveto bfont lwidth showstreamjust } def
|
|
|
|
/norm1 { lmarg exch moveto bfont lwidth showstreamjust } def
|
|
|
|
/norm2 { lmarg exch moveto bfont showstream } def
|
|
|
|
/norm3 { lmarg exch moveto bfont showstream } def
|
2002-05-15 05:59:59 +08:00
|
|
|
|
2002-05-16 10:11:21 +08:00
|
|
|
/code0 { lmarg exch moveto bfont showstream } def
|
|
|
|
/code1 { lmarg exch moveto bfont showstream } def
|
|
|
|
/code2 { lmarg exch moveto bfont showstream } def
|
|
|
|
/code3 { lmarg exch moveto bfont showstream } def
|
2002-05-15 05:59:59 +08:00
|
|
|
|
2002-05-16 10:11:21 +08:00
|
|
|
/bull0 { bullmarg exch moveto bfont bwidth showstreamjust } def
|
|
|
|
/bull1 { dup lmarg exch moveto bullet bfont showstream
|
|
|
|
bullmarg exch moveto bfont bwidth showstreamjust } def
|
|
|
|
/bull2 { bullmarg exch moveto bfont showstream } def
|
|
|
|
/bull3 { dup lmarg exch moveto bullet bfont showstream
|
|
|
|
bullmarg exch moveto bfont showstream } def
|
2002-05-15 05:59:59 +08:00
|
|
|
|
|
|
|
/tocw0 lwidth tocpnz sub def
|
|
|
|
/tocw1 tocw0 tocind sub def
|
|
|
|
/tocw2 tocw1 tocind sub def
|
|
|
|
|
|
|
|
/tocx0 lmarg def
|
|
|
|
/tocx1 tocx0 tocind add def
|
|
|
|
/tocx2 tocx1 tocind add def
|
|
|
|
|
|
|
|
/tocpn {
|
2002-05-16 10:11:21 +08:00
|
|
|
bfont0 setfont
|
2002-05-15 05:59:59 +08:00
|
|
|
3 dict begin
|
|
|
|
/s exch def
|
|
|
|
/x s stringwidth pop pagewidth rmarg sub exch sub def
|
|
|
|
currentpoint /y exch def
|
|
|
|
lmarg sub tocdots div ceiling tocdots mul lmarg add
|
|
|
|
tocdots x {
|
|
|
|
y moveto (.) 0 linkshow
|
|
|
|
} for
|
|
|
|
x y moveto s 0 linkshow
|
|
|
|
end
|
|
|
|
linkend
|
|
|
|
} def
|
|
|
|
|
2002-05-16 10:11:21 +08:00
|
|
|
/toc00 { tocx0 exch moveto 0 rmoveto bfont showstream } def
|
2002-05-15 05:59:59 +08:00
|
|
|
/toc01 { tocx0 exch moveto
|
2002-05-16 10:11:21 +08:00
|
|
|
linkbegindest bfont0 setfont 0 linkshow bfont showstream } def
|
2002-05-15 05:59:59 +08:00
|
|
|
/toc02 { tocx0 exch moveto 3 1 roll
|
2002-05-16 10:11:21 +08:00
|
|
|
0 rmoveto bfont showstream tocpn } def
|
2002-05-15 05:59:59 +08:00
|
|
|
/toc03 { tocx0 exch moveto 4 1 roll
|
2002-05-16 10:11:21 +08:00
|
|
|
linkbegindest bfont0 setfont 0 linkshow bfont showstream tocpn } def
|
2002-05-15 05:59:59 +08:00
|
|
|
|
2002-05-16 10:11:21 +08:00
|
|
|
/toc10 { tocx1 exch moveto 0 rmoveto bfont showstream } def
|
2002-05-15 05:59:59 +08:00
|
|
|
/toc11 { tocx1 exch moveto
|
2002-05-16 10:11:21 +08:00
|
|
|
linkbegindest bfont0 setfont 0 linkshow bfont showstream } def
|
2002-05-15 05:59:59 +08:00
|
|
|
/toc12 { tocx1 exch moveto 3 1 roll
|
2002-05-16 10:11:21 +08:00
|
|
|
0 rmoveto bfont showstream tocpn } def
|
2002-05-15 05:59:59 +08:00
|
|
|
/toc13 { tocx1 exch moveto 4 1 roll
|
2002-05-16 10:11:21 +08:00
|
|
|
linkbegindest bfont0 setfont 0 linkshow bfont showstream tocpn } def
|
2002-05-15 05:59:59 +08:00
|
|
|
|
2002-05-16 10:11:21 +08:00
|
|
|
/toc20 { tocx2 exch moveto 0 rmoveto bfont showstream } def
|
2002-05-15 05:59:59 +08:00
|
|
|
/toc21 { tocx2 exch moveto
|
2002-05-16 10:11:21 +08:00
|
|
|
linkbegindest bfont0 setfont 0 linkshow bfont showstream } def
|
2002-05-15 05:59:59 +08:00
|
|
|
/toc22 { tocx2 exch moveto 3 1 roll
|
2002-05-16 10:11:21 +08:00
|
|
|
0 rmoveto bfont showstream tocpn } def
|
2002-05-15 05:59:59 +08:00
|
|
|
/toc23 { tocx2 exch moveto 4 1 roll
|
2002-05-16 10:11:21 +08:00
|
|
|
linkbegindest bfont0 setfont 0 linkshow bfont showstream tocpn } def
|
2002-05-15 15:11:21 +08:00
|
|
|
|
|
|
|
% Spacing between index columns
|
|
|
|
/indexcolumn pagewidth lmarg sub rmarg sub idxgutter add idxcolumns div def
|
|
|
|
% Width of an individual index column
|
|
|
|
/indexcolwid indexcolumn idxgutter sub def
|
|
|
|
|
|
|
|
/idx03 {
|
|
|
|
2 dict begin
|
|
|
|
indexcolumn mul lmarg add
|
|
|
|
/x exch def /y exch def x y moveto
|
2002-05-16 10:11:21 +08:00
|
|
|
exch bfont showstream
|
|
|
|
dup bfont streamwidth
|
2002-05-15 15:11:21 +08:00
|
|
|
x indexcolwid add exch sub exch pop y moveto
|
2002-05-16 10:11:21 +08:00
|
|
|
bfont showstream
|
2002-05-15 15:11:21 +08:00
|
|
|
end
|
|
|
|
} def
|
|
|
|
/idx00 {idx03} def
|
|
|
|
/idx01 {idx03} def
|
|
|
|
/idx02 {idx03} def
|
2002-05-15 05:59:59 +08:00
|
|
|
|
2002-05-16 14:40:56 +08:00
|
|
|
/idx13 {
|
|
|
|
2 dict begin
|
|
|
|
indexcolumn mul lmarg add idxindent add
|
|
|
|
/x exch def /y exch def x y moveto
|
|
|
|
exch bfont showstream
|
|
|
|
dup bfont streamwidth
|
|
|
|
x indexcolwid idxindent sub add exch sub exch pop y moveto
|
|
|
|
bfont showstream
|
|
|
|
end
|
|
|
|
} def
|
|
|
|
/idx10 {idx13} def
|
|
|
|
/idx11 {idx13} def
|
|
|
|
/idx12 {idx13} def
|
|
|
|
|
2002-05-15 05:59:59 +08:00
|
|
|
%
|
|
|
|
% Page numbers
|
|
|
|
%
|
|
|
|
/pagey botmarg pymarg sub def
|
|
|
|
/pagel lmarg plmarg sub def
|
|
|
|
/pager pagewidth rmarg sub prmarg add def
|
|
|
|
|
2008-06-12 09:23:14 +08:00
|
|
|
/pageeven { pagel pagey moveto bfont1 setfont show } def
|
|
|
|
/pageodd { bfont1 setfont dup stringwidth pop pager exch sub
|
2002-05-15 05:59:59 +08:00
|
|
|
pagey moveto show } def
|
|
|
|
|
|
|
|
%
|
|
|
|
% Functions invoked during parsing
|
|
|
|
%
|
|
|
|
/xa { linkdest } def
|
2002-05-15 15:11:21 +08:00
|
|
|
/pa { 0 pageheight moveto linkdest } def
|
|
|
|
/xl { linkbegindest } def
|
2002-05-15 05:59:59 +08:00
|
|
|
/wl { linkbeginuri } def
|
2002-05-15 15:11:21 +08:00
|
|
|
/pl { linkbeginpage } def
|
2002-05-15 05:59:59 +08:00
|
|
|
/el { linkend } def
|
|
|
|
|
|
|
|
%
|
|
|
|
% PDF viewer options
|
|
|
|
%
|
|
|
|
[/PageMode /UseOutlines /DOCVIEW pdfmark % Display bookmarks
|
|
|
|
|
2002-05-17 03:33:27 +08:00
|
|
|
%
|
|
|
|
% Functions to include EPS
|
|
|
|
%
|
|
|
|
/BeginEPSF {
|
|
|
|
/Before_EPSF_State save def
|
|
|
|
/dict_count countdictstack def
|
|
|
|
/op_count count 1 sub def
|
|
|
|
userdict begin
|
|
|
|
/showpage {} def
|
|
|
|
0 setgray 0 setlinecap
|
|
|
|
1 setlinewidth 0 setlinejoin
|
|
|
|
10 setmiterlimit [ ] 0 setdash newpath
|
|
|
|
/languagelevel where
|
|
|
|
{
|
|
|
|
pop languagelevel
|
|
|
|
1 ne {
|
|
|
|
false setstrokeadjust false setoverprint
|
|
|
|
} if
|
|
|
|
} if
|
|
|
|
} bind def
|
|
|
|
/EndEPSF {
|
|
|
|
count op_count sub {pop} repeat
|
|
|
|
countdictstack dict_count sub {end} repeat
|
|
|
|
Before_EPSF_State restore
|
|
|
|
} bind def
|