Fix an assignment which is intended as a comparison.
[obnox/wireshark/wip.git] / print.ps
1 %!
2 %
3 % Code between start/end remarks is put into ps.c
4 % Anything else is thrown away, and is for testing only.
5 %
6 % ---- wireshark preamble start ---- %
7 %!
8 %!PS-Adobe-2.0
9 %
10 % Wireshark - Network traffic analyzer
11 % By Gerald Combs <gerald@wireshark.org>
12 % Copyright 1998 Gerald Combs
13 %
14 %%Creator: Wireshark
15 %%Title: wireshark.ps
16 %%DocumentFonts: Helvetica Courier
17 %%EndComments
18 %!
19
20 %
21 % Ghostscript http://ghostscript.com/ can convert postscript to pdf files.
22 %
23 % To convert this postscript file to pdf, type (for US letter format):
24 % ps2pdf filename.ps
25 %
26 % or (for A4 format):
27 % ps2pdf -sPAPERSIZE=a4 filename.ps
28 %
29 % ... and of course replace filename.ps by your current filename.
30 %
31 % The pdfmark's below will help converting to a pdf file, and have no
32 % effect when printing the postscript directly.
33
34
35 %   This line is necessary if the file should be printable, and not just used
36 %   for distilling into PDF:
37 %
38 /pdfmark where {pop} {userdict /pdfmark /cleartomark load put} ifelse
39 %
40 %   This tells PDF viewers to display bookmarks when the document is opened:
41 %
42 [/PageMode /UseOutlines /DOCVIEW pdfmark
43
44 % Get the Imagable Area of the page
45 clippath pathbbox
46
47 % Set vmax to the vertical size of the page,
48 % hmax to the horizontal size of the page.
49 /vmax exch def
50 /hmax exch def
51 pop pop         % junk
52
53 % 1/2-inch margins
54 /lmargin 36 def                                 % left margin
55 /tmargin vmax 56 sub def                % top margin
56 /bmargin 36 def                                 % bottom margin
57 /pagenumtab hmax 36 sub def             % right margin
58
59 % Counters
60 /thispagenum 1 def
61
62 % Strings
63 /pagenostr 7 string def
64
65
66 /formfeed {
67         printpagedecorations
68         showpage
69         
70         % we need a new current point after showpage is done
71         lmargin         % X
72         vpos            % Y
73         moveto
74         /vpos tmargin def
75 } def
76
77 % Prints text with possible indenting
78 /putline_single {
79         exch 10 mul lmargin add         % X
80         vpos                                            % Y
81         moveto
82         show
83
84         /vpos vpos 10 sub def
85
86         vpos 5 sub bmargin le           % is vpos <= bottom margin?
87         {
88                 formfeed
89         }
90         if                                                      % then formfeed and start at top
91 } def
92
93
94 % Prints text with possible indenting and line wrap
95 /putline {
96         /text exch def
97         /indent exch def
98         
99         % wrapat = width / sizeof font (remember: monospaced font)
100         /pagewidth pagenumtab lmargin sub def
101         /cwidth (A) stringwidth pop def
102         /wrapat pagewidth cwidth div cvi def
103                 
104         text length wrapat le {
105                 % print line
106                 indent text 0 text length getinterval putline_single
107         }{
108                 % print the lines first part
109                 indent text 0 wrapat getinterval putline_single
110                 % print wrapped rest
111                 indent text wrapat text length wrapat sub getinterval putline
112         }
113         ifelse
114 } def
115
116
117 % Prints the page number at the top right
118 /printpagedecorations {
119         gsave
120                 % Set the font to 8 point
121                 /Helvetica findfont 8 scalefont setfont
122
123                 % title
124                 lmargin                                         % X
125                 vmax 36 sub                                     % Y
126                 moveto
127                 eth_pagetitle show
128
129                 % this page number
130                 pagenumtab (Page ) stringwidth pop sub thispagenum pagenostr cvs stringwidth pop sub            % X
131                 vmax 36 sub                                     % Y
132                 moveto
133                 (Page ) show
134                 thispagenum pagenostr cvs show
135
136                 % thispagenum++
137                 /thispagenum thispagenum 1 add def
138                 
139                 % line at top of page
140                 lmargin                                         % X
141                 vmax 38 sub                                     % Y
142                 moveto
143                 
144                 pagenumtab                                      % X
145                 vmax 38 sub                                     % Y
146                 lineto
147                 stroke
148                 
149                 % line at bottom of page
150                 lmargin                                         % X
151                 bmargin                                         % Y
152                 moveto
153                 
154                 pagenumtab                                      % X
155                 bmargin                                         % Y
156                 lineto
157                 stroke
158                 
159         grestore
160 } def
161         
162 % Reset the vertical position
163 /vpos tmargin def
164
165 % ---- wireshark preamble end ---- %
166
167 % Set the font to 8 point
168 /Courier findfont 8 scalefont setfont
169
170 % the page title
171 /eth_pagetitle (Wireshark) def
172
173 % Display our output lines.
174
175 % PDF bookmark link
176 [/Dest /__frame1__ /Title (Frame 1)   /OUT pdfmark
177 [/View [/XYZ -4 currentpoint matrix currentmatrix matrix defaultmatrix
178  matrix invertmatrix matrix concatmatrix transform exch pop 20 add null]
179  /Dest /__frame1__ /DEST pdfmark
180  
181 % packet data
182 0 (Frame 1) putline
183 0 (Ethernet II \(98 on wire, 68 captured\)) putline
184 1 (Destination: 00:00:0c:36:00:2a) putline
185 1 (Source: 00:c0:4f:c7:eb:c0) putline
186 1 (Type: IP \(0x0800\)) putline
187 0 (Ethernet II \(98 on wire, 68 captured\)) putline
188 1 (Source: 00:c0:4f:c7:eb:c0) putline
189 1 (Type: IP \(0x0800\)) putline
190 0 (Source: 00:c0:4f:c7:eb:c0) putline
191
192 0 () putline
193 0 (0000  cc 00 00 00 00 00 07 02 00 00 00 00 00 00 00 00   ................ ) putline
194 0 (0010  00 00 bd 0e fe 16 01 00 3e 00 03 08 58 4c 20 38   ........>...XL 8 ) putline
195 0 (0020  30 20 49 4d 33 00 16 01 00 34 00 16 01 01 35 00   0 IM3....4....5. ) putline
196 0 (0030  16 01 02 36 00 16 01 03 6e 00 16 01 ff 6f 00 16   ...6....n....o.. ) putline
197 0 (0040  01 ff 70 00 16 01 ff 71 00 16 01 ff 48 00 01 04   ..p....q....H... ) putline
198 0 (0050  ff 03 07 00 24 00 01 01 05 25 00 01 01 05 26 00   ....$....%....&. ) putline
199 0 (0060  01 01 05 27 00 01 01 05 6a 00 01 01 00 6b 00 01   ...'....j....k.. ) putline
200 0 (0070  01 00 6c 00 01 01 00 6d 00 01 01 00 3d 00 01 02   ..l....m....=... ) putline
201 0 (0080  02 00 c0 00 03 08 80 00 00 00 00 00 00 00 b4 00   ................ ) putline
202 0 (0090  01 04 c0 a8 42 ef 39 00 16 08 05 05 05 05 00 00   ....B.9......... ) putline
203 0 (00a0  00 00 00 03 20 36 41 20 52 69 6e 67 00 00 00 00   .... 6A Ring.... ) putline
204 0 (00b0  00 00 00 00 00 00                                 ......           ) putline
205 formfeed
206
207
208 % PDF bookmark link
209 [/Dest /__frame2__ /Title (Frame 2)   /OUT pdfmark
210 [/View [/XYZ -4 currentpoint matrix currentmatrix matrix defaultmatrix
211  matrix invertmatrix matrix concatmatrix transform exch pop 20 add null]
212  /Dest /__frame2__ /DEST pdfmark
213  
214 % packet data
215 0 (Frame 2) putline
216 0 (Ethernet II \(98 on wire, 68 captured\)) putline
217 1 (Destination: 00:00:0c:36:00:2a) putline
218 1 (Source: 00:c0:4f:c7:eb:c0) putline
219 1 (Type: IP \(0x0800\)) putline
220 0 (Ethernet II \(98 on wire, 68 captured\)) putline
221 1 (Source: 00:c0:4f:c7:eb:c0) putline
222 1 (Type: IP \(0x0800\)) putline
223 0 (Source: 00:c0:4f:c7:eb:c0) putline
224
225 0 () putline
226 0 (0000  cc 00 00 00 00 00 07 02 00 00 00 00 00 00 00 00   ................ ) putline
227 0 (0010  00 00 bd 0e fe 16 01 00 3e 00 03 08 58 4c 20 38   ........>...XL 8 ) putline
228 0 (0020  30 20 49 4d 33 00 16 01 00 34 00 16 01 01 35 00   0 IM3....4....5. ) putline
229 0 (0030  16 01 02 36 00 16 01 03 6e 00 16 01 ff 6f 00 16   ...6....n....o.. ) putline
230 0 (0040  01 ff 70 00 16 01 ff 71 00 16 01 ff 48 00 01 04   ..p....q....H... ) putline
231 0 (0050  ff 03 07 00 24 00 01 01 05 25 00 01 01 05 26 00   ....$....%....&. ) putline
232 0 (0060  01 01 05 27 00 01 01 05 6a 00 01 01 00 6b 00 01   ...'....j....k.. ) putline
233 0 (0070  01 00 6c 00 01 01 00 6d 00 01 01 00 3d 00 01 02   ..l....m....=... ) putline
234 0 (0080  02 00 c0 00 03 08 80 00 00 00 00 00 00 00 b4 00   ................ ) putline
235 0 (0090  01 04 c0 a8 42 ef 39 00 16 08 05 05 05 05 00 00   ....B.9......... ) putline
236 0 (00a0  00 00 00 03 20 36 41 20 52 69 6e 67 00 00 00 00   .... 6A Ring.... ) putline
237 0 (00b0  00 00 00 00 00 00                                 ......           ) putline
238
239 % ---- wireshark finale start ---- %
240
241 printpagedecorations
242 showpage
243
244 %%EOF
245
246 % ---- wireshark finale end ---- %