1 |
adcroft |
1.1 |
: # Use perl |
2 |
|
|
eval 'exec perl -S $0 "$@"' |
3 |
|
|
if $running_under_some_shell; |
4 |
|
|
|
5 |
|
|
####################################################################### |
6 |
|
|
# Sun Jun 4 00:35:58 IDT 2000 |
7 |
|
|
# Comments by Stas Bekman <stas@stason.org>: |
8 |
|
|
# |
9 |
|
|
# This package was last seen at http://www.tdb.uu.se/~jan/html2ps.html. |
10 |
|
|
# The software wasn't developed anymore, none of my patches were accepted |
11 |
|
|
# therefore I've forked it and add all the patches to this version. |
12 |
|
|
# |
13 |
|
|
# Currently it's distributed as a component of the bigger package under |
14 |
|
|
# the same license as Perl or GNU GPL, whichever you prefer. |
15 |
|
|
# |
16 |
|
|
# The original header/license is present on the next lines |
17 |
|
|
####################################################################### |
18 |
|
|
|
19 |
|
|
####################################################################### |
20 |
|
|
# This is html2ps version 1.0 beta1, an HTML-to-PostScript converter. |
21 |
|
|
# Copyright (C) 1995-1997 Jan Karrman. |
22 |
|
|
# |
23 |
|
|
# This program is free software; you can redistribute it and/or modify |
24 |
|
|
# it under the terms of the GNU General Public License as published by |
25 |
|
|
# the Free Software Foundation; either version 2 of the License, or |
26 |
|
|
# (at your option) any later version. |
27 |
|
|
# |
28 |
|
|
# This program is distributed in the hope that it will be useful, |
29 |
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
30 |
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
31 |
|
|
# GNU General Public License for more details. |
32 |
|
|
# |
33 |
|
|
# You should have received a copy of the GNU General Public License |
34 |
|
|
# along with this program; if not, write to the Free Software |
35 |
|
|
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
36 |
|
|
# |
37 |
|
|
# Author: Jan Karrman, Dept. of Scientific Computing, Uppsala University, |
38 |
|
|
# Sweden, e-mail: jan@tdb.uu.se. |
39 |
|
|
####################################################################### |
40 |
|
|
|
41 |
|
|
|
42 |
|
|
# Set the name of the global configuration file. See the installation notes |
43 |
|
|
# and manual page for more details on configuration files. |
44 |
|
|
|
45 |
|
|
use FindBin qw($Bin); |
46 |
|
|
use lib $Bin; |
47 |
|
|
|
48 |
|
|
$globrc="$Bin/html2ps-global.conf"; |
49 |
|
|
|
50 |
|
|
$conf=<<'EOR'; |
51 |
|
|
@html2ps { |
52 |
|
|
package { |
53 |
|
|
PerlMagick: 0; |
54 |
|
|
ImageMagick: 0; |
55 |
|
|
pbmplus: 0; |
56 |
|
|
netpbm: 0; |
57 |
|
|
djpeg: 0; |
58 |
|
|
Ghostscript: 0; |
59 |
|
|
TeX: 0; |
60 |
|
|
dvips: 0; |
61 |
|
|
libwww-perl: 0; |
62 |
|
|
jfriedl: 0; |
63 |
|
|
geturl: ""; |
64 |
|
|
check: ""; |
65 |
|
|
path: ""; |
66 |
|
|
} |
67 |
|
|
paper { |
68 |
|
|
type: A4; |
69 |
|
|
height: ""; |
70 |
|
|
width: ""; |
71 |
|
|
} |
72 |
|
|
option { |
73 |
|
|
twoup: 0; |
74 |
|
|
base: ""; |
75 |
|
|
check: 0; |
76 |
|
|
toc: ""; |
77 |
|
|
debug: 0; |
78 |
|
|
DSC: 0; |
79 |
|
|
encoding: "ISO-8859-1"; |
80 |
|
|
rcfile: ""; |
81 |
|
|
frame: 0; |
82 |
|
|
grayscale: 0; |
83 |
|
|
help: 0; |
84 |
|
|
hyphenate: 0; |
85 |
|
|
scaleimage: 1; |
86 |
|
|
language: ""; |
87 |
|
|
landscape: 0; |
88 |
|
|
scalemath: 1; |
89 |
|
|
number: 0; |
90 |
|
|
startno: ""; |
91 |
|
|
output: ""; |
92 |
|
|
original: 0; |
93 |
|
|
rootdir: ""; |
94 |
|
|
xref: 0; |
95 |
|
|
scaledoc: 1; |
96 |
|
|
style: ""; |
97 |
|
|
text: 0; |
98 |
|
|
underline: 0; |
99 |
|
|
colour: 0; |
100 |
|
|
version: 0; |
101 |
|
|
web: ""; |
102 |
|
|
duplex: ""; |
103 |
|
|
} |
104 |
|
|
margin { |
105 |
|
|
left: 2.5cm; |
106 |
|
|
right: 2.5cm; |
107 |
|
|
top: 3cm; |
108 |
|
|
bottom: 3cm; |
109 |
|
|
middle: 2cm; |
110 |
|
|
} |
111 |
|
|
xref { |
112 |
|
|
text: "[p $N]"; |
113 |
|
|
passes: 1; |
114 |
|
|
} |
115 |
|
|
quote { |
116 |
|
|
en { |
117 |
|
|
open: "“"; |
118 |
|
|
close: "”"; |
119 |
|
|
open2: "`"; |
120 |
|
|
close2: "'"; |
121 |
|
|
} |
122 |
|
|
sv { |
123 |
|
|
open: "”"; |
124 |
|
|
close: "”"; |
125 |
|
|
open2: "'"; |
126 |
|
|
close2: "'"; |
127 |
|
|
} |
128 |
|
|
da { |
129 |
|
|
open: "»"; |
130 |
|
|
close: "«"; |
131 |
|
|
} |
132 |
|
|
no { |
133 |
|
|
open: "«"; |
134 |
|
|
close: "»"; |
135 |
|
|
} |
136 |
|
|
fr { |
137 |
|
|
open: "« "; |
138 |
|
|
close: " »"; |
139 |
|
|
} |
140 |
|
|
de { |
141 |
|
|
open: "„"; |
142 |
|
|
close: "“"; |
143 |
|
|
open2: "‚"; |
144 |
|
|
close2: "`"; |
145 |
|
|
} |
146 |
|
|
fi: sv; |
147 |
|
|
es: en; |
148 |
|
|
it: no; |
149 |
|
|
} |
150 |
|
|
toc { |
151 |
|
|
heading: "<H1>$T</H1> |
152 |
|
|
<H2>Table of Contents</H2>"; |
153 |
|
|
level: 6; |
154 |
|
|
indent: 1em; |
155 |
|
|
extrapage: 1; |
156 |
|
|
} |
157 |
|
|
font { |
158 |
|
|
times { |
159 |
|
|
names: "Times-Roman |
160 |
|
|
Times-Italic |
161 |
|
|
Times-Bold |
162 |
|
|
Times-BoldItalic"; |
163 |
|
|
} |
164 |
|
|
new-century-schoolbook { |
165 |
|
|
names: "NewCenturySchlbk-Roman |
166 |
|
|
NewCenturySchlbk-Italic |
167 |
|
|
NewCenturySchlbk-Bold |
168 |
|
|
NewCenturySchlbk-BoldItalic"; |
169 |
|
|
} |
170 |
|
|
helvetica { |
171 |
|
|
names: "Helvetica |
172 |
|
|
Helvetica-Oblique |
173 |
|
|
Helvetica-Bold |
174 |
|
|
Helvetica-BoldOblique"; |
175 |
|
|
} |
176 |
|
|
helvetica-narrow { |
177 |
|
|
names: "Helvetica-Narrow |
178 |
|
|
Helvetica-Narrow-Oblique |
179 |
|
|
Helvetica-Narrow-Bold |
180 |
|
|
Helvetica-Narrow-BoldOblique"; |
181 |
|
|
} |
182 |
|
|
palatino { |
183 |
|
|
names: "Palatino-Roman |
184 |
|
|
Palatino-Italic |
185 |
|
|
Palatino-Bold |
186 |
|
|
Palatino-BoldItalic"; |
187 |
|
|
} |
188 |
|
|
avantgarde { |
189 |
|
|
names: "AvantGarde-Book |
190 |
|
|
AvantGarde-BookOblique |
191 |
|
|
AvantGarde-Demi |
192 |
|
|
AvantGarde-DemiOblique"; |
193 |
|
|
} |
194 |
|
|
bookman { |
195 |
|
|
names: "Bookman-Light |
196 |
|
|
Bookman-LightItalic |
197 |
|
|
Bookman-Demi |
198 |
|
|
Bookman-DemiItalic"; |
199 |
|
|
} |
200 |
|
|
courier { |
201 |
|
|
names: "Courier |
202 |
|
|
Courier-Oblique |
203 |
|
|
Courier-Bold |
204 |
|
|
Courier-BoldOblique"; |
205 |
|
|
} |
206 |
|
|
} |
207 |
|
|
hyphenation { |
208 |
|
|
min: 8; |
209 |
|
|
start: 4; |
210 |
|
|
end: 3; |
211 |
|
|
en { |
212 |
|
|
file: ""; |
213 |
|
|
extfile: ""; |
214 |
|
|
} |
215 |
|
|
} |
216 |
|
|
header { |
217 |
|
|
left: ""; |
218 |
|
|
center: ""; |
219 |
|
|
right: ""; |
220 |
|
|
odd-left: ""; |
221 |
|
|
odd-center: ""; |
222 |
|
|
odd-right: ""; |
223 |
|
|
even-left: ""; |
224 |
|
|
even-center: ""; |
225 |
|
|
even-right: ""; |
226 |
|
|
font-family: Helvetica; |
227 |
|
|
font-size: 8pt; |
228 |
|
|
font-style: normal; |
229 |
|
|
font-weight: normal; |
230 |
|
|
color: black; |
231 |
|
|
alternate: 1; |
232 |
|
|
} |
233 |
|
|
footer { |
234 |
|
|
left: ""; |
235 |
|
|
center: ""; |
236 |
|
|
right: ""; |
237 |
|
|
odd-left: ""; |
238 |
|
|
odd-center: ""; |
239 |
|
|
odd-right: ""; |
240 |
|
|
even-left: ""; |
241 |
|
|
even-center: ""; |
242 |
|
|
even-right: ""; |
243 |
|
|
font-family: Helvetica; |
244 |
|
|
font-size: 8pt; |
245 |
|
|
font-style: normal; |
246 |
|
|
font-weight: normal; |
247 |
|
|
color: black; |
248 |
|
|
alternate: 1; |
249 |
|
|
} |
250 |
|
|
frame { |
251 |
|
|
width: 0.6pt; |
252 |
|
|
margin: 0.5cm; |
253 |
|
|
color: black; |
254 |
|
|
} |
255 |
|
|
justify { |
256 |
|
|
word: 15pt; |
257 |
|
|
letter: 0pt; |
258 |
|
|
} |
259 |
|
|
draft { |
260 |
|
|
text: DRAFT; |
261 |
|
|
print: ""; |
262 |
|
|
dir: 0; |
263 |
|
|
font-family: Helvetica; |
264 |
|
|
font-style: normal; |
265 |
|
|
font-weight: bold; |
266 |
|
|
color: F0F0F0; |
267 |
|
|
} |
268 |
|
|
colour { |
269 |
|
|
black: 000000; |
270 |
|
|
green: 008000; |
271 |
|
|
silver: C0C0C0; |
272 |
|
|
lime: 00FF00; |
273 |
|
|
gray: 808080; |
274 |
|
|
olive: 808000; |
275 |
|
|
white: FFFFFF; |
276 |
|
|
yellow: FFFF00; |
277 |
|
|
maroon: 800000; |
278 |
|
|
navy: 000080; |
279 |
|
|
red: FF0000; |
280 |
|
|
blue: 0000FF; |
281 |
|
|
purple: 800080; |
282 |
|
|
teal: 008080; |
283 |
|
|
fuchsia: FF00FF; |
284 |
|
|
aqua: 00FFFF; |
285 |
|
|
} |
286 |
|
|
html2psrc: "$HOME/.html2psrc"; |
287 |
|
|
imgalt: "[IMAGE]"; |
288 |
|
|
datefmt: "%e %b %Y %R"; |
289 |
|
|
locale: ""; |
290 |
|
|
doc-sep: "<!--NewPage-->"; |
291 |
|
|
ball-radius: 0.25em; |
292 |
|
|
numbstyle: 0; |
293 |
|
|
showurl: 0; |
294 |
|
|
seq-number: 0; |
295 |
|
|
forms: 1; |
296 |
|
|
textarea-data: 1; |
297 |
|
|
page-break: 1; |
298 |
|
|
expand-acronyms: 0; |
299 |
|
|
collapse-br: 1; |
300 |
|
|
spoof: ""; |
301 |
|
|
} |
302 |
|
|
|
303 |
|
|
BODY { |
304 |
|
|
font-family: Times; |
305 |
|
|
font-size: 11pt; |
306 |
|
|
text-align: left; |
307 |
|
|
background: white; |
308 |
|
|
} |
309 |
|
|
|
310 |
|
|
H1, H2, H3, H4, H5, H6 { |
311 |
|
|
font-weight: bold; |
312 |
|
|
margin-top: 0.8em; |
313 |
|
|
margin-bottom: 0.5em; |
314 |
|
|
} |
315 |
|
|
H1 { font-size: 19pt } |
316 |
|
|
H2 { font-size: 17pt } |
317 |
|
|
H3 { font-size: 15pt } |
318 |
|
|
H4 { font-size: 13pt } |
319 |
|
|
H5 { font-size: 12pt } |
320 |
|
|
H6 { font-size: 11pt } |
321 |
|
|
|
322 |
|
|
P, OL, UL, DL, BLOCKQUOTE, PRE { |
323 |
|
|
margin-top: 1em; |
324 |
|
|
margin-bottom: 1em; |
325 |
|
|
} |
326 |
|
|
|
327 |
|
|
P { |
328 |
|
|
line-height: 1.2em; |
329 |
|
|
text-indent: 0; |
330 |
|
|
} |
331 |
|
|
|
332 |
|
|
OL, UL, DD { margin-left: 2em } |
333 |
|
|
|
334 |
|
|
TT, KBD, PRE { font-family: Courier } |
335 |
|
|
|
336 |
|
|
PRE { font-size: 9pt } |
337 |
|
|
|
338 |
|
|
BLOCKQUOTE { |
339 |
|
|
margin-left: 1em; |
340 |
|
|
margin-right: 1em; |
341 |
|
|
} |
342 |
|
|
|
343 |
|
|
ADDRESS { |
344 |
|
|
margin-top: 0.5em; |
345 |
|
|
margin-bottom: 0.5em; |
346 |
|
|
} |
347 |
|
|
|
348 |
|
|
TABLE { |
349 |
|
|
margin-top: 1.3em; |
350 |
|
|
margin-bottom: 1em; |
351 |
|
|
} |
352 |
|
|
|
353 |
|
|
DEL { text-decoration: line-through } |
354 |
|
|
|
355 |
|
|
A:link, HR { color: black } |
356 |
|
|
|
357 |
|
|
EOR |
358 |
|
|
|
359 |
|
|
require POSIX; |
360 |
|
|
%extend=('quote',1, 'font',1, 'colour',1, 'hyphenation',1); |
361 |
|
|
%fal=("serif","times", "sans_serif","helvetica", "monospace","courier"); |
362 |
|
|
@fo=("p","pre","h1","h2","h3","h4","h5","h6","i","b","tt","kbd","cite","samp", |
363 |
|
|
"address","blockquote","ol","ul","dl","dt","dd","table","header","footer"); |
364 |
|
|
%quote=('','en'); |
365 |
|
|
%valid=('font',1, 'font_files',1); |
366 |
|
|
%cm=('cm',1, 'mm',0.1, 'in',2.54, 'pt',2.54/72, 'pc',2.54/6); |
367 |
|
|
%pt=('cm',72/2.54, 'mm',72/25.4, 'in',72, 'pt',1, 'pc',12); |
368 |
|
|
%space=('thinsp',6, '#8201',6, 'ensp',2, '#8194',2, 'emsp',1, '#8195',1); |
369 |
|
|
$space=join('|',keys %space); |
370 |
|
|
%vars=("T","Ti", "N","Pn", "U","UR", "H","h", "A","Au"); |
371 |
|
|
%height=("letter",27.9, "legal",35.6, "arche",121.9, "archd",91.4, "archc",61, |
372 |
|
|
"archb",45.7, "archa",30.5, "flsa",33, "flse",33, "halfletter",21.6, |
373 |
|
|
"11x17",43.2, "ledger",27.9); |
374 |
|
|
%width=("letter",21.6, "legal",21.6, "arche",91.4, "archd",61, "archc",45.7, |
375 |
|
|
"archb",30.5, "archa",22.9, "flsa",21.6, "flse",21.6, "halfletter",14, |
376 |
|
|
"11x17",27.9, "ledger",43.2); |
377 |
|
|
|
378 |
|
|
$version="html2ps version 1.0 beta1"; |
379 |
|
|
$opts="2|b:|c|C:|d|D|e:|f:|F|g|h|H|i:|l:|L|m:|n|N:|o:|O|r:|R|s:|S:|T|u|U|v|W:|" |
380 |
|
|
."x:"; |
381 |
|
|
%optalias=( 'twoup','2', 'base','b', 'check','c', 'toc','C', 'debug','d', |
382 |
|
|
'DSC','D', 'encoding','e', 'rcfile','f', 'frame','F', 'grayscale','g', |
383 |
|
|
'help','h', 'hyphenate','H', 'scaleimage','i', 'language','l', |
384 |
|
|
'landscape','L', 'scalemath','m', 'number','n', 'startno','N', 'output','o', |
385 |
|
|
'original','O', 'rootdir','r', 'xref','R', 'scaledoc','s', 'style','S', |
386 |
|
|
'text','T', 'underline','u', 'colour','U', 'version','v', 'web','W', |
387 |
|
|
'duplex','x'); |
388 |
|
|
%type=( 'paper,height',2, 'paper,width',2, 'option,i',3, 'option,m',3, |
389 |
|
|
'option,N',4, 'option,s',3, 'option,x',4, 'xref,passes',4, 'draft,print',5); |
390 |
|
|
|
391 |
|
|
$usage=<<EOU; |
392 |
|
|
Usage: |
393 |
|
|
html2ps [-2cdDFghHLnORTuUv] [-b URL] [-C string] [-e encoding] |
394 |
|
|
[-f file[:file[:...]]] [-i num] [-l lang] [-m num] [-N num] [-o file] |
395 |
|
|
[-r path] [-s num] [-S string] [-W string] [-x num] |
396 |
|
|
[file|URL [file|URL [...]]] |
397 |
|
|
|
398 |
|
|
EOU |
399 |
|
|
|
400 |
|
|
$args="@ARGV"; |
401 |
|
|
&Getopts($opts) || die $usage; |
402 |
|
|
|
403 |
|
|
if($opt_d) { |
404 |
|
|
open(DBG,">html2ps.dbg") || die "Error opening debug file: html2ps.dbg\n"; |
405 |
|
|
print DBG "***** $version\n***** Command: $0 $args\n***** Perl: $]\n"; |
406 |
|
|
print DBG "***** HTML2PSPATH=$ENV{'HTML2PSPATH'}\n"; |
407 |
|
|
} |
408 |
|
|
undef $/; |
409 |
|
|
$user=0; |
410 |
|
|
$V='(-?\d+\.?\d*|-?\d*\.?\d+)'; |
411 |
|
|
&getconf($conf); |
412 |
|
|
for(@fo,"draft") { |
413 |
|
|
eval "\$deffnt{'$_'}=defined \$$_\{'font-family'\}?" |
414 |
|
|
."\$$_\{'font-family'\}:\$body{'font-family'}"; |
415 |
|
|
} |
416 |
|
|
$user=1; |
417 |
|
|
if(open(RC,$globrc)) { |
418 |
|
|
$conf=<RC>; |
419 |
|
|
print DBG "***** Global file $globrc:\n$conf" if($opt_d); |
420 |
|
|
&getconf($conf); |
421 |
|
|
close RC; |
422 |
|
|
} else { |
423 |
|
|
# stas: temporarily commented out, since I don't know where this file |
424 |
|
|
# will be installed on user's system. -- should solve this. |
425 |
|
|
# &dbg("Warning: cannot open the global resource file: $globrc\n") if($globrc); |
426 |
|
|
} |
427 |
|
|
$html2psrc=~s/^(~|\$HOME)/$ENV{"HOME"}/; |
428 |
|
|
$prc=$html2psrc; |
429 |
|
|
if($opt_f) { |
430 |
|
|
($prc=$opt_f)=~s/^:/$html2psrc:/; |
431 |
|
|
$prc=~s/:$/:$html2psrc/; |
432 |
|
|
$prc=~s/::/:$html2psrc:/; |
433 |
|
|
} |
434 |
|
|
$cwd=POSIX::getcwd(); |
435 |
|
|
opendir(DIR,$cwd); |
436 |
|
|
@local=readdir DIR; |
437 |
|
|
closedir DIR; |
438 |
|
|
$globrc=~/html2psrc/; |
439 |
|
|
$gdir=$`; |
440 |
|
|
$hpath=$ENV{"HTML2PSPATH"}?$ENV{"HTML2PSPATH"}:".:"; |
441 |
|
|
$hpath=~s/^:/$gdir:/; |
442 |
|
|
$hpath=~s/:$/:$gdir/; |
443 |
|
|
$hpath=~s/::/:$gdir:/; |
444 |
|
|
$cur=$hpath=~s/(^|:)\.($|:)/$1$cwd$2/; |
445 |
|
|
@hpath=split(/:/,$hpath); |
446 |
|
|
for(@hpath) { |
447 |
|
|
if(opendir(DIR,$_)) { |
448 |
|
|
@files=readdir DIR; |
449 |
|
|
$files{$_}=" @files "; |
450 |
|
|
closedir DIR; |
451 |
|
|
} |
452 |
|
|
} |
453 |
|
|
@rc=split(/:/,$prc); |
454 |
|
|
for $rc (@rc) { |
455 |
|
|
$found=0; |
456 |
|
|
S:for $dir (@hpath) { |
457 |
|
|
if(-r $rc && !grep(/^$rc$/,@local) || $files{$dir}=~/ $rc /) { |
458 |
|
|
chdir $dir if($files{$dir}=~/ $rc /); |
459 |
|
|
if(open(RC,$rc)) { |
460 |
|
|
$conf=<RC>; |
461 |
|
|
print DBG "***** Personal file $rc:\n$conf" if($opt_d); |
462 |
|
|
&getconf($conf); |
463 |
|
|
close RC; |
464 |
|
|
$found=1; |
465 |
|
|
} |
466 |
|
|
last S; |
467 |
|
|
} |
468 |
|
|
} |
469 |
|
|
&dbg("Error opening resource file: $rc\n") if($opt_f && !$found); |
470 |
|
|
} |
471 |
|
|
chdir $cwd; |
472 |
|
|
$user=2; |
473 |
|
|
&getconf($opt_S) if($opt_S); |
474 |
|
|
print DBG "*****\n" if($opt_d); |
475 |
|
|
|
476 |
|
|
require Image::Magick if($package{'PerlMagick'}); |
477 |
|
|
$geturl=$package{'geturl'}; |
478 |
|
|
$ulanch="f"; |
479 |
|
|
$f=72/2.54; |
480 |
|
|
$giftopm="giftopnm" if($package{'netpbm'}); |
481 |
|
|
$giftopm="giftoppm" if($package{'pbmplus'}); |
482 |
|
|
|
483 |
|
|
for(keys %option){eval "\$opt_$_='$option{$_}' if(!defined \$opt_$_)"}; |
484 |
|
|
($scr=POSIX::tmpnam())=~/\w+$/; |
485 |
|
|
$tempdir=$`; |
486 |
|
|
die $usage if $opt_h; |
487 |
|
|
&dbg("$version\n") if ($opt_v||$opt_d); |
488 |
|
|
for ('left','right','top','bottom') { |
489 |
|
|
$body{"margin-$_"}=$margin{$_} if(!defined $body{"margin-$_"}); |
490 |
|
|
} |
491 |
|
|
if($opt_u) {$ulanch="t"}; |
492 |
|
|
if(defined $opt_x && $opt_x!~/^[0-2]$/) { |
493 |
|
|
die "Illegal duplex value: $opt_x\n"; |
494 |
|
|
} |
495 |
|
|
$V='(-?\d+\.?\d*|-?\d*\.?\d+)'; |
496 |
|
|
for $o ($opt_s,$opt_i,$opt_m,$opt_N) { |
497 |
|
|
die "Non numeric: $o\n" if(defined($o) && $o!~/^$V$/); |
498 |
|
|
} |
499 |
|
|
|
500 |
|
|
$twoup=$opt_2?"t":"f"; |
501 |
|
|
$xp=$toc{'extrapage'}?"t":"f"; |
502 |
|
|
|
503 |
|
|
die "Invalid option: -W $opt_W\n" if($opt_W!~/^[abflprsL\d]*$/); |
504 |
|
|
$tocdoc=$opt_C=~/[ft]/; |
505 |
|
|
if($tocdoc && !defined $opt_W) {$opt_W=4}; |
506 |
|
|
$mult=$#ARGV>0 || $opt_W; |
507 |
|
|
$maxlev=$opt_W=~/(\d+)/?$1:4; |
508 |
|
|
$link=$opt_W=~/l/; |
509 |
|
|
$local=$opt_W=~/s/; |
510 |
|
|
$rel=$opt_W=~/r/; |
511 |
|
|
$below=$opt_W=~/b/; |
512 |
|
|
$layer=$opt_W=~/L/; |
513 |
|
|
$prompt=$opt_W=~/p/; |
514 |
|
|
|
515 |
|
|
if($opt_C && $opt_C!~/^(b?[ft]|[ft]b?|b?h|hb?)$/) |
516 |
|
|
{die "Invalid option: -C $opt_C\n"}; |
517 |
|
|
$tc=$opt_C?"t":"f"; |
518 |
|
|
$rev=$opt_C=~/t/; |
519 |
|
|
$first=$opt_C=~/b/ || $opt_R; |
520 |
|
|
$th=$tocdoc?"f":"t"; |
521 |
|
|
$oeh=0; |
522 |
|
|
$oef=0; |
523 |
|
|
|
524 |
|
|
@now=localtime; |
525 |
|
|
POSIX::setlocale(&POSIX::LC_TIME,$locale); |
526 |
|
|
$R='(\s*>|[^a-zA-Z0-9>][^>]*>)'; |
527 |
|
|
$S='([\w.:/%-]+)|"([^"]*)"|\'([^\']*)\''; |
528 |
|
|
$X='[\da-fA-F]'; |
529 |
|
|
$IM='(gif|jpeg|jpg|png|xbm|xpm|ps|eps)'; |
530 |
|
|
|
531 |
|
|
for('odd-left','odd-center','odd-right','even-left','even-center','even-right') |
532 |
|
|
{ |
533 |
|
|
$oeh=1 if defined $header{$_}; |
534 |
|
|
$oef=1 if defined $footer{$_}; |
535 |
|
|
} |
536 |
|
|
for $a ('left','center','right') { |
537 |
|
|
if(defined $header{"odd-$a"} || defined $header{"even-$a"}) { |
538 |
|
|
$oeh=1; |
539 |
|
|
} |
540 |
|
|
if(defined $footer{"odd-$a"} || defined $footer{"even-$a"}) { |
541 |
|
|
$oef=1; |
542 |
|
|
} |
543 |
|
|
for('','odd-','even-') { |
544 |
|
|
$apa=$header{$_.$a}; |
545 |
|
|
$numb=1 if($apa=~/(^|[^\$])\$N/); |
546 |
|
|
$header{$_.$a}="($apa)"; |
547 |
|
|
$apa=$footer{$_.$a}; |
548 |
|
|
$numb=1 if($apa=~/(^|[^\$])\$N/); |
549 |
|
|
$footer{$_.$a}="($apa)"; |
550 |
|
|
&varsub($header{$_.$a},$footer{$_.$a}); |
551 |
|
|
} |
552 |
|
|
} |
553 |
|
|
if($oeh) { |
554 |
|
|
$yz="/YY [[{$header{'odd-left'}}{$header{'even-left'}}]" |
555 |
|
|
."[{$header{'odd-right'}}{$header{'even-right'}}]" |
556 |
|
|
."[{$header{'odd-center'}}{$header{'even-center'}}]] D\n"; |
557 |
|
|
} else { |
558 |
|
|
$ind=$header{'alternate'}; |
559 |
|
|
$yz="/YY [[{$header{'left'}}$ind][{$header{'right'}}".(1-$ind) |
560 |
|
|
."][{$header{'center'}}2]] D\n"; |
561 |
|
|
} |
562 |
|
|
if($oef) { |
563 |
|
|
$yz.="/ZZ [[{$footer{'odd-left'}}{$footer{'even-left'}}]" |
564 |
|
|
."[{$footer{'odd-right'}}{$footer{'even-right'}}]" |
565 |
|
|
."[{$footer{'odd-center'}}{$footer{'even-center'}}]] D"; |
566 |
|
|
} else { |
567 |
|
|
$ind=$footer{'alternate'}; |
568 |
|
|
$yz.="/ZZ [[{$footer{'left'}}$ind][{$footer{'right'}}".(1-$ind) |
569 |
|
|
."][{$footer{'center'}}2]] D"; |
570 |
|
|
} |
571 |
|
|
$number=$opt_n || !$numb && ($opt_C || $opt_N || $opt_R)?"t":"f"; |
572 |
|
|
|
573 |
|
|
for ($imgalt,$xref{'text'},$toc{'heading'},$draft{'text'}) {&spec($_)}; |
574 |
|
|
|
575 |
|
|
for ($paper{'height'},$paper{'width'},$body{'margin-left'}, |
576 |
|
|
$body{'margin-right'},$body{'margin-top'},$body{'margin-bottom'}, |
577 |
|
|
$margin{'middle'},$frame{'margin'}) { |
578 |
|
|
&getval($_,1); |
579 |
|
|
} |
580 |
|
|
$opt_s*=0.65 if($opt_2 && $opt_L); |
581 |
|
|
$opt_N=1 if(!defined $opt_N); |
582 |
|
|
$opt_N=int($opt_N-1); |
583 |
|
|
$mm=int($margin{'middle'}*$f); |
584 |
|
|
$is=0.8*$opt_i; |
585 |
|
|
$msc=1/$opt_s; |
586 |
|
|
$mag=1200*$opt_m*$opt_s; |
587 |
|
|
$xref=$opt_R?"t":"f"; |
588 |
|
|
$xref{'text'}=~s/\$N/) WB pN WB (/g; |
589 |
|
|
|
590 |
|
|
$d=int($f*$frame{'margin'}); |
591 |
|
|
$ml=$body{'margin-left'}; |
592 |
|
|
$mr=$body{'margin-right'}; |
593 |
|
|
$mt=$body{'margin-top'}; |
594 |
|
|
$mb=$body{'margin-bottom'}; |
595 |
|
|
for (0..10) { |
596 |
|
|
$temp=2**(-$_/2); |
597 |
|
|
$width{"a$_"}=int($temp*2**(-1/4)*1000+.5)/10; |
598 |
|
|
$height{"a$_"}=int($temp*2**(1/4)*1000+.5)/10; |
599 |
|
|
$width{"b$_"}=int($temp*1000+.5)/10; |
600 |
|
|
$height{"b$_"}=int($temp*2**(1/2)*1000+.5)/10; |
601 |
|
|
} |
602 |
|
|
if($width{"\L$paper{'type'}"}) { |
603 |
|
|
$paper{'height'}=$height{"\L$paper{'type'}"} if(!defined $paper{'height'}); |
604 |
|
|
$paper{'width'}=$width{"\L$paper{'type'}"} if(!defined $paper{'width'}); |
605 |
|
|
} elsif($paper{'type'}) { |
606 |
|
|
&dbg("Unknown paper type: $paper{'type'}\n"); |
607 |
|
|
} |
608 |
|
|
if($opt_L) { |
609 |
|
|
$width=$paper{'height'}-$ml-$mr; |
610 |
|
|
$hight=$paper{'width'}-$mt-$mb; |
611 |
|
|
$xc=int($mt*$f+.5); |
612 |
|
|
$yc=int($ml*$f+.5); |
613 |
|
|
$rot=" 90 rotate"; |
614 |
|
|
} else { |
615 |
|
|
$width=$paper{'width'}-$ml-$mr; |
616 |
|
|
$hight=$paper{'height'}-$mt-$mb; |
617 |
|
|
$xc=int($ml*$f+.5); |
618 |
|
|
$yc=int(($paper{'height'}-$mt)*$f+.5); |
619 |
|
|
$rot=""; |
620 |
|
|
} |
621 |
|
|
$width=($width-$margin{'middle'})/2 if($opt_2); |
622 |
|
|
$w=int($width*$f); |
623 |
|
|
$l=int($hight*$f); |
624 |
|
|
$pag=int($paper{'height'}*72/2.54+.5); |
625 |
|
|
$fe=$opt_F?"t":"f"; |
626 |
|
|
$xr=int($w/$opt_s+.5)+$d; |
627 |
|
|
$yb=-int($l/$opt_s+.5)-$d; |
628 |
|
|
$cf=$opt_U?"t":"f"; |
629 |
|
|
$rm=$numbstyle?"t":"f"; |
630 |
|
|
$pa=$showurl?"t":"f"; |
631 |
|
|
$nh=$seq_number?"t":"f"; |
632 |
|
|
$ea=$expand_acronyms?"t":"f"; |
633 |
|
|
$latin1=$opt_e=~/ISO-8859-1/i; |
634 |
|
|
$lt=$del{'text-decoration'}=~/^line-through$/i?"SE":"WB"; |
635 |
|
|
if(!$opt_x && defined $opt_x) { |
636 |
|
|
$dupl="[{false statusdict/setduplexmode get exec} stopped cleartomark"; |
637 |
|
|
} |
638 |
|
|
if($opt_x) { |
639 |
|
|
$dupl="[{true statusdict/setduplexmode get exec} stopped cleartomark"; |
640 |
|
|
} |
641 |
|
|
if($opt_x==2) { |
642 |
|
|
$dupl.="\n[{true statusdict/settumble get exec} stopped cleartomark"; |
643 |
|
|
} |
644 |
|
|
|
645 |
|
|
%head=("html",1, "head",1, "title",1, "base",1, "meta",1, "link",1, "style",1, |
646 |
|
|
"script",1, "isindex",1); |
647 |
|
|
%algn=("left",1, "center",2, "right",3, "justify",4, "char",5); |
648 |
|
|
%f=("void",1, "above",2, "below",3, "hsides",4, "lhs",5, "rhs",6, "vsides",7, |
649 |
|
|
"box",8, "border",9); |
650 |
|
|
%r=("none",1, "groups",2, "rows",3, "cols",4, "all",5); |
651 |
|
|
%v=("top",1, "middle",2, "bottom",3, "baseline",4); |
652 |
|
|
%it=("radio",0, "checkbox",1, "text",2, "password",2, "image",3); |
653 |
|
|
%ssy=(200,"\\", 201, "(", 202, ")"); |
654 |
|
|
%lity=("I",0, "i",1, "A",2, "a",3, "1",4, "disc",5, "square",6, "circle",7); |
655 |
|
|
$ltr=join('|',keys %lity); |
656 |
|
|
%tex=('`a',"\340", '\^a',"\342", '`e',"\350", '`e',"\350", 'c\{c\}',"\347", |
657 |
|
|
"'e","\351", '\^e',"\352", '"e',"\353", '\^i',"\356", '"i',"\357", |
658 |
|
|
'\^o',"\364", '`u',"\371", '\^u',"\373", '"u',"\374", '"y',"\377", |
659 |
|
|
'aa',"\345", '"a',"\344", '"o',"\366", 'ae',"\346", 'oe',"\225"); |
660 |
|
|
@hind=(0,0,0,0,0,0); |
661 |
|
|
$ltrs='A-Za-z\222-\226\300-\377'; |
662 |
|
|
%ent=( |
663 |
|
|
"lsquo|#8216",96, |
664 |
|
|
"rsquo|#8217",39, |
665 |
|
|
"circ|#710",141, |
666 |
|
|
"tilde|#732",142, |
667 |
|
|
"permil|#8240",143, |
668 |
|
|
"dagger|#8224",144, |
669 |
|
|
"Dagger|#8225",145, |
670 |
|
|
"Yuml|#376",146, |
671 |
|
|
"scaron|#353",147, |
672 |
|
|
"Scaron|#352",148, |
673 |
|
|
"oelig|#339",149, |
674 |
|
|
"OElig|#338",150, |
675 |
|
|
"lsaquo|#8249",151, |
676 |
|
|
"rsaquo|#8250",152, |
677 |
|
|
"sbquo|#8218",153, |
678 |
|
|
"bdquo|#8222",154, |
679 |
|
|
"ldquo|#8220",155, |
680 |
|
|
"rdquo|#8221",156, |
681 |
|
|
"ndash|#8211",157, |
682 |
|
|
"mdash|#8212",158, |
683 |
|
|
"trade|#8482",159, |
684 |
|
|
"nbsp",160, |
685 |
|
|
"iexcl",161, |
686 |
|
|
"cent",162, |
687 |
|
|
"pound",163, |
688 |
|
|
"curren",164, |
689 |
|
|
"yen",165, |
690 |
|
|
"brvbar",166, |
691 |
|
|
"sect",167, |
692 |
|
|
"uml",168, |
693 |
|
|
"copy",169, |
694 |
|
|
"ordf",170, |
695 |
|
|
"laquo",171, |
696 |
|
|
"not",172, |
697 |
|
|
"reg",174, |
698 |
|
|
"macr",175, |
699 |
|
|
"deg",176, |
700 |
|
|
"plusmn",177, |
701 |
|
|
"sup2",178, |
702 |
|
|
"sup3",179, |
703 |
|
|
"acute",180, |
704 |
|
|
"micro",181, |
705 |
|
|
"para",182, |
706 |
|
|
"middot",183, |
707 |
|
|
"cedil",184, |
708 |
|
|
"sup1",185, |
709 |
|
|
"ordm",186, |
710 |
|
|
"raquo",187, |
711 |
|
|
"frac14",188, |
712 |
|
|
"frac12",189, |
713 |
|
|
"frac34",190, |
714 |
|
|
"iquest",191, |
715 |
|
|
"Agrave",192, |
716 |
|
|
"Aacute",193, |
717 |
|
|
"Acirc",194, |
718 |
|
|
"Atilde",195, |
719 |
|
|
"Auml",196, |
720 |
|
|
"Aring",197, |
721 |
|
|
"AElig",198, |
722 |
|
|
"Ccedil",199, |
723 |
|
|
"Egrave",200, |
724 |
|
|
"Eacute",201, |
725 |
|
|
"Ecirc",202, |
726 |
|
|
"Euml",203, |
727 |
|
|
"Igrave",204, |
728 |
|
|
"Iacute",205, |
729 |
|
|
"Icirc",206, |
730 |
|
|
"Iuml",207, |
731 |
|
|
"ETH",208, |
732 |
|
|
"Ntilde",209, |
733 |
|
|
"Ograve",210, |
734 |
|
|
"Oacute",211, |
735 |
|
|
"Ocirc",212, |
736 |
|
|
"Otilde",213, |
737 |
|
|
"Ouml",214, |
738 |
|
|
"times",215, |
739 |
|
|
"Oslash",216, |
740 |
|
|
"Ugrave",217, |
741 |
|
|
"Uacute",218, |
742 |
|
|
"Ucirc",219, |
743 |
|
|
"Uuml",220, |
744 |
|
|
"Yacute",221, |
745 |
|
|
"THORN",222, |
746 |
|
|
"szlig",223, |
747 |
|
|
"agrave",224, |
748 |
|
|
"aacute",225, |
749 |
|
|
"acirc",226, |
750 |
|
|
"atilde",227, |
751 |
|
|
"auml",228, |
752 |
|
|
"aring",229, |
753 |
|
|
"aelig",230, |
754 |
|
|
"ccedil",231, |
755 |
|
|
"egrave",232, |
756 |
|
|
"eacute",233, |
757 |
|
|
"ecirc",234, |
758 |
|
|
"euml",235, |
759 |
|
|
"igrave",236, |
760 |
|
|
"iacute",237, |
761 |
|
|
"icirc",238, |
762 |
|
|
"iuml",239, |
763 |
|
|
"eth",240, |
764 |
|
|
"ntilde",241, |
765 |
|
|
"ograve",242, |
766 |
|
|
"oacute",243, |
767 |
|
|
"ocirc",244, |
768 |
|
|
"otilde",245, |
769 |
|
|
"ouml",246, |
770 |
|
|
"divide",247, |
771 |
|
|
"oslash",248, |
772 |
|
|
"ugrave",249, |
773 |
|
|
"uacute",250, |
774 |
|
|
"ucirc",251, |
775 |
|
|
"uuml",252, |
776 |
|
|
"yacute",253, |
777 |
|
|
"thorn",254, |
778 |
|
|
"yuml",255); |
779 |
|
|
%symb=( |
780 |
|
|
"alpha|#945",141, |
781 |
|
|
"beta|#946",142, |
782 |
|
|
"gamma|#947",147, |
783 |
|
|
"delta|#948",144, |
784 |
|
|
"epsilon|#949",145, |
785 |
|
|
"zeta|#950",172, |
786 |
|
|
"eta|#951",150, |
787 |
|
|
"theta|#952",161, |
788 |
|
|
"thetasym|#977",112, |
789 |
|
|
"iota|#953",151, |
790 |
|
|
"kappa|#954",153, |
791 |
|
|
"lambda|#955",154, |
792 |
|
|
"mu|#956",155, |
793 |
|
|
"nu|#957",156, |
794 |
|
|
"xi|#958",170, |
795 |
|
|
"pi|#960",160, |
796 |
|
|
"piv|#982",166, |
797 |
|
|
"omicron|#959",157, |
798 |
|
|
"rho|#961",162, |
799 |
|
|
"sigma|#963",163, |
800 |
|
|
"sigmaf|#962",126, |
801 |
|
|
"tau|#964",164, |
802 |
|
|
"upsilon|#965",165, |
803 |
|
|
"upsih|#978",241, |
804 |
|
|
"phi|#966",146, |
805 |
|
|
"phiv",152, |
806 |
|
|
"chi|#967",143, |
807 |
|
|
"psi|#968",171, |
808 |
|
|
"omega|#969",167, |
809 |
|
|
"Alpha|#913",101, |
810 |
|
|
"Beta|#914",102, |
811 |
|
|
"Gamma|#915",107, |
812 |
|
|
"Delta|#916",104, |
813 |
|
|
"Epsilon|#917",105, |
814 |
|
|
"Zeta|#918",132, |
815 |
|
|
"Eta|#919",110, |
816 |
|
|
"Theta|#920",121, |
817 |
|
|
"Iota|#921",111, |
818 |
|
|
"Kappa|#922",113, |
819 |
|
|
"Lambda|#923",114, |
820 |
|
|
"Mu|#924",115, |
821 |
|
|
"Nu|#925",116, |
822 |
|
|
"Xi|#926",130, |
823 |
|
|
"Omicron|#927",117, |
824 |
|
|
"Pi|#928",120, |
825 |
|
|
"Rho|#929",122, |
826 |
|
|
"Sigma|#931",123, |
827 |
|
|
"Tau|#932",124, |
828 |
|
|
"Upsilon|#933",125, |
829 |
|
|
"Phi|#934",106, |
830 |
|
|
"Chi|#935",103, |
831 |
|
|
"Psi|#936",131, |
832 |
|
|
"Omega|#937",127, |
833 |
|
|
"fnof|#402",246, |
834 |
|
|
"perp|#8869",136, |
835 |
|
|
"plusmn|#177",261, |
836 |
|
|
"cdot|#183",327, |
837 |
|
|
"or|#8744",332, |
838 |
|
|
"and|#8743",331, |
839 |
|
|
"le|#8804",243, |
840 |
|
|
"ge|#8805",263, |
841 |
|
|
"equiv|#8801",272, |
842 |
|
|
"cong|#8773",100, |
843 |
|
|
"asymp|#8776",273, |
844 |
|
|
"ne|#8800",271, |
845 |
|
|
"sub|#8834",314, |
846 |
|
|
"sube|#8838",315, |
847 |
|
|
"sup|#8835",311, |
848 |
|
|
"supe|#8839",312, |
849 |
|
|
"isin|#8712",316, |
850 |
|
|
"larr|#8592",254, |
851 |
|
|
"rarr|#8594",256, |
852 |
|
|
"uarr|#8593",255, |
853 |
|
|
"darr|#8595",257, |
854 |
|
|
"harr|#8596",253, |
855 |
|
|
"lArr|#8656",334, |
856 |
|
|
"rArr|#8658",336, |
857 |
|
|
"uArr|#8657",335, |
858 |
|
|
"dArr|#8659",337, |
859 |
|
|
"hArr|#8660",333, |
860 |
|
|
"forall|#8704","042", |
861 |
|
|
"exist|#8707","044", |
862 |
|
|
"infin|#8734",245, |
863 |
|
|
"nabla|#8711",321, |
864 |
|
|
"part|#8706",266, |
865 |
|
|
"hellip|#8230",274, |
866 |
|
|
"int|#8747",362, |
867 |
|
|
"sum|#8721",345, |
868 |
|
|
"prod|#8719",325, |
869 |
|
|
"real|#8476",302, |
870 |
|
|
"image|#8465",301, |
871 |
|
|
"bull|#8226",267, |
872 |
|
|
"prime|#8242",242, |
873 |
|
|
"Prime|#8243",262, |
874 |
|
|
"oline|#8254",140, |
875 |
|
|
"frasl|#8260",244, |
876 |
|
|
"weierp|#8472",303, |
877 |
|
|
"alefsym|#8501",300, |
878 |
|
|
"crarr|#8629",277, |
879 |
|
|
"empty|#8709",306, |
880 |
|
|
"notin|#8713",317, |
881 |
|
|
"ni|#8715","047", |
882 |
|
|
"minus|#8722","055", |
883 |
|
|
"lowast|#8727","052", |
884 |
|
|
"radic|#8730",326, |
885 |
|
|
"prop|#8733",265, |
886 |
|
|
"ang|#8736",320, |
887 |
|
|
"cap|#8745",307, |
888 |
|
|
"cup|#8746",310, |
889 |
|
|
"sim|#8764",176, |
890 |
|
|
"nsub|#8836",313, |
891 |
|
|
"oplus|#8853",305, |
892 |
|
|
"otimes|#8855",304, |
893 |
|
|
"sdot|#8901",327, |
894 |
|
|
"lceil|#8968",351, |
895 |
|
|
"rceil|#8969",371, |
896 |
|
|
"lfloor|#8970",353, |
897 |
|
|
"rfloor|#8971",373, |
898 |
|
|
"lang|#9001",341, |
899 |
|
|
"rang|#9002",361, |
900 |
|
|
"spades|#9824",252, |
901 |
|
|
"clubs|#9827",247, |
902 |
|
|
"hearts|#9829",251, |
903 |
|
|
"diams|#9830",250, |
904 |
|
|
"loz|#9674",340); |
905 |
|
|
|
906 |
|
|
$pc=')WB NL NP('; |
907 |
|
|
$nimg=-1; |
908 |
|
|
$nm=-1; |
909 |
|
|
&Subst($doc_sep); |
910 |
|
|
&Subst($toc{'heading'}); |
911 |
|
|
$toc{'heading'}=~s/ H\(/ -1 H(/g; |
912 |
|
|
@font=(); |
913 |
|
|
@size=(); |
914 |
|
|
@styl=(); |
915 |
|
|
@alig=(); |
916 |
|
|
@colr=(); |
917 |
|
|
@topm=(); |
918 |
|
|
@botm=(); |
919 |
|
|
@lftm=(); |
920 |
|
|
@rgtm=(); |
921 |
|
|
@z1=(); |
922 |
|
|
@z2=(); |
923 |
|
|
@z3=(); |
924 |
|
|
$nfont=0; |
925 |
|
|
$mi=0; |
926 |
|
|
for (@fo) {&setel($_)}; |
927 |
|
|
%arr=%draft; |
928 |
|
|
&fs("draft"); |
929 |
|
|
|
930 |
|
|
if(!$latin1 && !defined $fontid{"times"}) { |
931 |
|
|
$fontid{"times"}=$nfont++; |
932 |
|
|
@docfonts=(@docfonts,split(/\s+/,$font_names{"times"})); |
933 |
|
|
} |
934 |
|
|
$wind=0; |
935 |
|
|
$wf="t"; |
936 |
|
|
if(!$latin1) { |
937 |
|
|
$wind=$fontid{"times"}; |
938 |
|
|
$wf="f"; |
939 |
|
|
} |
940 |
|
|
|
941 |
|
|
for $k (keys %font_files){ |
942 |
|
|
@ff=split(/\s+/,$font_files{$k}); |
943 |
|
|
@fn=split(/\s+/,$font_names{$k}); |
944 |
|
|
for (0..3) { |
945 |
|
|
if($ff[$_]) { |
946 |
|
|
$ff{$fn[$_]}=$ff[$_]; |
947 |
|
|
} elsif(!$ff{$fn[$_]}) { |
948 |
|
|
$ff{$fn[$_]}=$ff[0]; |
949 |
|
|
} |
950 |
|
|
$fr{$fn[$_]}=$k; |
951 |
|
|
} |
952 |
|
|
} |
953 |
|
|
$pta=defined $p{"text-align"}?$p{"text-align"}:$body{"text-align"}; |
954 |
|
|
$pal=0; |
955 |
|
|
$pal=1 if($pta=~/^c/i); |
956 |
|
|
$pal=2 if($pta=~/^r/i); |
957 |
|
|
$pal=3 if($pta=~/^j/i); |
958 |
|
|
$bgcol=&col2rgb($body{"background"}); |
959 |
|
|
if(!$bgcol) {$bgcol="[16#FF 16#FF 16#FF]"}; |
960 |
|
|
if(!$p{"color"}) {$p{"color"}="black"}; |
961 |
|
|
$tcol=&col2rgb($p{"color"}); |
962 |
|
|
$lcol=&col2rgb($a__link{"color"}); |
963 |
|
|
if($lcol) { |
964 |
|
|
$Lc="/Lc t D\n/Dl $lcol D\n"; |
965 |
|
|
$Lc.=$tcol ne $lcol?"/LX t D":"/LX f D"; |
966 |
|
|
} else { |
967 |
|
|
$Lc="/Lc f D\n/LX f D"; |
968 |
|
|
} |
969 |
|
|
$pcol=&col2rgb($pre{"color"}); |
970 |
|
|
if(!$pcol) {$pcol="[0 0 0]"}; |
971 |
|
|
$deftbg=&col2rgb($table{"background"}); |
972 |
|
|
$hc=&col2rgb($hr{"color"}); |
973 |
|
|
if(!$hc) {$hc="[0 0 0]"}; |
974 |
|
|
$fcol=&col2rgb($frame{"color"}); |
975 |
|
|
if(!$fcol) {$fcol="[0 0 0]"}; |
976 |
|
|
for ($p{"font-size"},$pre{"font-size"},$header{"font-size"},$frame{'width'}, |
977 |
|
|
$footer{"font-size"},$justify{'letter'},$justify{'word'}) { |
978 |
|
|
&getval($_,2); |
979 |
|
|
} |
980 |
|
|
for ($p{"line-height"},$p{"text-indent"},$p{"margin-top"},$toc{'indent'}, |
981 |
|
|
$ball_radius) { |
982 |
|
|
&getval($_,0); |
983 |
|
|
} |
984 |
|
|
$fl="/FL [/".join("\n/",@docfonts)."] D"; |
985 |
|
|
for $k (keys %ff) { |
986 |
|
|
$f=$ff{$k}; |
987 |
|
|
if(defined $fontid{$fr{$k}} && !defined($cont{$f})) { |
988 |
|
|
open(FONT,$f) || &dbg("Error opening fontfile $f\n"); |
989 |
|
|
($cont{$f}=<FONT>)=~s/(^|\r?\n|\r)%.*//g; |
990 |
|
|
close FONT; |
991 |
|
|
} |
992 |
|
|
} |
993 |
|
|
$fontdef=""; |
994 |
|
|
for (keys %cont) { |
995 |
|
|
$fontdef.=$cont{$_}; |
996 |
|
|
} |
997 |
|
|
&ent($yz); |
998 |
|
|
&ent($xref{'text'}); |
999 |
|
|
&ent($draft{'text'}); |
1000 |
|
|
|
1001 |
|
|
$lnum=0; |
1002 |
|
|
for (keys %quote_open) { |
1003 |
|
|
$lid{$_}=$lnum++; |
1004 |
|
|
if(!defined $quote_close{$_}) {$quote_close{$_}=$quote_open{$_}}; |
1005 |
|
|
if(!defined $quote_open2{$_}) {$quote_open2{$_}=$quote_open{$_}}; |
1006 |
|
|
if(!defined $quote_close2{$_}) {$quote_close2{$_}=$quote_close{$_}}; |
1007 |
|
|
&ent($quote_open{$_}); |
1008 |
|
|
&ent($quote_close{$_}); |
1009 |
|
|
&ent($quote_open2{$_}); |
1010 |
|
|
&ent($quote_close2{$_}); |
1011 |
|
|
push(@qo,$quote_open{$_}); |
1012 |
|
|
push(@qc,$quote_close{$_}); |
1013 |
|
|
push(@qo2,$quote_open2{$_}); |
1014 |
|
|
push(@qc2,$quote_close2{$_}); |
1015 |
|
|
} |
1016 |
|
|
$qo=join(')(',@qo); |
1017 |
|
|
$qc=join(')(',@qc); |
1018 |
|
|
$qo2=join(')(',@qo2); |
1019 |
|
|
$qc2=join(')(',@qc2); |
1020 |
|
|
$hyphenation_file{''}=$hyphenation_file{'en'}; |
1021 |
|
|
$br=$collapse_br?"f":"t"; |
1022 |
|
|
$gd=0; |
1023 |
|
|
$ddr=defined $draft{'print'}; |
1024 |
|
|
if($ddr) { |
1025 |
|
|
if($draft{'print'}==0) { |
1026 |
|
|
$draft="f"; |
1027 |
|
|
} else { |
1028 |
|
|
$gd=1; |
1029 |
|
|
$draft="t"; |
1030 |
|
|
} |
1031 |
|
|
} |
1032 |
|
|
$gb=$gs_bug?"t":"f"; |
1033 |
|
|
for (keys %quote) {$lid{$_}=$lid{$quote{$_}}}; |
1034 |
|
|
$ENV{'PATH'}.=":$package{'path'}" if($package{'path'}); |
1035 |
|
|
$delim="%-- End of variable part --"; |
1036 |
|
|
$cd="/Cd {aload length 2 idiv dup dict begin {D} repeat currentdict end} D"; |
1037 |
|
|
$P0=<<EOC; |
1038 |
|
|
%%Creator: $version |
1039 |
|
|
%%EndComments |
1040 |
|
|
save |
1041 |
|
|
2000 dict begin |
1042 |
|
|
/d {bind def} bind def |
1043 |
|
|
/D {def} d |
1044 |
|
|
/t true D |
1045 |
|
|
/f false D |
1046 |
|
|
$fl |
1047 |
|
|
/WF $wf D |
1048 |
|
|
/WI $wind D |
1049 |
|
|
/F $opt_s D |
1050 |
|
|
/IW $w F div D |
1051 |
|
|
/IL $l F div D |
1052 |
|
|
/PS $pag D |
1053 |
|
|
/EF [@font] D |
1054 |
|
|
/EZ [@size] D |
1055 |
|
|
/Ey [@styl] D |
1056 |
|
|
/EG [@alig] D |
1057 |
|
|
/Tm [@topm] D |
1058 |
|
|
/Bm [@botm] D |
1059 |
|
|
/Lm [@lftm] D |
1060 |
|
|
/Rm [@rgtm] D |
1061 |
|
|
/EU [@colr] D |
1062 |
|
|
/NO $number D |
1063 |
|
|
$yz |
1064 |
|
|
/Ts EZ 0 get D |
1065 |
|
|
/TU $twoup D |
1066 |
|
|
/Xp $xp D |
1067 |
|
|
/AU $ulanch D |
1068 |
|
|
/SN $opt_N D |
1069 |
|
|
/Cf $cf D |
1070 |
|
|
/Fe $fe D |
1071 |
|
|
/TI $toc{'indent'} Ts mul D |
1072 |
|
|
/FE {newpath -$d $d M CP BB $xr $d L $xr $yb L CP BB -$d $yb L closepath} D |
1073 |
|
|
/LA {TU PM 0 eq and{IW $mm F div add SA{Sf div}if 0 translate} |
1074 |
|
|
{$xc $yc translate$rot F SA{Sf mul}if dup scale |
1075 |
|
|
CS CF FS Cf{CA CL get VC}if /Bb f D}ie 0 0 M TF not Tc or |
1076 |
|
|
{Cf{gsave SA{1 Sf div dup scale}if Cb VC FE fill grestore}if Df{Sd}if}if} D |
1077 |
|
|
/Pi $p{"text-indent"} Ts mul D |
1078 |
|
|
/SG [$is $opt_i $msc] D |
1079 |
|
|
/Ab $justify{'word'} D |
1080 |
|
|
/J $justify{'letter'} D |
1081 |
|
|
/Tc $tc D |
1082 |
|
|
/NH $toc{'level'} D |
1083 |
|
|
/Nf $nh D |
1084 |
|
|
/Pa $pa D |
1085 |
|
|
/LH $p{"line-height"} D |
1086 |
|
|
/XR $xref D |
1087 |
|
|
/Xr {/pN E D ( $xref{'text'} )WB} D |
1088 |
|
|
/Db $bgcol D |
1089 |
|
|
/Dt $tcol D |
1090 |
|
|
/eA $ea D |
1091 |
|
|
$Lc |
1092 |
|
|
/Br $ball_radius D |
1093 |
|
|
/IA ($imgalt) D |
1094 |
|
|
/DS {/PF f D($doc_sep)pop RC ZF} D |
1095 |
|
|
/Gb $gb D |
1096 |
|
|
/Mb $br D |
1097 |
|
|
/Hc $hc D |
1098 |
|
|
/Bl 3 D |
1099 |
|
|
/MI -$mi D |
1100 |
|
|
/DX ($draft{'text'}) D |
1101 |
|
|
/Di $draft{'dir'} D |
1102 |
|
|
/FD $fontid{"\L$font"} D |
1103 |
|
|
/Dy $styl D |
1104 |
|
|
/cD $col D |
1105 |
|
|
/FW $frame{'width'} D |
1106 |
|
|
/FU $fcol D |
1107 |
|
|
/ET {/RM $rm D /A0 $pal D /PN SN D /OU t D /Ou t D /W IW D /LL W D D1 |
1108 |
|
|
Ms not TP and{Ip}if /TF f D} D |
1109 |
|
|
$dupl |
1110 |
|
|
$delim |
1111 |
|
|
EOC |
1112 |
|
|
|
1113 |
|
|
$reenc=<<EOD; |
1114 |
|
|
WF{FL{reencodeISO D}forall}{4 1 FL length 1 sub{FL E get reencodeISO D}for}ie |
1115 |
|
|
/Symbol dup dup findfont dup length dict begin |
1116 |
|
|
{1 index /FID ne{D}{pop pop}ie}forall /Encoding [Encoding aload pop] |
1117 |
|
|
dup 128 /therefore put D currentdict end definefont D |
1118 |
|
|
EOD |
1119 |
|
|
$defs=<<EOD; |
1120 |
|
|
/reencodeISO { |
1121 |
|
|
dup dup findfont dup length dict begin{1 index /FID ne{D}{pop pop}ie}forall |
1122 |
|
|
/Encoding ISOLatin1Encoding D currentdict end definefont} D |
1123 |
|
|
/ISOLatin1Encoding [ |
1124 |
|
|
/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef |
1125 |
|
|
/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef |
1126 |
|
|
/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef |
1127 |
|
|
/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef |
1128 |
|
|
/space/exclam/quotedbl/numbersign/dollar/percent/ampersand/quoteright |
1129 |
|
|
/parenleft/parenright/asterisk/plus/comma/hyphen/period/slash |
1130 |
|
|
/zero/one/two/three/four/five/six/seven/eight/nine/colon/semicolon |
1131 |
|
|
/less/equal/greater/question/at/A/B/C/D/E/F/G/H/I/J/K/L/M/N |
1132 |
|
|
/O/P/Q/R/S/T/U/V/W/X/Y/Z/bracketleft/backslash/bracketright |
1133 |
|
|
/asciicircum/underscore/quoteleft/a/b/c/d/e/f/g/h/i/j/k/l/m |
1134 |
|
|
/n/o/p/q/r/s/t/u/v/w/x/y/z/braceleft/bar/braceright/asciitilde |
1135 |
|
|
/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef |
1136 |
|
|
/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef |
1137 |
|
|
/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef |
1138 |
|
|
/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef |
1139 |
|
|
/.notdef/space/exclamdown/cent/sterling/currency/yen/brokenbar |
1140 |
|
|
/section/dieresis/copyright/ordfeminine/guillemotleft/logicalnot |
1141 |
|
|
/hyphen/registered/macron/degree/plusminus/twosuperior/threesuperior |
1142 |
|
|
/acute/mu/paragraph/periodcentered/cedilla/onesuperior/ordmasculine |
1143 |
|
|
/guillemotright/onequarter/onehalf/threequarters/questiondown |
1144 |
|
|
/Agrave/Aacute/Acircumflex/Atilde/Adieresis/Aring/AE/Ccedilla |
1145 |
|
|
/Egrave/Eacute/Ecircumflex/Edieresis/Igrave/Iacute/Icircumflex |
1146 |
|
|
/Idieresis/Eth/Ntilde/Ograve/Oacute/Ocircumflex/Otilde/Odieresis |
1147 |
|
|
/multiply/Oslash/Ugrave/Uacute/Ucircumflex/Udieresis/Yacute |
1148 |
|
|
/Thorn/germandbls/agrave/aacute/acircumflex/atilde/adieresis |
1149 |
|
|
/aring/ae/ccedilla/egrave/eacute/ecircumflex/edieresis/igrave |
1150 |
|
|
/iacute/icircumflex/idieresis/eth/ntilde/ograve/oacute/ocircumflex |
1151 |
|
|
/otilde/odieresis/divide/oslash/ugrave/uacute/ucircumflex/udieresis |
1152 |
|
|
/yacute/thorn/ydieresis |
1153 |
|
|
] D |
1154 |
|
|
[128/backslash 129/parenleft 130/parenright 141/circumflex 142/tilde |
1155 |
|
|
143/perthousand 144/dagger 145/daggerdbl 146/Ydieresis 147/scaron 148/Scaron |
1156 |
|
|
149/oe 150/OE 151/guilsinglleft 152/guilsinglright 153/quotesinglbase |
1157 |
|
|
154/quotedblbase 155/quotedblleft 156/quotedblright 157/endash 158/emdash |
1158 |
|
|
159/trademark] |
1159 |
|
|
aload length 2 idiv 1 1 3 -1 roll{pop ISOLatin1Encoding 3 1 roll put}for |
1160 |
|
|
/colorimage where{pop}{ |
1161 |
|
|
/colorimage { |
1162 |
|
|
pop pop /Pr E D {/Cv Pr D /Gr Cv length 3 idiv string D 0 1 Gr length 1 sub |
1163 |
|
|
{Gr E dup /i E 3 mul D Cv i get 0.299 mul Cv i 1 add get 0.587 mul add |
1164 |
|
|
Cv i 2 add get 0.114 mul add cvi put}for Gr} image} D |
1165 |
|
|
}ie |
1166 |
|
|
/pdfmark where{pop}{userdict /pdfmark /cleartomark load put}ie |
1167 |
|
|
EOD |
1168 |
|
|
|
1169 |
|
|
$P1=<<EOT; |
1170 |
|
|
$cd |
1171 |
|
|
/EX {EC cvx exec} D |
1172 |
|
|
/DU {} d |
1173 |
|
|
/BB {pop pop}d |
1174 |
|
|
/ie {ifelse} d |
1175 |
|
|
/E {exch} d |
1176 |
|
|
/M {moveto} d |
1177 |
|
|
/R {rmoveto} d |
1178 |
|
|
/L {lineto} d |
1179 |
|
|
/RL {rlineto} d |
1180 |
|
|
/CP {currentpoint} d |
1181 |
|
|
/SW {stringwidth} d |
1182 |
|
|
/GI {getinterval} d |
1183 |
|
|
/PI {putinterval} d |
1184 |
|
|
/Sg {setgray} d |
1185 |
|
|
/LW {setlinewidth} d |
1186 |
|
|
/S {dup () ne OU and{0 Co R AT 3 eq LB and HF not and A1 0 ne A2 0 ne or and |
1187 |
|
|
{A2 0 32 A1 0 6 -1 roll awidthshow}{show}ie 0 Co neg R}{pop}ie |
1188 |
|
|
OU PH 3 eq or{/Ms t D}if} D |
1189 |
|
|
/U {OU{gsave CP currentfont /FontInfo get /UnderlinePosition get |
1190 |
|
|
0 E currentfont /FontMatrix get dtransform E pop add newpath M dup SW pop |
1191 |
|
|
CJ 0 RL stroke grestore}if} D |
1192 |
|
|
/B {OU Br 0 gt and{CP Ts neg Ts .33 mul R gsave 0 Sg |
1193 |
|
|
CP newpath Ts Br mul 0 360 arc closepath UI 2 mod 0 eq{stroke}{fill}ie |
1194 |
|
|
grestore M CP E Ts Br 1 add mul sub E BB /Ms t D}if}D |
1195 |
|
|
/NP {Ms TP not or PA and OU and{TP{OR}if f1{mF k2 /mF E D /YC 0 D}if |
1196 |
|
|
TP TU not PM 0 eq or and{showpage}if DU Ip TE not{LA}if 0.6 LW |
1197 |
|
|
/CI 0 D /TP t D /Hs f D /hl 6 D /hL 6 D /HI hi D /Ms f D}if Bs XO BO M} D |
1198 |
|
|
/Np {LE sub CP E pop gt PL 0 eq and{NP}if}D |
1199 |
|
|
/Ip {/PN PN 1 add D /Pn RM{1}{4}ie PN Ns D /PM PN SN sub 2 mod D} D |
1200 |
|
|
/GP {E dup 3 -1 roll get PN 1 add 2 mod get dup type /integertype eq |
1201 |
|
|
{get 0 get}{E pop}ie}d |
1202 |
|
|
/Fc {dup 2 GP exec SW pop /S1 E D dup 1 GP exec SW pop /S2 E D 0 GP exec SW |
1203 |
|
|
pop /S3 E D S1 0 gt{S2 2 mul S1 add S3 2 mul S1 add 2 copy lt{E}if pop}{0}ie |
1204 |
|
|
S2 S3 add 2 copy lt{E}if pop IW .9 mul div dup 1 gt{1 E div}{pop 1}ie}D |
1205 |
|
|
/OR {gsave SA{1 Sf div dup scale}if Fe{Cf{FU VC}if FW LW 1 setlinejoin |
1206 |
|
|
FE stroke}if /YO {60 F div dup 40 gt{pop 40}if}D /cs CS D /cf CF D /CF 0 D |
1207 |
|
|
/pf PF D /PF f D /Fn FN D /At AT D /AT 0 D /FN EF Hf 1 add get D Fz Fs FS ZZ |
1208 |
|
|
Fc Fz mul Fs FS EU Hf 1 add get dup type /arraytype eq Cf and{VC}{pop 0 Sg}ie |
1209 |
|
|
IW IL neg YO sub M ZZ 1 GP exec dup SW pop neg 0 R Sh 0 IL neg YO sub M |
1210 |
|
|
ZZ 0 GP exec Sh ZZ 2 GP exec dup SW pop IW E sub 2 div IL neg YO sub M Sh |
1211 |
|
|
Fz Fs FS NO{/AW IW Pn SW pop sub D AW 2 div IL neg YO sub |
1212 |
|
|
S1 0 gt S2 AW .45 mul gt or S3 AW .45 mul gt or{Fz 2 mul sub}if M Pn Sh}if |
1213 |
|
|
EU Hf get dup type /arraytype eq Cf and{VC}{pop 0 Sg}ie |
1214 |
|
|
YY Fc /FN EF Hf get D Hz mul HS FS IW YO M YY 1 GP exec dup SW pop neg 0 R Sh |
1215 |
|
|
0 YO M YY 0 GP exec Sh YY 2 GP exec dup SW pop IW E sub 2 div YO M Sh |
1216 |
|
|
/FN Fn D /AT At D t Pb XO SZ SL get neg R /PF pf D grestore /CF 0 D cs cf FS}D |
1217 |
|
|
/Sh {dup () ne{CP Hz 4 div sub BB show CP CS add BB}{pop}ie}D |
1218 |
|
|
/Pb {/OU E D /Ou OU D /PB t D 0 0 M Ba{/Sa save D /BP t D /Fl t D RC /PL 0 D |
1219 |
|
|
/PH 0 D /W IW D /LE IL .7 mul D /EO 0 D SI ZF /YA 0 D /BO 0 D /C1 () D |
1220 |
|
|
BA 0 Ts neg R Bb{Xl Yl Xh Yh}if Bb CP Sa restore M |
1221 |
|
|
{/Yh E D /Xh E D /Yl E D /Xl E D}if /Fl t D}if |
1222 |
|
|
BL /OU t D /HM f D /Ou t D /PB f D} D |
1223 |
|
|
/Bs {/BP Ba not D}D |
1224 |
|
|
$defs$fontdef$reenc |
1225 |
|
|
/SF {/CS E D SZ SL CS put FO SL FN put /YI CS LH neg mul D dup ST cvs ( ) join |
1226 |
|
|
CS ST cvs join C1 E join ( NF ) join /C1 E D CS NF /Wf WF FN 0 gt or D |
1227 |
|
|
/BW Wf{( ) SW pop}{0}ie D}D |
1228 |
|
|
/NF {/cS E D /cF E D cF 0 ge{FL cF get}{/Symbol}ie |
1229 |
|
|
findfont cS scalefont setfont} D |
1230 |
|
|
/FS {CF or /CF E D FR SL CF put CF CF 0 ge{FN 4 mul add}if E SF} D |
1231 |
|
|
/PC {SH /BP f D fin not GL not and{NL}if /HM t D /LL LS D} D |
1232 |
|
|
/BS {/TX E D Wf{/fin f D /CW 0 D /LK 0 D /SC 0 D |
1233 |
|
|
/RT TX D {RT ( ) search{/NW E D pop /RT E D /WH NW SW pop D CW WH add LL gt |
1234 |
|
|
{TX SC LK SC sub 1 sub NN GI GL{SH cF cS OC |
1235 |
|
|
2 copy cS ne E cF ne or{NF}{pop pop}ie}{PC /CW WH BW add D}ie |
1236 |
|
|
/SC LK D} |
1237 |
|
|
{GL{JC}if |
1238 |
|
|
/CW CW WH add BW add D /HM t D}ie /GL f D /Ph f D |
1239 |
|
|
/LK LK NW length 1 add add D}{pop exit}ie}loop |
1240 |
|
|
/fin t D TX SC LK SC sub GI SH RT () ne{GL not{CC}if}if |
1241 |
|
|
/LC TX length D /WH RT SW pop D CW WH add Hy{HC SW pop add}if LL gt |
1242 |
|
|
{RT GL{SH cF cS OC 2 copy cS ne E cF ne or{NF}{pop pop}ie |
1243 |
|
|
Hy{/Ph t D}if /LL LS D}{NL /LL LS D SH}ie} |
1244 |
|
|
{RT PC Hy{CC}if /Ph Ph Hy or D}ie RT () ne{/GL t D /HM t D}if} |
1245 |
|
|
{TX SW pop LL le{TX SH}{/NW () D 0 2 TX length 1 sub |
1246 |
|
|
{/CW E D TX 0 CW GI dup SW pop LL gt{pop NW SH /HM t D NL/LL W XO sub MR sub D |
1247 |
|
|
/CW CW 2 sub NN D /TX TX CW TX length CW sub GI D TX BS exit} |
1248 |
|
|
{/NW E D}ie}for}ie}ie /HM t D}D |
1249 |
|
|
/CC {C0 length 0 gt{JC}if /C0 [C1 L1 YA YB Mf NS NB TB AF Bw] D |
1250 |
|
|
/C1 () D /L0 L1 D /YA 0 D /YB 0 D /Mf 0 D /NS 0 D /NB 0 D}D |
1251 |
|
|
/JC {C0 aload length 0 gt{pop pop pop NB add /NB E D NS add /NS E D |
1252 |
|
|
dup Mf gt{/Mf E D}{pop}ie dup YB gt{/YB E D}{pop}ie |
1253 |
|
|
dup YA gt{/YA E D}{pop}ie pop C1 join /C1 E D /C0 [] D}if}D |
1254 |
|
|
/OC {C0 length 0 gt{C1 L1 L0 sub YA YB Mf NS NB TB AF Bw GL C0 aload pop |
1255 |
|
|
/Bw E D /AF E D /TB E D /NB E D /NS E D /Mf E D /YB E D /YA E D /C0 [] D |
1256 |
|
|
/L1 E D /C1 E D Ph{HC SH}if NL /GL E D /Bw E D /AF E D /TB E D /NB E D /NS E D |
1257 |
|
|
/Mf E D /YB E D /YA E D /L1 E D /LL W L1 sub XO sub MR sub WH sub D /CW 0 D |
1258 |
|
|
C1 E join /C1 E D}if}D |
1259 |
|
|
/BT {/LB t D dup length string copy RS dup dup () ne E ( ) ne and |
1260 |
|
|
{/CI 0 D /LS LL D /LL W L1 sub XO sub MR sub D BS} |
1261 |
|
|
{dup ( ) eq{/GL f D}if dup () eq L1 0 eq or{pop}{SH /BP f D /Ph f D}ie}ie |
1262 |
|
|
/LB f D} D |
1263 |
|
|
/BL {CP E pop XO E M} D |
1264 |
|
|
/NL {JC /GL f D /SK W XO sub MR sub L1 sub TB{Bw add}if D |
1265 |
|
|
/YA LF{Mf HM Fl not and PF or{LH mul}if}{0 /LF t D}ie YA 2 copy lt{E}if pop D |
1266 |
|
|
C1 () ne{/FB YB Mf SA{Sf mul}if 4 div 2 copy lt{E}if pop D}if Fl{/Ya YA D}if |
1267 |
|
|
CP E pop YA sub YB sub LE neg lt Fl not and PB not and{NP}if NT TL BL |
1268 |
|
|
OU PF not and PB or{/RE L1 TB{Bw sub}if |
1269 |
|
|
W XO sub MR sub div YA YB add LE BO add div 2 copy lt{E}if pop D |
1270 |
|
|
RE 1 gt{BL 1 RE div dup scale}if}if |
1271 |
|
|
AT 2 le{SK AT mul 2 div YA neg R}if |
1272 |
|
|
AT 3 eq{0 YA neg R TB{/NB NB 1 sub D /NS NS 1 sub D}if /NB NB 1 sub NN D |
1273 |
|
|
/A3 NS 6 mul NB add D NS NB add 0 eq |
1274 |
|
|
{/A1 0 D /A2 0 D} |
1275 |
|
|
{NS 0 eq{/A1 SK NB div dup J gt{pop 0}if D /A2 0 D}{J A3 mul SK lt |
1276 |
|
|
{/A1 J D /A2 SK J NB mul sub NS div dup Ab gt{/A1 0 D pop 0}if D} |
1277 |
|
|
{/A1 SK A3 div D /A2 A1 6 mul D}ie}ie}ie /A1 A1 NN D /A2 A2 NN D}if |
1278 |
|
|
AT 4 eq{0 YA neg R PH 2 le{PD 0 lt{/PD L1 D}if PD M1 gt{/M1 PD D}if |
1279 |
|
|
L1 PD sub M2 gt{/M2 L1 PD sub D}if}{DV ID 1 sub get 0 ge{Lo 0 R}if}ie}if |
1280 |
|
|
F0 cF ne Cs cS ne or{F0 Cs NF}if |
1281 |
|
|
/ms Ms D /Ms f D CP FB sub |
1282 |
|
|
C1 cvx exec XO EO sub L1 add TB{BW sub}if dup LM gt{/LM E D}{pop}ie |
1283 |
|
|
PH 0 eq PH 4 eq or Ms and{HF not{/PO t D /AH t D}if |
1284 |
|
|
BB CP YA add E AT 3 eq LB and{A1 sub}if TB{BW sub}if E BB} |
1285 |
|
|
{pop pop}ie Ms HM PH 3 eq and or{/BP f D /Fl f D}if |
1286 |
|
|
/Lo 0 D /L1 0 D /F0 cF D /Cs cS D BP not{0 YB NN neg R}if |
1287 |
|
|
OU f1 and mF not and{k2 /f1 f D}if |
1288 |
|
|
OU PF not and PB or{RE 1 gt{RE dup scale}if}if /Ms ms Ms or D |
1289 |
|
|
/C1 AF{(Cp )}{()}ie D /YA 0 D /YB 0 D BL |
1290 |
|
|
AT 4 eq LB not and PH 3 ge and |
1291 |
|
|
{ID DV length lt{DV ID get dup 0 ge{DO E sub /Lo E D /L1 Lo D}{pop}ie |
1292 |
|
|
/ID ID 1 add D}if}if /T t D CD{/LN LN 1 add D PD}if |
1293 |
|
|
/PD -1 D /NS 0 D /NB 0 D /TB f D /Ph f D /Mf 0 D /HM f D} D |
1294 |
|
|
/RS {/TM E D /CN 0 D TM{10 eq{TM CN ( ) PI}if /CN CN 1 add D}forall |
1295 |
|
|
/CN 0 D /BK HM EN and{0}{1}ie D TM |
1296 |
|
|
{dup 32 ne{TM CN 3 2 roll put /CN CN 1 add D /BK 0 D} |
1297 |
|
|
{pop BK 0 eq{TM CN 32 put /CN CN 1 add D}if /BK 1 D}ie}forall |
1298 |
|
|
TM 0 CN GI dup dup () ne E ( ) ne and |
1299 |
|
|
{dup CN 1 sub get 32 eq{/EN f D}{/EN t D}ie}if} D |
1300 |
|
|
/join {2 copy length E length add string dup 4 2 roll 2 index 0 3 index |
1301 |
|
|
PI E length E PI}d |
1302 |
|
|
/WR {(\\n) search{dup () ne BP not or |
1303 |
|
|
{Li 4 le CP E pop YI Li mul add LE add 0 lt and PL 0 eq and{NP}if |
1304 |
|
|
SH NL pop /Li Li 1 sub D WR}{pop pop WR}ie}{SH}ie /CI 0 D /BP f D} D |
1305 |
|
|
/SH {dup dup () ne E ( ) ne and PF or CS Mf gt and{/Mf CS D}if |
1306 |
|
|
T not Wf and{( ) E join /T t D}if dup BP{/MF CS D}if |
1307 |
|
|
AT 3 eq{2 copy length dup 0 gt{/NB E NB add D |
1308 |
|
|
{( ) search{/NS NS 1 add D pop pop}{pop exit}ie}loop}{pop pop}ie}if |
1309 |
|
|
CD PD 0 lt and{dup DC search{SW pop /PD E L1 add D pop pop}{pop}ie}if |
1310 |
|
|
0 Np dup SW pop L1 add /L1 E D dup () ne |
1311 |
|
|
{C1 (\\() join E join (\\)) join AU AF and UF or Wf and{( U ) join}if |
1312 |
|
|
sF{( s ) join}if ( S ) join |
1313 |
|
|
/C1 E D dup length 1 sub get 32 eq /TB E D /Bw BW D}{pop pop}ie} D |
1314 |
|
|
/BG {AI LG BC add add 0 eq} D |
1315 |
|
|
/ON {OU{Ty AR AI NN get dup 1 add Ln Ns Ty 2 mod 0 eq{(. )}{(\\) )}ie join |
1316 |
|
|
dup SW pop neg 0 R CP E 0 lt{0 E M}{pop}ie CP BB show /Ms t D}if} D |
1317 |
|
|
/Ln {AR AI 3 -1 roll put}D |
1318 |
|
|
/SP {dup CI lt BP not and{dup CI sub 0 E R /CI E D}{pop}ie} D |
1319 |
|
|
/BN {PF{WR /HM f D}{BT NL}ie} D |
1320 |
|
|
/NN {dup 0 lt{pop 0}if} D |
1321 |
|
|
/h {HI 0 gt{(h) HI ST cvs join cvx exec dup 1 get E |
1322 |
|
|
Nf{0 get E join}{pop}ie}{()}ie} D |
1323 |
|
|
/H {/fn FN D /Hi E 1 add D 1 sub /HL E D /H2 HL 2 add D /GS EZ H2 get D |
1324 |
|
|
E Tm H2 get GS mul BE dup 0 gt{1 sub}{pop EG H2 get dup 0 lt{pop AT}if}ie NA |
1325 |
|
|
WW Np /SL SL 1 add D /FN EF H2 get D GS Ey H2 get FS |
1326 |
|
|
EU H2 get Sc Hs not HL Hl lt and Hs HL hl lt and or Hi 0 eq or |
1327 |
|
|
{/HI Hi D /Hs t D /hl HL D /hL HL D}if HL Hl lt{/hi Hi D}if |
1328 |
|
|
Nf HI 0 gt and{(h) Hi ST cvs join cvx exec 0 get WB}if |
1329 |
|
|
/HF t D /AH f D /PO f D} D |
1330 |
|
|
/EH {Bm H2 get GS mul BE OA /SL SL 1 sub NN D /CF 0 D /FN fn D |
1331 |
|
|
SZ SL get FR SL get FS /HF f D /GS Ts D ()Ec} D |
1332 |
|
|
/P {E PF{WR}{PO{EP}{BN}ie Ts 4 mul Np AE not{Tm 0 get Ts mul neg SP}if |
1333 |
|
|
dup 0 ge AH and{Pi Pd}if}ie 1 sub dup 0 lt{pop AV AL get}if /AT E D /PO t D} D |
1334 |
|
|
/EP {PF{WR}{BN Ts 4 mul Np}ie AE not{Bm 0 get Ts mul neg SP}if |
1335 |
|
|
/AT AV AL get D /PO f D} D |
1336 |
|
|
/BE {E PO{EP}{BN}ie Ts 4 mul Np neg SP} D |
1337 |
|
|
/HR {/Aw W EO sub D /RW E dup 0 gt{Aw mul}{neg}ie dup Aw gt{pop Aw}if D /RZ E D |
1338 |
|
|
E BN Ts neg SP 1 sub 2 div Aw RW sub mul EO add CP E pop M PF{0 Ps neg R}if |
1339 |
|
|
0 Np OU{gsave RZ LW Cf{Hc VC}{0 Sg}ie CP BB RW 0 RL CP BB stroke grestore}if |
1340 |
|
|
/CI 0 D /BP f D PF not{Ts neg SP}if /Ms t D} D |
1341 |
|
|
/AD {I NL EG 14 get dup 0 lt{pop AT}if NA /AE t D Tm 14 get Ts mul neg SP |
1342 |
|
|
Cf{EU 14 get dup -1 eq{pop CA CL get}if Sc}if} D |
1343 |
|
|
/DA {BN ()ES OA /AE f D ()Ec Bm 14 get Ts mul neg SP} D |
1344 |
|
|
/PR {/MW E D /Li E D Tm 1 get Ps mul BE 0 NA /FN Fp D /PF t D SI /SL SL 1 add D |
1345 |
|
|
/CF 0 D Ps CS mul Ts div MW WC mul CS mul Ts div dup LL gt PL 0 eq and |
1346 |
|
|
{LL div div}{pop}ie Ey 1 get FS CP E pop LE add YI neg div cvi dup Li lt |
1347 |
|
|
AH and{4 lt YI Li mul 5 mul LE add 0 gt or PL 0 eq and{NP}if}{pop}ie |
1348 |
|
|
EU 1 get Sc /GS Ps D}D |
1349 |
|
|
/RP {WR NL () /PF f D SI /FN 0 D ES Bm 1 get Ps mul neg SP OA /GS Ts D} D |
1350 |
|
|
/SI {/XO Lm 15 get BC NN mul Lm 16 get AI UI sub NN mul add |
1351 |
|
|
Lm 17 get UI NN mul add Lm 20 get LG NN mul add Ts mul |
1352 |
|
|
PF{Lm 1 get Ps mul add}if EO add D |
1353 |
|
|
/MR Rm 15 get BC NN mul Rm 16 get AI UI sub NN mul add |
1354 |
|
|
Rm 17 get UI NN mul add Rm 20 get LG NN mul add Ts mul |
1355 |
|
|
PF{Rm 1 get Ps mul add}if D /LL W XO sub MR sub D} D |
1356 |
|
|
/DT {BN /LG LG 1 sub D SI /LG LG 1 add D WW 2 div Np BL} D |
1357 |
|
|
/DD {WB Cc 0 eq L1 0 eq or Lm 20 get Ts mul L1 sub TB{BW add}if Ts 2 div lt or |
1358 |
|
|
NL /LF E D SI BL} D |
1359 |
|
|
/DL {Dc LG Cc put /Cc E D BG{Tm 18 get Ts mul BE}{BN}ie /LG LG 1 add D BL} D |
1360 |
|
|
/LD {BN LG 0 gt{/LG LG 1 sub D}if /Cc Dc LG get D SI |
1361 |
|
|
BG{()Bm 18 get Ts mul BE}if BL} D |
1362 |
|
|
/UL {BG{Tm 17 get Ts mul BE}{BN}ie NR AI NN 0 put /UI UI 1 add D |
1363 |
|
|
/AI AI 1 add D SI BL} D |
1364 |
|
|
/LU {BN /UI UI 1 sub D /AI AI 1 sub D SI BG{()Bm 17 get Ts mul BE}if BL} D |
1365 |
|
|
/OL {E BG{Tm 16 get Ts mul BE}{BN}ie TR AI NN Ty put /Ty E D NR AI NN 1 put |
1366 |
|
|
/AI AI 1 add D SI BL 1 Ln} D |
1367 |
|
|
/LO {BN /AI AI 1 sub D /Ty TR AI get D SI BG{()Bm 16 get Ts mul BE}if BL} D |
1368 |
|
|
/LI {E BN -1 SP /BP f D /CI 0 D 0 Np NR AI 1 sub NN get 1 eq |
1369 |
|
|
{dup dup 0 gt E 4 le and{/Ty E D}{pop}ie |
1370 |
|
|
/L1 L1 Ty AR AI NN get Ns SW pop XO sub dup 0 lt{pop 0}if add D ( ON )} |
1371 |
|
|
{pop ( B )}ie C1 E join /C1 E D CS Mf gt{/Mf CS D}if BL} D |
1372 |
|
|
/BQ {Tm 15 get Ts mul BE /BC BC 1 add D SI BL} D |
1373 |
|
|
/QB {Bm 15 get Ts mul BE /BC BC 1 sub D SI BL} D |
1374 |
|
|
/Al {E EP 1 sub dup 0 lt{pop AV AL get}if NA} D |
1375 |
|
|
/Ea {EP OA} D |
1376 |
|
|
/WB {PF{WR}{BT}ie} D |
1377 |
|
|
/F1 {WB /FN 0 D CS 0 FS} D |
1378 |
|
|
/F2 {WB /FN WI D CS 0 FS} D |
1379 |
|
|
/HY {/Hy t D WB /Hy f D} D |
1380 |
|
|
/YH {WB} D |
1381 |
|
|
/A {/LT E D LT 1 eq{/RN E D}if /Lh E D WB /AF t D /C1 C1 ( Cp ) join D |
1382 |
|
|
Lc{Cl Sc}if} D |
1383 |
|
|
/EA {Lc AF and{Ec}{WB}ie TL Pa AF and Lh 0 ne and |
1384 |
|
|
{( \\() Lh join (\\)) join /AF f D WB}if /AF f D} D |
1385 |
|
|
/TL {C1 ( Tl ) apa /C1 E D} d |
1386 |
|
|
/apa {AF OU and Lh 0 ne LT 1 eq or and{LT 1 eq{RN ( /) E ST cvs join} |
1387 |
|
|
{(\\() Lh join (\\)) join}ie E join join}{pop}ie} d |
1388 |
|
|
/Cp {/Xc CP /Yc E D D} D |
1389 |
|
|
/SS {Cf{dup 0 ge{EU E get dup -1 eq{pop CA CL get}if}{pop CA CL get}ie Sc} |
1390 |
|
|
{pop}ie SZ SL get /SL SL 1 add D} D |
1391 |
|
|
/I {WB 8 SS 1 FS} D |
1392 |
|
|
/EM {WB 8 SS /CF CF 1 xor D 0 FS} D |
1393 |
|
|
/BD {WB 9 SS 2 FS} D |
1394 |
|
|
/TT {WB 10 SS /FN Fp D 0 FS} D |
1395 |
|
|
/KB {WB 11 SS /FN Fp D 2 FS} D |
1396 |
|
|
/CT {WB 12 SS 1 FS} D |
1397 |
|
|
/SM {WB 13 SS /FN Fp D 0 FS} D |
1398 |
|
|
/Q {/QL QL 1 add D QO QL 2 mod get La get join WB} D |
1399 |
|
|
/EQ {QC QL 2 mod get La get join WB /QL QL 1 sub D} D |
1400 |
|
|
/RO {WB -1 SS /CF 0 D 0 FS} D |
1401 |
|
|
/SY {WB -1 SS -1 FS} D |
1402 |
|
|
/ES {WB /SL SL 1 sub NN D /CF 0 D /FN FO SL get D SZ SL get FR SL get FS ()Ec}D |
1403 |
|
|
/FZ {3 sub 1.2 E exp GS mul E WB TL /C1 C1 ( Cp ) join D /SL SL 1 add D 0 FS} D |
1404 |
|
|
/Ef {WB TL ()ES /C1 C1 ( Cp ) join D} D |
1405 |
|
|
/BZ {dup /Bf E D FZ}D |
1406 |
|
|
/Sc {dup -1 ne Cf and{/CL CL 1 add D dup 0 eq{pop [0 0 0]}if |
1407 |
|
|
dup CA E CL E put VS ( VC ) join C1 E join /C1 E D}{pop}ie} D |
1408 |
|
|
/Ec {WB Cf{/CL CL 1 sub NN D CA CL get VS ( VC ) join C1 E join /C1 E D}if} D |
1409 |
|
|
/VS {dup type /arraytype eq{([) E {ST cvs join ( ) join}forall (]) join}if} D |
1410 |
|
|
/VC {{255 div}forall setrgbcolor} D |
1411 |
|
|
/Sl {dup type /integertype ne{Ds}if /La E D WB}d |
1412 |
|
|
/UN {WB /UF t D} D |
1413 |
|
|
/NU {WB /UF f D} D |
1414 |
|
|
/SE {WB /sF t D} D |
1415 |
|
|
/XE {WB /sF f D} D |
1416 |
|
|
/sM {/C1 C1 ( k1 ) join D}d |
1417 |
|
|
/eM {/C1 C1 ( k2 ) join D}d |
1418 |
|
|
/k1 {/YC CP E pop Ts add D /mF t D /f1 t D}d |
1419 |
|
|
/k2 {gsave 3 LW -9 CP E pop Ts 0.2 mul sub M -9 YC L stroke grestore /mF f D}d |
1420 |
|
|
/Ac {/AC E D WB}d |
1421 |
|
|
/Ca {eA{( \\()join AC join(\\) )join}if WB}d |
1422 |
|
|
/s {OU{gsave 0 CS .25 mul R dup SW pop CJ 0 RL stroke grestore}if}D |
1423 |
|
|
/CJ {AT 3 eq LB and{E dup dup length 1 sub A1 mul E |
1424 |
|
|
{( ) search{pop pop E A2 add E}{pop exit}ie}loop 3 -1 roll add |
1425 |
|
|
W CP pop sub 2 copy gt{E}if pop}if}D |
1426 |
|
|
/So {/Co E D} D |
1427 |
|
|
/SO {C1 Yo ST cvs join ( So ) join /C1 E D (j) SW pop 2 div Pd} D |
1428 |
|
|
/Se {E WB CS E div Pd}D |
1429 |
|
|
/Pd {dup type /stringtype eq{SW pop}if dup /L1 E L1 add D |
1430 |
|
|
ST cvs ( 0 R ) join C1 E join /C1 E D} D |
1431 |
|
|
/Sp {0.35 CO} D |
1432 |
|
|
/Sb {-0.2 CO} D |
1433 |
|
|
/CO {OV Io Yo put /Yo E CS mul Yo add D /Io Io 1 add D -1.5 Io mul 3 add FZ SO |
1434 |
|
|
CS Yo add dup YA gt{/YA E D}{pop}ie |
1435 |
|
|
Yo neg dup YB gt{/YB E D}{pop}ie} D |
1436 |
|
|
/Es {ES /Io Io 1 sub NN D /Yo OV Io get D SO} D |
1437 |
|
|
/SB {/N2 0 D 0 1 NI{/N E D{IX N2 get 0 lt{/N2 N2 1 add D}{exit}ie}loop |
1438 |
|
|
/K WS N get FC N get mul D /NY AY N2 get D /BV NY array D |
1439 |
|
|
0 1 NY 1 sub{/TM K string D currentfile TM readhexstring pop pop BV E TM put} |
1440 |
|
|
for BM N BV put /N2 N2 1 add D}for} D |
1441 |
|
|
/IC [{/MA E D /MB 0 D}{2 div /MA E D /MB MA D}{/MB E CS sub D /MA CS D} |
1442 |
|
|
{pop /MA YS AB mul D /MB 1 AB sub YS mul D}{pop /MA 0 D /MB 0 D}] D |
1443 |
|
|
/IP {BV N get /N N 1 add D} D |
1444 |
|
|
/II {/K E D IX K get 0 lt{/EC E D}if /TY E D |
1445 |
|
|
TY 4 eq{/Y E D /X E D}if TY 3 eq{/AB E D}if |
1446 |
|
|
/XW AX K get D /YW AY K get D /IS SG IT K get get D /XS XW IS mul D |
1447 |
|
|
/YS YW IS mul D YS IC TY get exec /MA MA Fl not{3 add}if D} D |
1448 |
|
|
/IM {II /ty TY D /xs XS D /ys YS D /ya YA D /yb YB D /ma MA D /mb MB D /k K D |
1449 |
|
|
/ec EC D /BP f D /CI 0 D WB TL L1 xs add dup XO add MR add W gt |
1450 |
|
|
{pop /ma ma Fl{3 add}if D NL /YA ma D /YB mb D /YS ys D /L1 xs D} |
1451 |
|
|
{/L1 E D ma YA gt{/YA ma D}if mb YB gt{/YB mb D}if}ie /TB f D |
1452 |
|
|
OU{CP E pop YS sub LE neg lt Fl not and PB not and{NP /YA ma D /YB mb D}if |
1453 |
|
|
/BP f D ty ST cvs ( ) join IX k get 0 lt{(\\() join ec join (\\) ) join}if |
1454 |
|
|
k ST cvs join ty 3 eq{AB ST cvs ( ) join E join}if |
1455 |
|
|
ty 4 eq{X ST cvs ( ) join Y ST cvs join ( ) join E join}if C1 E join |
1456 |
|
|
( DI ) join FP 2 eq FP 1 eq AF and or{( FM ) join}if |
1457 |
|
|
( Il Cp ) apa /C1 E D /EN f D}if /HM t D /T f D} D |
1458 |
|
|
/DI {II /Xc CP /Yc E D D /YN YW neg D /HM t D /CI 0 D /K2 IX K get D gsave |
1459 |
|
|
TY 4 eq{OX X IS mul add OY FY add YS sub Y IS mul sub} |
1460 |
|
|
{/FY YS D CP MB sub 2 copy /OY E D /OX E D}ie |
1461 |
|
|
translate K2 0 ge{/DP AZ K2 get D /BV BM K2 get D XS YS scale /N 0 D XW YW DP |
1462 |
|
|
[XW 0 0 YN 0 YW] {IP} FC K2 get 1 eq{image}{f 3 colorimage}ie} |
1463 |
|
|
{EX}ie grestore XS 0 R /Ms t D} D |
1464 |
|
|
/FM {gsave 0 Sg CP MB sub translate XS neg 0 M 0 YS RL XS 0 RL 0 YS neg RL |
1465 |
|
|
XS neg 0 RL stroke grestore} D |
1466 |
|
|
/NA {/AT E D /AL AL 1 add D AV AL AT put} D |
1467 |
|
|
/OA {AL 0 gt{/AL AL 1 sub D /AT AV AL get D}if} D |
1468 |
|
|
/D1 {/BR {CP E pop E BN Mb{CP E pop eq{0 YI R}if}{pop}ie} D |
1469 |
|
|
/Sn {OU{C1 E ST cvs join ( Ld ) join /C1 E D}{pop}ie} D} D |
1470 |
|
|
/D1 {/BR {BN} D /Sn {OU {C1 E ST cvs join ( Ld ) join /C1 E D} {pop} ie} D} D |
1471 |
|
|
/TC {/TF t D /ML 0 D HN{SW pop dup ML gt{/ML E D}{pop}ie}forall NP /RM RM not D |
1472 |
|
|
RC /OU Tc D Ep /PN 0 D Ms not TP and{Ip}if /W IW ML sub Ts sub D |
1473 |
|
|
/A0 0 D TH{/BR {( ) join BT} D /Sn {pop} D /Ti () D /Au () D}if} D |
1474 |
|
|
/TN {0 eq{E EA PF HF or not XR and{HN E get Xr}{pop}ie} |
1475 |
|
|
{OU{Tn 0 ge{() BN}if /Tn E D}{pop}ie WB}ie} D |
1476 |
|
|
/NT {OU LB not and Tn 0 ge and{PL 0 eq{Ms not{CS CF FS}if CP dup |
1477 |
|
|
/y E YA sub D W 9 sub CS -1.8 mul XO L1 add 2 add{y M (.) show}for |
1478 |
|
|
HN Tn get dup SW pop IW E sub y M show CP BB M}if /Tn -1 D}if} D |
1479 |
|
|
/Ld {/DN E D HN DN Pn put [/View [/XYZ -4 Fl{PS}{CP YA add US E pop}ie null] |
1480 |
|
|
/Dest DN ST cvs cvn /DEST pdfmark} D |
1481 |
|
|
/C {ND 1 eq{1 sub}if TI mul /XO E D NL Nf not{pop()}if 0 3 -1 roll 1 A} D |
1482 |
|
|
/OP {BP not{NP}if PN 2 mod 0 eq{NP}if}D |
1483 |
|
|
/Ep {Xp PN 2 mod 0 eq and{/Pn (-) D showpage /PM 1 D LA}if}D |
1484 |
|
|
/Dg [73 86 88 76 67 68 77] D |
1485 |
|
|
/Rd [0 [1 1 0][2 1 0][3 1 0][2 1 1][1 1 1][2 2 1][3 3 1][4 4 1][2 1 2]] D |
1486 |
|
|
/Ns {/m E D /c E 32 mul D /j m 1000 idiv D /p j 12 add string D |
1487 |
|
|
c 96 le m 0 gt and{c 32 le {/i 0 D /d 77 D /l 100 D /m m j 1000 mul sub D |
1488 |
|
|
j -1 1 {pop p i d c add put /i i 1 add D}for |
1489 |
|
|
4 -2 0 {/j E D /n m l idiv D /m m n l mul sub D /d Dg j get D |
1490 |
|
|
n 0 gt {/x Rd n get D x 0 get -1 1 {pop p i d c add put /i i 1 add D}for |
1491 |
|
|
p i x 1 get sub Dg x 2 get j add get c add put}if /l l 10 idiv D |
1492 |
|
|
}for p 0 i GI} |
1493 |
|
|
{/i ST length 1 sub D m {1 sub dup 0 ge{dup 26 mod c add 1 add |
1494 |
|
|
ST i 3 -1 roll put 26 idiv dup 0 eq{pop exit}if}if /i i 1 sub D}loop |
1495 |
|
|
ST i ST length i sub GI}ie} |
1496 |
|
|
{m p cvs}ie} D |
1497 |
|
|
/US {matrix currentmatrix matrix defaultmatrix matrix invertmatrix |
1498 |
|
|
matrix concatmatrix transform} D |
1499 |
|
|
/GB {Gb{US}if}D |
1500 |
|
|
/Tl {/Rn E D Xc CP pop ne{ |
1501 |
|
|
[/Rect [Xc 1 sub Yc cS 0.25 mul sub GB CP E 1 add E cS 0.85 mul add GB] |
1502 |
|
|
/Subtype /Link /Border [0 0 Cf Lc and LX and AU or{0}{1}ie] Rn type |
1503 |
|
|
/nametype eq {/Dest Rn}{/Action [/Subtype /URI /URI Rn] Cd}ie |
1504 |
|
|
/ANN pdfmark}if} D |
1505 |
|
|
/Il {/Rn E D [/Rect [Xc Yc GB Xc XS add Yc YS add GB] /Subtype /Link |
1506 |
|
|
/Border [0 0 0] Rn type /nametype eq{/Dest Rn} |
1507 |
|
|
{/Action [/Subtype /URI /URI Rn] Cd}ie /ANN pdfmark} D |
1508 |
|
|
/XP {[{/Z Bz 2 div D Z 0 R Z Z RL Z neg Z RL Z neg Z neg RL Z Z neg RL} |
1509 |
|
|
{Bz 0 RL 0 Bz RL Bz neg 0 RL 0 Bz neg RL} |
1510 |
|
|
{0 -5 R Bz 0 RL 0 21 RL Bz neg 0 RL 0 -21 RL}]} D |
1511 |
|
|
/MS {/Sm E D WB}D |
1512 |
|
|
/O {BN()Sm BX} D |
1513 |
|
|
/BX {/Bt E D Bt 2 lt{CS 0.8 mul}{11 mul}ie W XO sub MR sub 2 copy gt{E}if pop |
1514 |
|
|
/HZ E D WB Bt 2 eq{HZ ST cvs ( ) join}{()}ie |
1515 |
|
|
Bt ST cvs join ( Bx ) join HM{( ) Pd}if |
1516 |
|
|
L1 HZ add XO add MR add W gt{NL}if C1 E join /C1 E D /L1 L1 HZ add D /T f D |
1517 |
|
|
( ) WB Bt 2 lt{YA CS .8 mul lt{/YA CS .8 mul D}if} |
1518 |
|
|
{YB 5 lt{/YB 5 D}if YA 21 lt{/YA 21 D}if}ie /CI 0 D} D |
1519 |
|
|
/Bx {dup 2 eq{E /Bz E D}{/Bz CS .8 mul D}ie |
1520 |
|
|
OU {gsave 0 Sg XP E get exec stroke grestore}{pop}ie Bz 0 R /Ms t D} D |
1521 |
|
|
/SD {FD 4 mul Dy add DZ NF newpath 0 0 M DX t charpath pathbbox |
1522 |
|
|
3 -1 roll sub /DY E D E dup /X1 E D sub WM mul WX DY mul add WM DG mul E div |
1523 |
|
|
/DF E D /DR WX DF mul DY mul WM div 2 div D} d |
1524 |
|
|
/Sd {gsave 0 IL Di mul neg translate IL IW atan Di 0 eq{neg}if rotate |
1525 |
|
|
FD 4 mul Dy add DZ NF DR X1 sub DY 2 div neg M cD VC DX show grestore} d |
1526 |
|
|
/RC {/AI 0 D /LG 0 D /BC 0 D /UI 0 D /PF f D /Cc 0 D /Dc 10 array D |
1527 |
|
|
/NR [0 1 9{pop 0}for] D /La Ds D /AR 10 array D /TR 10 array D /AV 30 array D |
1528 |
|
|
SI /AL -1 D /AT A0 D AT NA /OV 9 array D /Yo 0 D /Co 0 D /Io 0 D /Hy f D |
1529 |
|
|
/Ph f D /CL -1 D Ct Sc}D |
1530 |
|
|
/ZF {/FR [0 1 30{pop 0}for] D /SZ [0 1 30{pop 0}for] D /FO [0 1 30{pop 0}for] D |
1531 |
|
|
/SL 0 D /CF 0 D /FN 0 D 0 Ts SF}D |
1532 |
|
|
/QO [[($qo)][($qo2)]] D |
1533 |
|
|
/QC [[($qc)][($qc2)]] D |
1534 |
|
|
/Hf EF length 2 sub D |
1535 |
|
|
/Hz EZ Hf get D |
1536 |
|
|
/HS Ey Hf get D |
1537 |
|
|
/Fz EZ Hf 1 add get D |
1538 |
|
|
/Fs Ey Hf 1 add get D |
1539 |
|
|
/LE IL D |
1540 |
|
|
/Ps EZ 1 get D |
1541 |
|
|
/Fp EF 1 get D |
1542 |
|
|
/XO 0 D |
1543 |
|
|
/YI 0 D |
1544 |
|
|
/CI 0 D |
1545 |
|
|
/FP 0 D |
1546 |
|
|
/WW Ts 7 mul D |
1547 |
|
|
/Mf 0 D |
1548 |
|
|
/YA 0 D |
1549 |
|
|
/YB 0 D |
1550 |
|
|
/Cs Ts D |
1551 |
|
|
/GS Ts D |
1552 |
|
|
/F0 0 D |
1553 |
|
|
/NS 0 D |
1554 |
|
|
/NB 0 D |
1555 |
|
|
/N 0 D |
1556 |
|
|
/C0 [] D |
1557 |
|
|
/C1 () D |
1558 |
|
|
/Lo 0 D |
1559 |
|
|
/L1 0 D |
1560 |
|
|
/LM 0 D |
1561 |
|
|
/PH 0 D |
1562 |
|
|
/EC 0 D |
1563 |
|
|
/Lh 0 D |
1564 |
|
|
/LT 0 D |
1565 |
|
|
/CH 1 string D |
1566 |
|
|
/ST 16 string D |
1567 |
|
|
/CA 9 array D |
1568 |
|
|
/HC (\\255) D |
1569 |
|
|
/HM f D |
1570 |
|
|
/PF f D |
1571 |
|
|
/EN f D |
1572 |
|
|
/TB f D |
1573 |
|
|
/UF f D |
1574 |
|
|
/sF f D |
1575 |
|
|
/AE f D |
1576 |
|
|
/AF f D |
1577 |
|
|
/BP t D |
1578 |
|
|
/CD f D |
1579 |
|
|
/PA t D |
1580 |
|
|
/GL f D |
1581 |
|
|
/T t D |
1582 |
|
|
/HF f D |
1583 |
|
|
/AH f D |
1584 |
|
|
/SA f D |
1585 |
|
|
/PB f D |
1586 |
|
|
/f1 f D |
1587 |
|
|
/mF f D |
1588 |
|
|
/OX 0 D |
1589 |
|
|
/OY 0 D |
1590 |
|
|
/FY 0 D |
1591 |
|
|
/EO 0 D |
1592 |
|
|
/FB 0 D |
1593 |
|
|
/PL 0 D |
1594 |
|
|
/Bw 0 D |
1595 |
|
|
/PD -1 D |
1596 |
|
|
/TP f D |
1597 |
|
|
/TH $th D |
1598 |
|
|
/Ty 4 D |
1599 |
|
|
/Tn -1 D |
1600 |
|
|
/Fl t D |
1601 |
|
|
/LB t D |
1602 |
|
|
/PM 1 D |
1603 |
|
|
/Ms f D |
1604 |
|
|
/Ba f D |
1605 |
|
|
/Bb f D |
1606 |
|
|
/Hl 3 D |
1607 |
|
|
/hl 6 D |
1608 |
|
|
/hL 6 D |
1609 |
|
|
/Hs f D |
1610 |
|
|
/HI 0 D |
1611 |
|
|
/hi 0 D |
1612 |
|
|
/PO t D |
1613 |
|
|
/TE f D |
1614 |
|
|
/LF t D |
1615 |
|
|
/BO 0 D |
1616 |
|
|
/Sm 1 D |
1617 |
|
|
/Bf 3 D |
1618 |
|
|
/A1 0 D |
1619 |
|
|
/A2 0 D |
1620 |
|
|
/Ds $lid{'en'} D |
1621 |
|
|
/QL -1 D |
1622 |
|
|
/Cb Db D |
1623 |
|
|
/Ct Dt D |
1624 |
|
|
/Cl Dl D |
1625 |
|
|
EOT |
1626 |
|
|
|
1627 |
|
|
$tbl=<<EOT; |
1628 |
|
|
/TS { |
1629 |
|
|
tables E get /table E D |
1630 |
|
|
table aload pop /rdesc E D /cdesc E D /tdesc E D |
1631 |
|
|
tdesc aload pop /capalg E D /caption E D /rules E D /frame E D /nfoot E D |
1632 |
|
|
/nhead E D /ncol E D /nrow E D /border E D /twid E D /units E D /talign E D |
1633 |
|
|
/flow E D /clear E D /tclass E D pop pop |
1634 |
|
|
/w W D /eps 0.1 D /OU f D /PL 1 D |
1635 |
|
|
/FN EF 21 get D EZ 21 get Ey 21 get FS |
1636 |
|
|
0 1 1{ |
1637 |
|
|
/pass E D |
1638 |
|
|
0 1 nrow{ |
1639 |
|
|
/irow E D |
1640 |
|
|
/cells rdesc irow get 6 get D |
1641 |
|
|
0 1 ncol{ |
1642 |
|
|
/icol E D |
1643 |
|
|
/cell cells icol get D |
1644 |
|
|
cell 0 ne{ |
1645 |
|
|
cell aload pop /CB E D pop pop pop |
1646 |
|
|
/DV E D /bot E D /top E D /right E D /left E D /nowrap E D /valign E D |
1647 |
|
|
/dp E D /align E D /rspan E D /cspan E D /cclass E D /ctype E D /cmax E D |
1648 |
|
|
/cmin E D /proc E D |
1649 |
|
|
rspan 0 eq{/rspan nrow irow sub 1 add D}if |
1650 |
|
|
cspan 0 eq{/cspan ncol icol sub 1 add D}if |
1651 |
|
|
pass 0 eq cspan 1 eq and pass 1 eq cspan 1 gt and or{ |
1652 |
|
|
/W 1e5 D /LL W D /PH 1 D |
1653 |
|
|
ctype 1 eq{() BD}if |
1654 |
|
|
RC align NA |
1655 |
|
|
AT 4 eq{/CD t D /DC dp D /LN 0 D /M1 0 D /M2 0 D}{/CD f D}ie |
1656 |
|
|
0 0 M /LM 0 D proc exec BN |
1657 |
|
|
AT 4 eq{ |
1658 |
|
|
LN array astore cell 15 3 -1 roll put |
1659 |
|
|
cdesc icol get dup dup 5 get M1 lt{5 M1 put}{5 get /M1 E D}ie |
1660 |
|
|
dup 6 get M2 lt{6 M2 put}{6 get /M2 E D}ie |
1661 |
|
|
/LM M1 M2 add D |
1662 |
|
|
}if |
1663 |
|
|
/CD f D |
1664 |
|
|
/thiswid LM left add right add eps add D |
1665 |
|
|
/oldmin 0 D /oldmax 0 D |
1666 |
|
|
0 1 cspan 1 sub{ |
1667 |
|
|
icol add cdesc E get dup 2 get /oldmax E oldmax add D |
1668 |
|
|
1 get /oldmin E oldmin add D |
1669 |
|
|
}for |
1670 |
|
|
thiswid oldmax ge{ |
1671 |
|
|
0 1 cspan 1 sub{ |
1672 |
|
|
icol add cdesc E get dup 2 E 2 get oldmax 0 eq |
1673 |
|
|
{pop thiswid cspan div}{thiswid mul oldmax div}ie |
1674 |
|
|
put |
1675 |
|
|
}for |
1676 |
|
|
}if |
1677 |
|
|
nowrap 1 eq{ |
1678 |
|
|
thiswid oldmin ge{ |
1679 |
|
|
0 1 cspan 1 sub{ |
1680 |
|
|
icol add cdesc E get dup 1 E 1 get oldmin 0 eq |
1681 |
|
|
{pop thiswid cspan div}{thiswid mul oldmin div}ie |
1682 |
|
|
put |
1683 |
|
|
}for |
1684 |
|
|
}if |
1685 |
|
|
}{ |
1686 |
|
|
/W 0 D /LL W D /PH 2 D |
1687 |
|
|
ctype 1 eq{() ES () BD}if |
1688 |
|
|
0 0 M /LM 0 D RC proc exec BN |
1689 |
|
|
/thiswid LM left add right add eps add D |
1690 |
|
|
thiswid oldmin ge{ |
1691 |
|
|
0 1 cspan 1 sub{ |
1692 |
|
|
icol add cdesc E get dup 1 E 1 get oldmin 0 eq |
1693 |
|
|
{pop thiswid cspan div}{thiswid mul oldmin div}ie |
1694 |
|
|
put |
1695 |
|
|
}for |
1696 |
|
|
}if |
1697 |
|
|
}ie |
1698 |
|
|
ctype 1 eq{() ES}if |
1699 |
|
|
}if |
1700 |
|
|
}if |
1701 |
|
|
}for |
1702 |
|
|
}for |
1703 |
|
|
}for |
1704 |
|
|
/tmin 0 D /tmax 0 D |
1705 |
|
|
0 1 ncol{ |
1706 |
|
|
cdesc E get dup 1 get E 2 get 2 copy gt{pop dup}if |
1707 |
|
|
tmax add /tmax E D tmin add /tmin E D |
1708 |
|
|
}for |
1709 |
|
|
twid 0 lt{twid neg IW gt{IW neg}{twid}ie /twid E D}if |
1710 |
|
|
tdesc 0 twid neg tmin 2 copy lt{E}if pop put |
1711 |
|
|
tdesc 1 twid neg tmax 2 copy lt{E}if pop put |
1712 |
|
|
/W w D /LL W D /OU t D /PH 0 D /PL 0 D |
1713 |
|
|
} D |
1714 |
|
|
/PT { |
1715 |
|
|
/PL PL 1 add D |
1716 |
|
|
tables E get /table E D Tm 21 get Ts mul BE |
1717 |
|
|
PL 2 ge{save}if |
1718 |
|
|
/SL SL 1 add D /FN EF 21 get D EZ 21 get Ey 21 get FS |
1719 |
|
|
table aload pop /rdesc E D /cdesc E D /tdesc E D |
1720 |
|
|
tdesc aload pop /capalg E D /caption E D /rules E D /frame E D /nfoot E D |
1721 |
|
|
/nhead E D /ncol E D /nrow E D /border E D /twid E D /units E D /talign E D |
1722 |
|
|
/flow E D /clear E D /tclass E D /tmax E D /tmin E D |
1723 |
|
|
/w W D /xo XO D /mr MR D /ll LL D /lg LG D /ai AI D /bc BC D /nr NR D /ar AR D |
1724 |
|
|
/tr TR D /ui UI D /ph PH D /a0 A0 D /pf PF D /at AT D /av AV D /al AL D |
1725 |
|
|
/Le LE D /la La D |
1726 |
|
|
talign 0 lt{/talign AL 0 gt{AV AL get}{A0 2 le{A0}{0}ie}ie D}if |
1727 |
|
|
ph 1 eq ph 2 eq or{ |
1728 |
|
|
NL ph 1 eq{tmax}{tmin}ie dup XO add LM gt{/LM E XO add D}{pop}ie LM E |
1729 |
|
|
}{ |
1730 |
|
|
/PH 3 D /LE 1e5 D RC %ZF |
1731 |
|
|
border 0 gt{/border 1 D}if |
1732 |
|
|
/twidth 0 D /avail W xo sub D |
1733 |
|
|
twid 0 eq{0 1 ncol{cdesc E get dup 2 get E 3 get dup 0 gt{div neg dup twid lt |
1734 |
|
|
{/twid E D}{pop}ie}{pop pop}ie}for}if |
1735 |
|
|
/twid twid dup 0 lt{neg avail 2 copy gt{E}if pop}{avail mul}ie D |
1736 |
|
|
/OK t D 0 1 ncol{cdesc E get dup 1 get E 3 get twid mul gt{/OK f D}if}for |
1737 |
|
|
0 1 ncol{ |
1738 |
|
|
cdesc E get dup 1 get /colmin E D dup 3 get /cwid E twid mul D dup |
1739 |
|
|
tmax avail le{2 get}if |
1740 |
|
|
tmin avail le tmax avail gt and{ |
1741 |
|
|
dup 2 get E 1 get dup 3 1 roll sub avail tmin sub mul tmax tmin sub div add |
1742 |
|
|
}if |
1743 |
|
|
tmin avail gt{1 get}if |
1744 |
|
|
0 E colmin cwid lt OK and{pop cwid}if dup /twidth E twidth add D put |
1745 |
|
|
}for |
1746 |
|
|
/OU f D CP |
1747 |
|
|
tmin twid le{ |
1748 |
|
|
0 1 ncol{cdesc E get dup 0 get twidth div twid mul 0 E put}for |
1749 |
|
|
/twidth twid D |
1750 |
|
|
}if |
1751 |
|
|
CP printcap CP E pop sub /caphig E D pop |
1752 |
|
|
0 1 1{ |
1753 |
|
|
/pass E D |
1754 |
|
|
0 1 nrow{ |
1755 |
|
|
/irow E D |
1756 |
|
|
/cells rdesc irow get 6 get D |
1757 |
|
|
0 1 ncol{ |
1758 |
|
|
/icol E D |
1759 |
|
|
/cell cells icol get D |
1760 |
|
|
cell 0 ne{ |
1761 |
|
|
cell aload pop /CB E D pop pop pop |
1762 |
|
|
/DV E D /bot E D /top E D /right E D /left E D /nowrap E D /valign E D |
1763 |
|
|
/dp E D /align E D /rspan E D /cspan E D /cclass E D /ctype E D /cmax E D |
1764 |
|
|
/cmin E D /proc E D |
1765 |
|
|
rspan 0 eq{/rspan nrow irow sub 1 add D}if |
1766 |
|
|
cspan 0 eq{/cspan ncol icol sub 1 add D}if |
1767 |
|
|
/W 0 D |
1768 |
|
|
0 1 cspan 1 sub{icol add cdesc E get 0 get /W E W add D}for |
1769 |
|
|
pass 0 eq rspan 1 eq and pass 1 eq rspan 1 gt and or{ |
1770 |
|
|
ctype 1 eq{() BD}if |
1771 |
|
|
/W W left sub right sub D /XO 0 D /EO 0 D SI |
1772 |
|
|
/A0 align D RC align NA |
1773 |
|
|
AT 4 eq{ |
1774 |
|
|
/DC dp D /DO 0 D /ID 1 D |
1775 |
|
|
0 1 DV length 1 sub{DV E get dup DO gt{/DO E D}{pop}ie}for |
1776 |
|
|
/Lo DO DV 0 get sub D /L1 Lo D |
1777 |
|
|
}if |
1778 |
|
|
0 0 M /BP t D /Fl t D /MF 0 D /FB 0 D |
1779 |
|
|
proc exec T not{/CI 0 D}if BN 0 FB neg R MF 0 eq{/MF CS D}if |
1780 |
|
|
CP /thishig E neg bot add top add CI add D pop |
1781 |
|
|
cell 16 MF put cell 17 Ya put cell 18 thishig put |
1782 |
|
|
valign 4 eq{ |
1783 |
|
|
/below thishig Ya sub D |
1784 |
|
|
rdesc irow get dup dup 4 get Ya lt |
1785 |
|
|
{4 Ya put}{4 get /Ya E D}ie |
1786 |
|
|
dup 5 get below lt{5 below put}{5 get /below E D}ie |
1787 |
|
|
/thishig Ya below add D |
1788 |
|
|
}if |
1789 |
|
|
ctype 1 eq{()ES}if |
1790 |
|
|
/oldhig 0 D |
1791 |
|
|
0 1 rspan 1 sub{ |
1792 |
|
|
irow add rdesc E get 0 get /oldhig E oldhig add D |
1793 |
|
|
}for |
1794 |
|
|
thishig oldhig ge{ |
1795 |
|
|
0 1 rspan 1 sub{ |
1796 |
|
|
irow add rdesc E get dup 0 E 0 get oldhig 0 eq |
1797 |
|
|
{pop thishig rspan div}{thishig mul oldhig div}ie |
1798 |
|
|
put |
1799 |
|
|
}for |
1800 |
|
|
}if |
1801 |
|
|
}if |
1802 |
|
|
}if |
1803 |
|
|
}for |
1804 |
|
|
}for |
1805 |
|
|
}for M RC %ZF |
1806 |
|
|
/thight 0 D /racc 0 D /maxh 0 D /brk 0 D /rbeg nhead nfoot add D |
1807 |
|
|
rbeg 1 nrow{ |
1808 |
|
|
rdesc E get dup 0 get dup /thight E thight add D |
1809 |
|
|
brk 0 eq{/racc E D}{/racc E racc add D}ie |
1810 |
|
|
racc maxh gt{/maxh racc D}if 2 get /brk E D |
1811 |
|
|
}for |
1812 |
|
|
ph 3 ge{thight caphig add E}if |
1813 |
|
|
ph 0 eq ph 4 eq or{ |
1814 |
|
|
/PH 4 D /LE Le D /OU Ou D /yoff 0 D /headsz 0 D |
1815 |
|
|
0 1 nhead 1 sub{rdesc E get 0 get headsz add /headsz E D}for |
1816 |
|
|
/footsz 0 D |
1817 |
|
|
0 1 nfoot 1 sub{rdesc E nhead add get 0 get footsz add /footsz E D}for |
1818 |
|
|
/ahig LE BO add MI add D /maxh maxh headsz add footsz add D |
1819 |
|
|
/thight thight headsz add footsz add D |
1820 |
|
|
tmin avail gt maxh ahig gt or |
1821 |
|
|
{/Sf avail tmin div dup ahig maxh div gt{pop ahig maxh div}if D /SA t D} |
1822 |
|
|
{/Sf 1 D}ie |
1823 |
|
|
tclass 1 eq thight LE 15 sub gt and |
1824 |
|
|
{/SA t D LE 15 sub thight div dup Sf lt{/Sf E D}{pop}ie}if |
1825 |
|
|
SA{Sf Sf scale /ll ll Sf div D /xo xo Sf div D /LE LE Sf div D |
1826 |
|
|
/mr mr Sf div D /BO BO Sf div D /ahig ahig Sf div D}if |
1827 |
|
|
nhead nfoot add getwid |
1828 |
|
|
LE CP E pop add capalg 0 eq{caphig sub}if dup headsz sub footsz sub rwid lt |
1829 |
|
|
E thight lt thight ahig lt and or{NP}if |
1830 |
|
|
capalg 0 eq{printcap -8 SP}if |
1831 |
|
|
CP /ycur E D pop |
1832 |
|
|
printhead |
1833 |
|
|
rbeg 1 nrow{/row E D row |
1834 |
|
|
getwid |
1835 |
|
|
ycur yoff add rwid sub footsz sub LE add 0 lt |
1836 |
|
|
{nfoot 0 gt{printfoot}if Tf NP /rbeg irow1 D |
1837 |
|
|
Ba{MI /MI MI SA{Sf div}if D MI SP /MI E D}if |
1838 |
|
|
CP /ycur E D pop /yoff 0 D printhead}if |
1839 |
|
|
irow1 printrow |
1840 |
|
|
}for |
1841 |
|
|
printfoot /row row 1 add D Tf |
1842 |
|
|
0 ycur yoff add M |
1843 |
|
|
capalg 1 eq{/EO 0 D SI -3 SP printcap}if |
1844 |
|
|
Sf 1 lt{1 Sf div dup scale /ll ll Sf mul D /xo xo Sf mul D /LE LE Sf mul D |
1845 |
|
|
/mr mr Sf mul D /BO BO Sf mul D /SA f D}if |
1846 |
|
|
/EO 0 D |
1847 |
|
|
}if |
1848 |
|
|
}ie |
1849 |
|
|
/W w D /XO xo D /MR mr D /LL ll D /LG lg D /AI ai D /BC bc D /NR nr D /AR ar D |
1850 |
|
|
/TR tr D /UI ui D /PH ph D /A0 a0 D /PF pf D /AT at D /AV av D /AL al D |
1851 |
|
|
/La la D |
1852 |
|
|
/SL SL 1 sub NN D /CF 0 D /FN 0 D SZ SL get FR SL get FS Wf not{()F2}if |
1853 |
|
|
PL 2 ge{Ms E restore Ms or /Ms E D PH 1 eq PH 2 eq or |
1854 |
|
|
{/LM E D}if PH 3 ge{/CI 0 D NL 0 E neg R}if |
1855 |
|
|
}if |
1856 |
|
|
/PL PL 1 sub D /CI 0 D /BP f D /PO f D () Bm 21 get Ts mul BE BL %CF CS SF |
1857 |
|
|
} D |
1858 |
|
|
/printcap{ |
1859 |
|
|
capalg 0 ge{ |
1860 |
|
|
SA{/W w Sf div D} |
1861 |
|
|
{talign 1 eq{/XO xo ll twidth sub 2 div add D}if |
1862 |
|
|
talign 2 eq{/XO xo ll twidth sub add D}if |
1863 |
|
|
/W XO twidth add D |
1864 |
|
|
}ie /XO xo D /LL W XO sub MR sub D |
1865 |
|
|
/PA f D /Fl capalg 0 eq D |
1866 |
|
|
1 NA BL caption exec BN OA /PA t D |
1867 |
|
|
}if |
1868 |
|
|
} D |
1869 |
|
|
/getwid{ |
1870 |
|
|
/irow1 E D |
1871 |
|
|
/irow2 irow1 D |
1872 |
|
|
/rwid 0 D |
1873 |
|
|
{rdesc irow2 get dup 0 get rwid add /rwid E D 2 get 0 eq |
1874 |
|
|
{exit}{/irow2 irow2 1 add D}ie |
1875 |
|
|
}loop |
1876 |
|
|
} D |
1877 |
|
|
/printrow{ |
1878 |
|
|
/xoff ll twidth PL 2 ge{Sf div}if sub talign mul 2 div D |
1879 |
|
|
/xleft xoff xo add D |
1880 |
|
|
/irow E D |
1881 |
|
|
/cells rdesc irow get 6 get D |
1882 |
|
|
0 1 ncol{ |
1883 |
|
|
/icol E D |
1884 |
|
|
/cell cells icol get D |
1885 |
|
|
cell 0 ne{ |
1886 |
|
|
cell aload pop /CB E D /cvsize E D /above E D /fontsz E D |
1887 |
|
|
/DV E D /bot E D /top E D /right E D /left E D /nowrap E D /valign E D |
1888 |
|
|
/dp E D /align E D /rspan E D /cspan E D /cclass E D /ctype E D /cmax E D |
1889 |
|
|
/cmin E D /proc E D |
1890 |
|
|
rspan 0 eq{/rspan nrow irow sub 1 add D}if |
1891 |
|
|
cspan 0 eq{/cspan ncol icol sub 1 add D}if |
1892 |
|
|
/width 0 D |
1893 |
|
|
0 1 cspan 1 sub{icol add cdesc E get 0 get /width E width add D}for |
1894 |
|
|
/rhight rdesc irow get 0 get D |
1895 |
|
|
/hight rhight D |
1896 |
|
|
1 1 rspan 1 sub{irow add rdesc E get 0 get /hight E hight add D}for |
1897 |
|
|
/W xo xoff add width add right sub D |
1898 |
|
|
/EO xo xoff add left add D SI |
1899 |
|
|
Cf{ |
1900 |
|
|
gsave CB VC xo xoff add ycur yoff add M |
1901 |
|
|
0 hight neg RL width 0 RL 0 hight RL width neg 0 RL fill |
1902 |
|
|
grestore |
1903 |
|
|
}if |
1904 |
|
|
ctype 1 eq{() BD}if |
1905 |
|
|
/A0 align D RC |
1906 |
|
|
AT 4 eq{ |
1907 |
|
|
/DC dp D /ID 1 D /DO cdesc icol get 5 get D /Lo DO DV 0 get sub D /L1 Lo D |
1908 |
|
|
}if |
1909 |
|
|
valign 3 le{0 ycur yoff add top sub |
1910 |
|
|
hight cvsize sub valign 1 sub mul 2 div sub M} |
1911 |
|
|
{0 ycur yoff add top sub above add rdesc irow get 4 get sub M}ie |
1912 |
|
|
/PA f D /BP t D /Fl t D |
1913 |
|
|
BL proc exec BN |
1914 |
|
|
/PA t D |
1915 |
|
|
ctype 1 eq{() ES}if |
1916 |
|
|
}if |
1917 |
|
|
/xoff xoff cdesc icol get 0 get add D |
1918 |
|
|
}for |
1919 |
|
|
/yoff yoff rhight sub D |
1920 |
|
|
} D |
1921 |
|
|
/printhead {0 1 nhead 1 sub{printrow}for} D |
1922 |
|
|
/printfoot {nhead 1 nhead nfoot add 1 sub{printrow}for} D |
1923 |
|
|
/Tf { |
1924 |
|
|
OU{rules 2 ge{/yoff 0 D |
1925 |
|
|
gsave 0 Sg |
1926 |
|
|
[0 1 nhead 1 sub{}for rbeg 1 row 1 sub{}for nhead 1 nhead nfoot add 1 sub{}for]{ |
1927 |
|
|
/irow E D |
1928 |
|
|
/xoff ll twidth PL 2 ge{Sf div}if sub talign mul 2 div D |
1929 |
|
|
/cells rdesc irow get 6 get D |
1930 |
|
|
0 1 ncol{ |
1931 |
|
|
/icol E D |
1932 |
|
|
/cell cells icol get D |
1933 |
|
|
cell 0 ne{ |
1934 |
|
|
/rspan cell 6 get D |
1935 |
|
|
/cspan cell 5 get D |
1936 |
|
|
rspan 0 eq{/rspan nrow irow sub 1 add D}if |
1937 |
|
|
cspan 0 eq{/cspan ncol icol sub 1 add D}if |
1938 |
|
|
/width 0 D |
1939 |
|
|
0 1 cspan 1 sub{icol add cdesc E get 0 get /width E width add D}for |
1940 |
|
|
/rhight rdesc irow get 0 get D |
1941 |
|
|
/hight rhight D |
1942 |
|
|
1 1 rspan 1 sub{irow add rdesc E get 0 get /hight E hight add D}for |
1943 |
|
|
xo xoff add width add ycur yoff add M |
1944 |
|
|
0 hight neg icol cspan add 1 sub ncol lt |
1945 |
|
|
{cdesc icol 1 add get 4 get dup rules 3 le{1 eq}{pop t}ie |
1946 |
|
|
{1 eq{0.8}{0.3}ie |
1947 |
|
|
LW RL CP stroke M}{pop R}ie}{R}ie |
1948 |
|
|
irow nhead nfoot add 1 sub ne nfoot 0 eq or |
1949 |
|
|
{irow rspan add 1 sub nrow lt |
1950 |
|
|
{rdesc irow rspan add get 3 get}{nfoot 0 eq{0}{1}ie}ie |
1951 |
|
|
dup rules 2 mod 0 eq{1 eq}{pop t}ie |
1952 |
|
|
{1 eq irow rspan add nhead eq or irow rspan add row eq nfoot 0 gt and or |
1953 |
|
|
{0.8}{0.3}ie LW width neg 0 RL CP stroke M}{pop}ie}if |
1954 |
|
|
}if |
1955 |
|
|
/xoff xoff cdesc icol get 0 get add D |
1956 |
|
|
}for |
1957 |
|
|
/yoff yoff rhight sub D |
1958 |
|
|
}forall |
1959 |
|
|
grestore |
1960 |
|
|
/Ms t D |
1961 |
|
|
}if |
1962 |
|
|
frame 1 gt{ |
1963 |
|
|
gsave |
1964 |
|
|
1 LW 0 Sg |
1965 |
|
|
xleft ycur M CP BB |
1966 |
|
|
0 yoff frame 5 eq frame 7 ge or{RL}{R}ie |
1967 |
|
|
twidth 0 frame 3 eq frame 4 eq or frame 8 ge or{RL}{R}ie CP BB |
1968 |
|
|
0 yoff neg frame 6 ge{RL}{R}ie |
1969 |
|
|
twidth neg 0 frame 2 eq frame 4 eq or frame 8 ge or{RL}{R}ie |
1970 |
|
|
closepath stroke |
1971 |
|
|
grestore |
1972 |
|
|
/Ms t D |
1973 |
|
|
}if |
1974 |
|
|
}if |
1975 |
|
|
} D |
1976 |
|
|
EOT |
1977 |
|
|
|
1978 |
|
|
&openps if($opt_o); |
1979 |
|
|
$ntab=-1; |
1980 |
|
|
$tables="/tables ["; |
1981 |
|
|
@docs=$#ARGV<0?("-"):@ARGV; |
1982 |
|
|
if($tocdoc) {$#docs=0}; |
1983 |
|
|
for (@docs) {$levl{$_}=1}; |
1984 |
|
|
$nref=0; |
1985 |
|
|
$nhd=0; |
1986 |
|
|
$nlnk=1; |
1987 |
|
|
$ndoc=0; |
1988 |
|
|
$nrem=0; |
1989 |
|
|
$toc="/BO 0 D TC /Ba f D Bs /AU f D /UR () D RC ZF\n"; |
1990 |
|
|
$toc.="()F2" if(!$latin1); |
1991 |
|
|
$toc.="($toc{'heading'})WB\n" if(!$tocdoc); |
1992 |
|
|
$fl1=""; |
1993 |
|
|
$fl2=""; |
1994 |
|
|
$np="NP RC ZF"; |
1995 |
|
|
$P3=""; |
1996 |
|
|
while($html=shift @docs) { |
1997 |
|
|
$ndoc++; |
1998 |
|
|
$ba2=""; |
1999 |
|
|
$P2="("; |
2000 |
|
|
$banner=""; |
2001 |
|
|
undef @links; |
2002 |
|
|
$level=$levl{$html}; |
2003 |
|
|
if(&h2p) { |
2004 |
|
|
if($ndoc==1) { |
2005 |
|
|
$toc=~s/\$T/$ti/g; |
2006 |
|
|
$toc=~s/\$A/$au/g; |
2007 |
|
|
$toc=~s/[\200-\377]+/)F1($&)F2(/g if(!$latin1); |
2008 |
|
|
} |
2009 |
|
|
if($layer) { |
2010 |
|
|
@docs=(@docs,@links); |
2011 |
|
|
} else { |
2012 |
|
|
@docs=(@links,@docs); |
2013 |
|
|
} |
2014 |
|
|
$rem=$#docs+1; |
2015 |
|
|
if($rem && $opt_W) { |
2016 |
|
|
&dbg("At least $rem document".($rem>1?"s":"")." remaining\n"); |
2017 |
|
|
} |
2018 |
|
|
if($banner) { |
2019 |
|
|
$_="/Ba t D /BA {($banner)BN} D\nBs f Pb CP /BO E D pop\n"; |
2020 |
|
|
&Subst($_); |
2021 |
|
|
s/ H\(/ -1 H(/g; |
2022 |
|
|
} else { |
2023 |
|
|
$_="/Ba f D /BO 0 D Bs"; |
2024 |
|
|
} |
2025 |
|
|
if($tocdoc && $first && $ndoc==1) { |
2026 |
|
|
$TC=" TC"; |
2027 |
|
|
$et=" NP Ep ET /Tc f D"; |
2028 |
|
|
} else { |
2029 |
|
|
$TC=""; |
2030 |
|
|
$et=""; |
2031 |
|
|
} |
2032 |
|
|
$_.="\n/UR ($html) D\n/Ti ($ti) D\n/Au ($au) D\n/Df $draft D\n$TC\n"; |
2033 |
|
|
if(!$tocdoc) { |
2034 |
|
|
$toc.="ND 1 gt{Ts 3 mul Np $refs{$html}()0 C()BD($ti)ES()$refs{$html}" |
2035 |
|
|
." 1 TN()EA()BN}if\n"; |
2036 |
|
|
} |
2037 |
|
|
$hl=0; |
2038 |
|
|
while($P2=~s/(\d) (\d) H\(([^\s<)]*)/$1 $2 $nhd H($3)WB $nref Sn(/) { |
2039 |
|
|
$nhd++; |
2040 |
|
|
if($hl+1<$2) { |
2041 |
|
|
for($hl+1..$2-1) { |
2042 |
|
|
push(@z1,-$nref); |
2043 |
|
|
push(@z2,$_); |
2044 |
|
|
} |
2045 |
|
|
} |
2046 |
|
|
$hl=$2; |
2047 |
|
|
$hind[$hl-1]++; |
2048 |
|
|
for $i ($hl..5) {$hind[$i]=0}; |
2049 |
|
|
$hind=join('.',@hind[0..$hl-1]); |
2050 |
|
|
$hst=$3; |
2051 |
|
|
$'=~/\)EH/; |
2052 |
|
|
($htxt=$hst.$`)=~s/\)EA\(//g; |
2053 |
|
|
if(!$tocdoc) { |
2054 |
|
|
$toc.="$hl NH le{$nref($hind\\240\\240)$hl C($htxt)$nref 1 TN()EA()BN}if\n"; |
2055 |
|
|
} |
2056 |
|
|
push(@z1,$nref); |
2057 |
|
|
push(@z2,$hl); |
2058 |
|
|
$nref++; |
2059 |
|
|
$htxt=~s/(\s+|\)BR\()/ /g; |
2060 |
|
|
$htxt=~s/(^\s+|\)[^(]*\(|\s+$)//g; |
2061 |
|
|
$htxt="" if(!$latin1); |
2062 |
|
|
$dh.="/h$nhd [($hind\\240\\240)($htxt)] D\n"; |
2063 |
|
|
} |
2064 |
|
|
if($tocdoc) { |
2065 |
|
|
if($ndoc==1 && !$first) { |
2066 |
|
|
$toc="TC RC ZF $_ $P2 WB () BN\n"; |
2067 |
|
|
$P2=""; |
2068 |
|
|
$P3=""; |
2069 |
|
|
$np=""; |
2070 |
|
|
$_=""; |
2071 |
|
|
} |
2072 |
|
|
} |
2073 |
|
|
$P3.="$fl1\n/Cb $bg D /Ct $tcol D /Cl $lcol D /CL -1 D Ct Sc\n$fl2\n$_\n$np\n$P2"; |
2074 |
|
|
if($tocdoc && $ndoc==1 && !$first) { |
2075 |
|
|
$np="/Cb $bg D NP RC ZF"; |
2076 |
|
|
} else { |
2077 |
|
|
$fl1="WB NL$et"; |
2078 |
|
|
$fl2="DS"; |
2079 |
|
|
$np="0 BO R"; |
2080 |
|
|
} |
2081 |
|
|
} |
2082 |
|
|
} |
2083 |
|
|
|
2084 |
|
|
$P3.=($P3!~/\)\s*$/?"()":"")."WB NL"; |
2085 |
|
|
if(!$tocdoc && $first && $nhd){$P3="$toc/OU t D /Cb $bg D NP Ep ET $P3"}; |
2086 |
|
|
if(!$first && ($tocdoc || !$tocdoc && $nhd)){$P3.=" $toc"}; |
2087 |
|
|
|
2088 |
|
|
if($ntab>=0) { |
2089 |
|
|
$_="$tables] D"; |
2090 |
|
|
&ack($_); |
2091 |
|
|
y/\t\f/ /; |
2092 |
|
|
s/[\200-\377]/sprintf("\\%3.3o",ord($&))/eg; |
2093 |
|
|
s/\)XX/)9 9 PR/g; |
2094 |
|
|
s/ H\(/ -1 H(/g; |
2095 |
|
|
$tables=$_; |
2096 |
|
|
} |
2097 |
|
|
$_="%!\n%%Title: $title\n$P0$P1"; |
2098 |
|
|
if($nimg>=0) { |
2099 |
|
|
$_.="/AX [".join(' ',@XS)."] D\n/AY [".join(' ',@YS)."] D\n" |
2100 |
|
|
."/IX [".join(' ',@IX)."] D\n/IT [".join(' ',@IT)."] D\n"; |
2101 |
|
|
if($nm>=0) { |
2102 |
|
|
$_.="/AZ [".join(' ',@DP)."] D\n/WS [".join(' ',@WS)."] D\n" |
2103 |
|
|
."/FC [".join(' ',@FC)."] D\n/NI $nm D\n/BM ".($nm+1)." array D\nSB\n"; |
2104 |
|
|
for $i (0..$nm) {$_.="$BM[$i]\n\n"} |
2105 |
|
|
} |
2106 |
|
|
$_.="\n$pv%Endpv\n" if($nps); |
2107 |
|
|
} |
2108 |
|
|
@kw=split(/[, ]+/,$kw); |
2109 |
|
|
@Kw=(); |
2110 |
|
|
for $i (@kw){push(@Kw,$i) if(!grep(/^$i$/,@Kw))}; |
2111 |
|
|
$kw=join(', ',@Kw); |
2112 |
|
|
for $i (0..$#z2) { |
2113 |
|
|
$n=0; |
2114 |
|
|
$j=$i; |
2115 |
|
|
while($j++<=$#z2 && $z2[$j]>$z2[$i]) {$n++ if($z2[$j]==$z2[$i]+1)}; |
2116 |
|
|
push(@z3,$n); |
2117 |
|
|
} |
2118 |
|
|
$tdef=$ntab>=0?"$tbl$tables\n0 1 $ntab\{TS}for RC ZF\n":""; |
2119 |
|
|
$hd="/Hr [@z1]D\n/HV [@z2]D\n/Cn [@z3]D"; |
2120 |
|
|
&cut($hd); |
2121 |
|
|
if($gd) { |
2122 |
|
|
$sd="/Df t D /DG IW IW mul IL IL mul add sqrt D IW IL IW IL lt{E}if" |
2123 |
|
|
." /WM E D /WX E D /DZ 180 D gsave SD /DZ DZ DF mul D SD grestore\n"; |
2124 |
|
|
} else { |
2125 |
|
|
$sd="/Df f D\n"; |
2126 |
|
|
} |
2127 |
|
|
$_.=<<EOD; |
2128 |
|
|
[/Creator ($version) /Author ($Au) /Keywords ($kw) /Subject ($su) |
2129 |
|
|
/Title ($title) /DOCINFO pdfmark |
2130 |
|
|
/ND $ndoc D |
2131 |
|
|
/HN [1 1 $nref\{pop (??)}for] D |
2132 |
|
|
$dh$hd |
2133 |
|
|
Hr length 0 gt{[/PageMode /UseOutlines /DOCVIEW pdfmark}if |
2134 |
|
|
/Hn 1 D |
2135 |
|
|
0 1 Hr length 1 sub{ |
2136 |
|
|
/Bn E D [Cn Bn get dup 0 gt{/Count E HV Bn get Bl ge{neg}if}{pop}ie |
2137 |
|
|
/Dest Hr Bn get dup abs ST cvs cvn E 0 ge{(h)Hn ST cvs join cvx exec dup 1 get |
2138 |
|
|
E Nf{0 get E join}{pop}ie /Hn Hn 1 add D}{()}ie /Title E /OUT pdfmark}for |
2139 |
|
|
ZF /FN Fp D Ps 0 FS /WC Wf{( )}{<A1A1>}ie SW pop D |
2140 |
|
|
ET RC ZF |
2141 |
|
|
$sd$rfs$tdef$P3 |
2142 |
|
|
/TE t D NP TU PM 0 eq and{/Pn () D showpage}if end restore |
2143 |
|
|
EOD |
2144 |
|
|
|
2145 |
|
|
if(($first || $opt_R) && $xref{'passes'}) { |
2146 |
|
|
&dbg("Inserting cross references\n") if($opt_d); |
2147 |
|
|
for $i (1..$xref{'passes'}) {&ref}; |
2148 |
|
|
} |
2149 |
|
|
&fin; |
2150 |
|
|
|
2151 |
|
|
sub h2p { |
2152 |
|
|
if($html eq '-') { |
2153 |
|
|
$_=<>; |
2154 |
|
|
} elsif($html=~m|://|) { |
2155 |
|
|
if(($prompt || $nrem>50) && $level>1) { |
2156 |
|
|
&prompt("Retrieve document $html (y/n/q)? ",$ans); |
2157 |
|
|
if($ans=~/q/i) {undef @docs}; |
2158 |
|
|
return 0 unless($ans=~/y/i); |
2159 |
|
|
} |
2160 |
|
|
&geturl($html,$_) || return; |
2161 |
|
|
$nrem++; |
2162 |
|
|
if($contyp!~m|text/html|i) {$_=" <plaintext>\n$_"}; |
2163 |
|
|
unless(($ba2)=$html=~m|(.*://.*/)|) {$ba2=$html."/"}; |
2164 |
|
|
} else { |
2165 |
|
|
if(open(FILE,$html)) { |
2166 |
|
|
&dbg("Reading $html\n") if($opt_W || $opt_d); |
2167 |
|
|
$_=<FILE>; |
2168 |
|
|
if(!/<HTML/i && $html!~/html?$/i && ($html!~/\.ps$/i || $ndoc>1)) { |
2169 |
|
|
$_=" <plaintext>\n$_"; |
2170 |
|
|
} |
2171 |
|
|
close FILE; |
2172 |
|
|
} else { |
2173 |
|
|
&dbg("*** Error opening $html\n"); |
2174 |
|
|
return 0; |
2175 |
|
|
} |
2176 |
|
|
} |
2177 |
|
|
|
2178 |
|
|
if(/^%!/ && /$delim/) { |
2179 |
|
|
$psin=1; |
2180 |
|
|
&openps if($opt_o); |
2181 |
|
|
$_=$P0.$'; |
2182 |
|
|
for $s ("b","c","cw","g","t") { |
2183 |
|
|
&dbg("Option -$s ignored\n") if(eval "\$opt_$s"); |
2184 |
|
|
} |
2185 |
|
|
&fin; |
2186 |
|
|
} |
2187 |
|
|
|
2188 |
|
|
&hb($_,$head); |
2189 |
|
|
$head=~/<title$R\s*([\w\W]*)<\/title/i; |
2190 |
|
|
($ti=$2)=~s/\s+/ /g; |
2191 |
|
|
$ti=$doctit{$html} if(!$ti); |
2192 |
|
|
$ti=~s/\s*$//g; |
2193 |
|
|
&spec($ti); |
2194 |
|
|
&ent($ti); |
2195 |
|
|
$ti="<Untitled>" if(!$ti); |
2196 |
|
|
$title=$ti if(!$title); |
2197 |
|
|
$draft="f" if(!$ddr); |
2198 |
|
|
$au=""; |
2199 |
|
|
while($head=~/<meta\s[^>]*(name|http-equiv)\s*=\s*["']?\s*(\w+)$R/gi) { |
2200 |
|
|
$k=$2; |
2201 |
|
|
($v)=$&=~/content\s*=\s*["']\s*([^"']+)/i; |
2202 |
|
|
$v=~s/\s+/ /g; |
2203 |
|
|
$v=~s/\s*$//g; |
2204 |
|
|
&spec($v); |
2205 |
|
|
&ent($v); |
2206 |
|
|
if($k=~/author/i) {$au=$au?"$au, $v":$v}; |
2207 |
|
|
if($k=~/keywords/i) {$kw=$kw?"$kw, $v":$v}; |
2208 |
|
|
if($k=~/subject/i && !$su) {$su=$v}; |
2209 |
|
|
if(!$ddr && $k=~/status/i && $v=~/draft/i) {$draft="t";$gd=1}; |
2210 |
|
|
} |
2211 |
|
|
$Au.=($Au?" + ":"").$au if($au); |
2212 |
|
|
$b2=$opt_b; |
2213 |
|
|
unless($b2) { |
2214 |
|
|
($b2)=$head=~/<base\s+href\s*=\s*"([^"]*)"$R/i; |
2215 |
|
|
unless($b2) {($b2)=$head=~/<base\s+href\s*=\s*([\w\.-]+)$R/i} |
2216 |
|
|
unless($b2) {$b2=$ba2} |
2217 |
|
|
} |
2218 |
|
|
$b2=~s|[^/]*$||; |
2219 |
|
|
($b1)=$b2=~m|(.*://[^/]*)/|; |
2220 |
|
|
unless($b1) {$b1=$opt_r}; |
2221 |
|
|
unless($b2) {$b2=$html=~m|(.*/)[^/]*$|?$1:""}; |
2222 |
|
|
if(!defined $B2) {$B2=$b2}; |
2223 |
|
|
$levl{$b2.$html}=$levl{$html}; |
2224 |
|
|
|
2225 |
|
|
while($link && $head=~/<link\s+[^>]*rel\s*=\s*["']?next$R/gi) { |
2226 |
|
|
if(($lnk)=$&=~/href\s*=\s*["']?\s*([^"' >]*)/gi) { |
2227 |
|
|
if($lnk=~m|.+//[^/]+$|) {$lnk=$&."/"} |
2228 |
|
|
if($lnk=~m|://|) { |
2229 |
|
|
$rlnk=0; |
2230 |
|
|
} else { |
2231 |
|
|
$rlnk=1; |
2232 |
|
|
if($lnk=~m|^/|) {$lnk=$b1.$lnk} else {$lnk=$b2.$lnk} |
2233 |
|
|
} |
2234 |
|
|
while($lnk!~m|^\.\./| && $lnk=~m|[^/]*/\.\./|) {$lnk=$`.$'}; |
2235 |
|
|
$lnk=~s|/\./|/|g; |
2236 |
|
|
if(&follow && !$levl{$lnk}) { |
2237 |
|
|
$levl{$lnk}=$level+1; |
2238 |
|
|
push(@links,$lnk); |
2239 |
|
|
} |
2240 |
|
|
} |
2241 |
|
|
} |
2242 |
|
|
($battr)=/<BODY$R/i; |
2243 |
|
|
($lang)=$battr=~/\slang\s*=\s*['"]?([a-zA-Z-]+)/i; |
2244 |
|
|
($lang)=$head=~/<html[^>]+lang\s*=\s*['"]?([a-zA-Z-]+)/i if(!$lang); |
2245 |
|
|
$lang=$opt_l if($opt_l); |
2246 |
|
|
$lang='en' if(!$lang); |
2247 |
|
|
$lang=lc $lang; |
2248 |
|
|
if($battr=~/\stext\s*=\s*['"]?\s*#?(\w+)/i) {$tcol=&col2rgb($1)}; |
2249 |
|
|
if(!$tcol) {$tcol="Dt"}; |
2250 |
|
|
if($battr=~/\slink\s*=\s*['"]?\s*#?(\w+)/i) {$lcol=&col2rgb($1)}; |
2251 |
|
|
if(!$lcol) {$lcol="Dl"}; |
2252 |
|
|
&inihyph if($opt_H); |
2253 |
|
|
($bg)=$battr=~/BGCOLOR\s*=\s*["']?\s*#?(\w+)/i; |
2254 |
|
|
$bg=&col2rgb($bg); |
2255 |
|
|
if($bg) { |
2256 |
|
|
($red,$grn,$blu)=@cvec; |
2257 |
|
|
} else { |
2258 |
|
|
($red,$grn,$blu)=$bgcol=~/#(\w+).*#(\w+).*#(\w+)/; |
2259 |
|
|
$bg="Db"; |
2260 |
|
|
} |
2261 |
|
|
|
2262 |
|
|
$temp=""; |
2263 |
|
|
while(/<object$R/i) { |
2264 |
|
|
$temp.=$`; |
2265 |
|
|
$tag=$&; |
2266 |
|
|
$end=$'; |
2267 |
|
|
$type=$tag=~/type\s*=\s*($S)/i?$+:""; |
2268 |
|
|
$uaddr=$tag=~/data\s*=\s*($S)/i?$+:""; |
2269 |
|
|
if($type=~/^text\/(html|plain)$/i |
2270 |
|
|
|| !$type && $uaddr=~m"(\.html?|://.+/|://[^/]+)$"i) { |
2271 |
|
|
$tag=~/data\s*=\s*/i; |
2272 |
|
|
if(&open($uaddr,$idoc)) { |
2273 |
|
|
if($type=~/plain/i) { |
2274 |
|
|
$idoc="<XMP>$idoc</XMP>"; |
2275 |
|
|
} else { |
2276 |
|
|
&hb($idoc,$dum); |
2277 |
|
|
} |
2278 |
|
|
$_=$idoc; |
2279 |
|
|
$_.=$' if($end=~/<\/object>/i); |
2280 |
|
|
} else { |
2281 |
|
|
&dbg("\n*** Error opening $uaddr\n"); |
2282 |
|
|
$_=$end; |
2283 |
|
|
} |
2284 |
|
|
} else { |
2285 |
|
|
$temp.=$tag; |
2286 |
|
|
$_=$end; |
2287 |
|
|
} |
2288 |
|
|
} |
2289 |
|
|
$_=$temp.$_; |
2290 |
|
|
|
2291 |
|
|
if($opt_c && defined $package{'check'}) { |
2292 |
|
|
$file=$html; |
2293 |
|
|
if($html=~m|://|) { |
2294 |
|
|
open(SCRATCH,">$scr"); |
2295 |
|
|
print SCRATCH; |
2296 |
|
|
close SCRATCH; |
2297 |
|
|
$file="$scr"; |
2298 |
|
|
} |
2299 |
|
|
&dbg(`$package{'check'} $file`); |
2300 |
|
|
} |
2301 |
|
|
|
2302 |
|
|
if(!$latin1) { |
2303 |
|
|
if($opt_e=~/EUC-/i) { |
2304 |
|
|
s/([\216\217\241-\376].)+/\000$&\000/g; |
2305 |
|
|
&spec($_); |
2306 |
|
|
s/\000(.+?)\000/)F1($1)F2(/g; |
2307 |
|
|
} elsif($opt_e=~/SHIFT-JIS/i) { |
2308 |
|
|
s/[\201-\237\340-\374][@-~\200-\374]/$&\000/g; |
2309 |
|
|
s/[\241-\337]+(?!\000)/$&\000/g; |
2310 |
|
|
s/[ -~\t\n\r\240]+(?!\000)/\002$&\001/g; |
2311 |
|
|
&spec($_); |
2312 |
|
|
s/\000//g; |
2313 |
|
|
} else { |
2314 |
|
|
while(/\e\$B([^\e]*)/) { |
2315 |
|
|
$beg=$`; |
2316 |
|
|
$end=$'; |
2317 |
|
|
$mat=$1; |
2318 |
|
|
$mat=~s/\s//g; |
2319 |
|
|
$_="$beg\001$mat$end"; |
2320 |
|
|
} |
2321 |
|
|
s/\e\([BJ]/\002/g; |
2322 |
|
|
&spec($_); |
2323 |
|
|
} |
2324 |
|
|
s/\001/)F1(/g; |
2325 |
|
|
s/\002/)F2(/g; |
2326 |
|
|
$_=")F2($_"; |
2327 |
|
|
y/\000-\010\013\016-\037\177//d; |
2328 |
|
|
} else { |
2329 |
|
|
&spec($_); |
2330 |
|
|
y/\000-\010\013\016-\037\177-\237//d; |
2331 |
|
|
} |
2332 |
|
|
s/(\r\n|\r)/\n/g; |
2333 |
|
|
$refs{$html}=$nref++ if(!defined $refs{$html}); |
2334 |
|
|
$_="\004$lang\004)WB $refs{$html} Sn($_"; |
2335 |
|
|
|
2336 |
|
|
# Yes, I know Perl has case-insensitive pattern matching. But on my system |
2337 |
|
|
# it takes about 10 times longer to run! |
2338 |
|
|
|
2339 |
|
|
$pt=""; |
2340 |
|
|
if(/<[pP][lL][aA][iI][nN][tT][eE][xX][tT]$R/) {$_=$`;$pt=$'}; |
2341 |
|
|
while($_){ |
2342 |
|
|
if(/(<[lL][iI][sS][tT][iI][nN][gG]$R)/) {$_=$`; $tag=$1; $rest=$'; |
2343 |
|
|
if(/<[xX][mM][pP]$R/){$_=$`; &Subst($_); $P2.="$_)XX("; $_=$'.$tag.$rest; |
2344 |
|
|
if(m|</[xX][mM][pP]$R|) {$P2.="$`)RP("; $_=$'} |
2345 |
|
|
else {$P2.=$'; $_=""}} |
2346 |
|
|
else {&Subst($_); $P2.="$_)XX("; $_=$rest; |
2347 |
|
|
if(m|</[lL][iI][sS][tT][iI][nN][gG]$R|) {$P2.="$`)RP("; $_=$'} |
2348 |
|
|
else {$P2.=$'; $_=""}}} |
2349 |
|
|
elsif(/<[xX][mM][pP]$R/) {$_=$`; &Subst($_); $P2.="$_)XX("; $_=$'; |
2350 |
|
|
if(m|</[xX][mM][pP]$R|) {$P2.="$`)RP("; $_=$'} |
2351 |
|
|
else {$P2.=$'; $_=""}} |
2352 |
|
|
else {&Subst($_);$P2.=$_; $_=""} |
2353 |
|
|
} |
2354 |
|
|
$pt=~s/\f/$pc/g; |
2355 |
|
|
if($pt) {$P2.=")XX($pt"}; |
2356 |
|
|
$P2.=")"; |
2357 |
|
|
if($plain) {$P2.="RP ()"}; |
2358 |
|
|
while($P2=~/XX\(/) { |
2359 |
|
|
$beg=$`; |
2360 |
|
|
$'=~/\)(RP|$)/; |
2361 |
|
|
$mat=$`; |
2362 |
|
|
$end=$&.$'; |
2363 |
|
|
$mat=~s/(.*\n){30}.*/$&)WR(/g; |
2364 |
|
|
($temp=$mat)=~s/\)[^(]+\(//g; |
2365 |
|
|
@prel=split(' *\n',$temp); |
2366 |
|
|
$maxl=0; |
2367 |
|
|
for $line (@prel) { |
2368 |
|
|
$line=~s/\\.../x/g; |
2369 |
|
|
while($line=~/\t+/) { |
2370 |
|
|
$sp=' ' x (length($&)*8-length($`)%8); |
2371 |
|
|
$line=~s/\t+/$sp/; |
2372 |
|
|
$mat=~s/\t+/$sp/; |
2373 |
|
|
} |
2374 |
|
|
$ll=length($line); |
2375 |
|
|
$maxl=$ll if($ll > $maxl); |
2376 |
|
|
} |
2377 |
|
|
$P2="$beg ".($#prel+1)." $maxl PR($mat$end"; |
2378 |
|
|
} |
2379 |
|
|
$P1=~s/[\200-\377]/sprintf("\\%3.3o",ord($&))/eg; |
2380 |
|
|
$P2=~s/[\200-\377]/sprintf("\\%3.3o",ord($&))/eg; |
2381 |
|
|
$P2=~y/\t\f/ /; |
2382 |
|
|
1; |
2383 |
|
|
} |
2384 |
|
|
sub Subst{ |
2385 |
|
|
local($_)=@_; |
2386 |
|
|
if($page_break) { |
2387 |
|
|
s/<!--NewPage-->/$pc/g; |
2388 |
|
|
s/<(\?|hr\s+class\s*=\s*["']?)\s*page-break$R/$pc/gi; |
2389 |
|
|
} |
2390 |
|
|
s/<!--OddPage-->/)WB NL OP(/g; |
2391 |
|
|
s/(­?|­?|<!--hy-->)/)HY(/g; |
2392 |
|
|
while(/<!--/) { |
2393 |
|
|
$_=$`; |
2394 |
|
|
&getcom; |
2395 |
|
|
$_.=$rest; |
2396 |
|
|
} |
2397 |
|
|
$temp=""; |
2398 |
|
|
while(/<([^"'>]*=\s*["'])/) { |
2399 |
|
|
$temp.=$`."<"; |
2400 |
|
|
$_=$1.$'; |
2401 |
|
|
while(/^[^"'>]*=\s*(["'])/) { |
2402 |
|
|
$temp.=$&; |
2403 |
|
|
$_=$'; |
2404 |
|
|
if(/$1/) { |
2405 |
|
|
($tg=$`)=~y/>/\003/; |
2406 |
|
|
$temp.=$tg.$&; |
2407 |
|
|
$_=$'; |
2408 |
|
|
} |
2409 |
|
|
} |
2410 |
|
|
} |
2411 |
|
|
$_=$temp.$_; |
2412 |
|
|
$a='[aA][lL][iI][gG][nN]'; |
2413 |
|
|
$A="($a\\s*=\"?|[sS][tT][yY][lL][eE]\\s*=\\s*\"?[tT][eE][xX][tT]-\\s*$a:)"; |
2414 |
|
|
$I='[lL][eE][fF][tT]'; |
2415 |
|
|
$C='[cC][eE][nN][tT][eE][rR]'; |
2416 |
|
|
$D='[rR][iI][gG][hH][tT]'; |
2417 |
|
|
$J='[jJ][uU][sS][tT][iI][fF][yY]'; |
2418 |
|
|
$s='[sS][eE][lL][eE][cC][tT]'; |
2419 |
|
|
$F='[fF][oO][nN][tT]'; |
2420 |
|
|
$U='[cC][oO][lL][oO][rR]'; |
2421 |
|
|
s/<\w+[^>]*\s+[iI][dD]\s*=\s*($S)[^>]*>/$&<a name="$+">/g; |
2422 |
|
|
s|<[dD][eE][lL]$R[\w\W]*?</[dD][eE][lL]>||g if($del{'display'}=~/^none$/); |
2423 |
|
|
$ndiv=1; |
2424 |
|
|
s|</?[dD][iI][vV]\d$R||g; |
2425 |
|
|
s|<(/?)([dD][iI][vV])([>\s])|"<$1$2".($1?--$ndiv:$ndiv++).$3|eg; |
2426 |
|
|
while(/<[dD][iI][vV](\d+)$R/) { |
2427 |
|
|
$dbeg=$`; |
2428 |
|
|
$dnum=$1; |
2429 |
|
|
$dattr=$2; |
2430 |
|
|
$dend=$'; |
2431 |
|
|
$div=""; |
2432 |
|
|
$ediv=""; |
2433 |
|
|
if($2=~/class\s*=\s*["']?noprint$R/i) { |
2434 |
|
|
$_=$dbeg; |
2435 |
|
|
$_.=$' if($dend=~/<\/[dD][iI][vV]$dnum>/); |
2436 |
|
|
} else { |
2437 |
|
|
if($dattr=~/$A\s*($I|$C|$D|$J)/) { |
2438 |
|
|
$div.=")".$algn{"\L$2"}." Al("; |
2439 |
|
|
$ediv.=")Ea("; |
2440 |
|
|
} |
2441 |
|
|
if($dattr=~/lang\s*=\s*["']?([a-zA-Z-]+)/i) { |
2442 |
|
|
$lang=lc $1; |
2443 |
|
|
$div.="\004$lang\004"; |
2444 |
|
|
&inihyph if($opt_H); |
2445 |
|
|
$dbeg=~/(\004[^\004]*\004)[^\004]*$/; |
2446 |
|
|
$ediv.=$1; |
2447 |
|
|
} |
2448 |
|
|
$dend=~s|</[dD][iI][vV]$dnum>|$ediv)BR(|; |
2449 |
|
|
$_="$dbeg$div)BR($dend"; |
2450 |
|
|
} |
2451 |
|
|
} |
2452 |
|
|
s|<$C$R|)2 Al(|g; |
2453 |
|
|
s|</$C$R|)Ea(|g; |
2454 |
|
|
s|<(\w+)/([^/]+)/|<$1>$2</$1>|g; |
2455 |
|
|
s/(<\w+[^>]*>)\n|\n(<\/\w+>)/$+/g; |
2456 |
|
|
s|(<[lL][iI])$R\s*<[pP]>|)0 P($1$2|g; |
2457 |
|
|
s/<[hH]([1-6])\s+$A\s*($I|$C|$D|$J)$R/)$algn{"\L$3"} $1 H(/g; |
2458 |
|
|
s|<[hH]([1-6])$R|)0 $1 H(|g; |
2459 |
|
|
s|</[hH][1-6]>|)EH(|g; |
2460 |
|
|
s|<[bB][rR]$R|)BR(|g; |
2461 |
|
|
s/<[pP]\s+[^>]*$A\s*($I|$C|$D|$J)$R/)$algn{"\L$2"} P(/g; |
2462 |
|
|
s|<[pP]$R|)0 P(|g; |
2463 |
|
|
s|</[pP]>|)EP(|g; |
2464 |
|
|
s|<[aA][dD][dD][rR][eE][sS][sS]$R|)AD(|g; |
2465 |
|
|
s|</[aA][dD][dD][rR][eE][sS][sS]>|)DA(|g; |
2466 |
|
|
s|<[pP][rR][eE]$R\n?|)XX(|g; |
2467 |
|
|
s|\n? *</[pP][rR][eE]>|)RP(|g; |
2468 |
|
|
s|<[dD][tT]$R|)DT(|g; |
2469 |
|
|
s|<[dD][dD]$R|)DD(|g; |
2470 |
|
|
s|<[dD][lL]\s[^>]*[cC][oO][mM][pP][aA][cC][tT]$R|)1 DL(|g; |
2471 |
|
|
s|<[dD][lL]$R|)0 DL(|g; |
2472 |
|
|
s|</[dD][lL]>|)LD(|g; |
2473 |
|
|
s|<[uU][lL]$R|)UL(|g; |
2474 |
|
|
s|</[uU][lL]>|)LU(|g; |
2475 |
|
|
s|<[mM][eE][nN][uU]$R|)UL(|g; |
2476 |
|
|
s|</[mM][eE][nN][uU]>|)LU(|g; |
2477 |
|
|
s|<[dD][iI][rR]$R|)UL(|g; |
2478 |
|
|
s|</[dD][iI][rR]>|)LU(|g; |
2479 |
|
|
s|<[oO][lL]\s[^>]*[sS][tT][aA][rR][tT]\s*=\s*['"]?(-?\d+)$R|$&)WB $1 Ln(|g; |
2480 |
|
|
s|<[oO][lL]\s[^>]*[tT][yY][pP][eE]\s*=\s*['"]?([1iIaA])$R|)$lity{$1} OL(|g; |
2481 |
|
|
s|<[oO][lL]$R|)4 OL(|g; |
2482 |
|
|
s|</[oO][lL]>|)LO(|g; |
2483 |
|
|
s|<[lL][iI]\s[^>]*[vV][aA][lL][uU][eE]\s*=\s*['"]?(-?\d+)$R|$&)WB $1 Ln(|g; |
2484 |
|
|
s|<[lL][iI]\s[^>]*[tT][yY][pP][eE]\s*=\s*['"]?($ltr)$R|)$lity{$1} LI(|g; |
2485 |
|
|
s|<[lL][iI]$R|)-1 LI(|g; |
2486 |
|
|
s|</[lL][iI]$R||g; |
2487 |
|
|
s"<([bB][qQ]|[bB][lL][oO][cC][kK][qQ][uU][oO][tT][eE])$R")BQ("g; |
2488 |
|
|
s"</([bB][qQ]|[bB][lL][oO][cC][kK][qQ][uU][oO][tT][eE])>")QB("g; |
2489 |
|
|
s|<[sS][tT][rR][oO][nN][gG]$R|)BD(|g; |
2490 |
|
|
s|</[sS][tT][rR][oO][nN][gG]>|)ES(|g; |
2491 |
|
|
s|<[sS][aA][mM][pP]$R|)SM(|g; |
2492 |
|
|
s|</[sS][aA][mM][pP]>|)ES(|g; |
2493 |
|
|
s|<[qQ]$R(\s*)|$2)Q(|g; |
2494 |
|
|
s|(\s*)</[qQ]>|)EQ($1|g; |
2495 |
|
|
s|<[cC][iI][tT][eE]$R|)CT(|g; |
2496 |
|
|
s|</[cC][iI][tT][eE]>|)ES(|g; |
2497 |
|
|
s|<[vV][aA][rR]$R|)I(|g; |
2498 |
|
|
s|</[vV][aA][rR]>|)ES(|g; |
2499 |
|
|
s|<[bB]$R|)BD(|g; |
2500 |
|
|
s|</[bB]>|)ES(|g; |
2501 |
|
|
s|<[iI]$R|)I(|g; |
2502 |
|
|
s|</[iI]>|)ES(|g; |
2503 |
|
|
s|<[tT][tT]$R|)TT(|g; |
2504 |
|
|
s|</[tT][tT]>|)ES(|g; |
2505 |
|
|
s|<[uU]$R|)UN(|g; |
2506 |
|
|
s|</[uU]>|)NU(|g; |
2507 |
|
|
s|<[sS]([tT][rR][iI][kK][eE])?$R|)SE(|g; |
2508 |
|
|
s|</[sS]([tT][rR][iI][kK][eE])?>|)XE(|g; |
2509 |
|
|
s|<[dD][fF][nN]$R|)I(|g; |
2510 |
|
|
s|</[dD][fF][nN]>|)ES(|g; |
2511 |
|
|
s|<[eE][mM]$R|)EM(|g; |
2512 |
|
|
s|</[eE][mM]>|)ES(|g; |
2513 |
|
|
s|<[cC][oO][dD][eE]$R|)SM(|g; |
2514 |
|
|
s|</[cC][oO][dD][eE]>|)ES(|g; |
2515 |
|
|
s|<[kK][bB][dD]$R|)KB(|g; |
2516 |
|
|
s|</[kK][bB][dD]>|)ES(|g; |
2517 |
|
|
s|<[bB][iI][gG]$R|)4 FZ(|g; |
2518 |
|
|
s|</[bB][iI][gG]>|)ES(|g; |
2519 |
|
|
s|<[sS][mM][aA][lL][lL]$R|)2 FZ(|g; |
2520 |
|
|
s|</[sS][mM][aA][lL][lL]>|)ES(|g; |
2521 |
|
|
s|<[iI][nN][sS]$R|)sM WB(|g; |
2522 |
|
|
s|</[iI][nN][sS]>|)WB eM(|g; |
2523 |
|
|
s|<[dD][eE][lL]$R|)sM $lt(|g; |
2524 |
|
|
s|</[dD][eE][lL]>|)XE eM(|g; |
2525 |
|
|
s|<[aA][cC][rR][oO][nN][yY][mM][^>]+[tT][iI][tT][lL][eE]\s*=\s*($S)[^>]*>|)($+)Ac(|g; |
2526 |
|
|
s|</[aA][cC][rR][oO][nN][yY][mM]>|)Ca(|g; |
2527 |
|
|
s|<[fF][oO][rR][mM][\w\W]*?</[fF][oO][rR][mM]>||g if(!$forms); |
2528 |
|
|
s|</?[fF][oO][rR][mM]$R|)Ts BE(|g; |
2529 |
|
|
s/<$s[^>]*[mM][uU][lL][tT][iI][pP][lL][eE]$R/)1 MS(<table>/g; |
2530 |
|
|
s/<$s$R/)0 MS(<table>/g; |
2531 |
|
|
s|</$s>|</table>|g; |
2532 |
|
|
s/<[oO][pP][tT][iI][oO][nN]$R/<tr><td>)O(/g; |
2533 |
|
|
while(/<[iI][nN][pP][uU][tT]$R/) { |
2534 |
|
|
$beg=$`; |
2535 |
|
|
$iattr=$1; |
2536 |
|
|
$rest=$'; |
2537 |
|
|
$it=2; |
2538 |
|
|
if($iattr=~/type\s*=\s*["']?(\w+)/i) {$it=$it{"\L$1"}}; |
2539 |
|
|
$siz=$iattr=~/size\s*=\s*["']?(\d+)/i?$1:12; |
2540 |
|
|
$it="$siz $it" if($it==2); |
2541 |
|
|
if(defined($it)) { |
2542 |
|
|
$cmd=$it==3?"<img $iattr":")$it BX("; |
2543 |
|
|
} else { |
2544 |
|
|
$cmd=""; |
2545 |
|
|
} |
2546 |
|
|
$_=$beg.$cmd.$rest; |
2547 |
|
|
} |
2548 |
|
|
while(/<[tT][eE][xX][tT][aA][rR][eE][aA]$R/) { |
2549 |
|
|
$beg=$`; |
2550 |
|
|
$txatr=$1; |
2551 |
|
|
$rest=$'; |
2552 |
|
|
if($rest=~m|</[tT][eE][xX][tT][aA][rR][eE][aA]>|) { |
2553 |
|
|
$rest=$'; |
2554 |
|
|
$data=$textarea_data?$`:""; |
2555 |
|
|
$rows=4; |
2556 |
|
|
$cols=20; |
2557 |
|
|
if($txatr=~/rows\s*=\s*["']?(\d+)/i) {$rows=$1}; |
2558 |
|
|
if($txatr=~/cols\s*=\s*["']?(\d+)/i) {$cols=$1}; |
2559 |
|
|
$nl=$data=~y/\n/\n/; |
2560 |
|
|
for ($nl..$rows) {$data.="\n"}; |
2561 |
|
|
$data=~/(.*\n){$rows}/; |
2562 |
|
|
($data=$&)=~s/.*\n/<tr height=24><td valign=top>)0 FZ($&)ES(/g; |
2563 |
|
|
$wi=10*$cols; |
2564 |
|
|
$_="$beg<table border width=$wi cellpadding=2>$data</table>$rest"; |
2565 |
|
|
} else { |
2566 |
|
|
$_=$beg.$rest; |
2567 |
|
|
} |
2568 |
|
|
} |
2569 |
|
|
$nfnt=1; |
2570 |
|
|
s|<(/?)($F)([>\s])|"<$1$2".($1?--$nfnt:$nfnt++).$3|eg; |
2571 |
|
|
while(/<$F(\d+)([^>]*)$U\s*=\s*["']?\s*#?(\w+)$R/) { |
2572 |
|
|
$rgb=&col2rgb($3); |
2573 |
|
|
$_=$`.($rgb?")WB $rgb Sc(":"")."<font$2$4"; |
2574 |
|
|
$temp=$'; |
2575 |
|
|
$temp=~s|</$F$1>|</font>)Ec(| if($rgb); |
2576 |
|
|
$_.=$temp; |
2577 |
|
|
} |
2578 |
|
|
$base{"+"}="Bf add "; |
2579 |
|
|
$base{"-"}="Bf add "; |
2580 |
|
|
s/<$F\d*\s[^>]*[sS][iI][zZ][eE]\s*=\s*["']?([+-]?)(\d+\.?\d*)$R/)$1$2 $base{$1}FZ(/g; |
2581 |
|
|
s|<$F\d*$R|)3 FZ(|g; |
2582 |
|
|
s|</$F\d*>|)Ef(|g; |
2583 |
|
|
s|<[bB][aA][sS][eE]$F\s[^>]*[sS][iI][zZ][eE]\s*=\s*["']?(\d+)$R|)$1 BZ(|g; |
2584 |
|
|
while(/(<[aA]\s+[^>]*)[nN][aA][mM][eE]\s*=\s*(["']?)([^"'\s>]*)$R([^\s<)]*)/) { |
2585 |
|
|
$lnk="$html#$3"; |
2586 |
|
|
$refs{$lnk}=$nref++ unless(defined $refs{$lnk}); |
2587 |
|
|
$_="$`$1$4$5)WB $refs{$lnk} Sn($'"; |
2588 |
|
|
} |
2589 |
|
|
while(/<[aA]\s+[^>]*[hH][rR][eE][fF]\s*=\s*["']?\s*([^"'\s>]*)$R/) { |
2590 |
|
|
$beg=$`; |
2591 |
|
|
$tag=$&; |
2592 |
|
|
$rest=$'; |
2593 |
|
|
$lnk=$1; |
2594 |
|
|
$revtoc=$tag=~/rev\s*=['"]?\s*toc/i; |
2595 |
|
|
$html=~m|[^/]*$|; |
2596 |
|
|
$lnk=~s/^$&#/#/; |
2597 |
|
|
$loc=$lnk=~/^#/; |
2598 |
|
|
if($loc) { |
2599 |
|
|
$html=~m|[^/]*$|; |
2600 |
|
|
$lnk=$&.$lnk; |
2601 |
|
|
} |
2602 |
|
|
if($lnk=~m|.+//[^/]+$|) {$lnk=$&."/"} |
2603 |
|
|
if($lnk=~m|://|) { |
2604 |
|
|
$rlnk=0; |
2605 |
|
|
} else { |
2606 |
|
|
$rlnk=1; |
2607 |
|
|
if($lnk=~m|^/|) {$lnk=$b1.$lnk} elsif($lnk!~m|^\w+:|) {$lnk=$b2.$lnk}; |
2608 |
|
|
} |
2609 |
|
|
while($lnk!~m|^\.\./| && $lnk=~m|[^/]*/\.\./|) {$lnk=$`.$'}; |
2610 |
|
|
$lnk=~s"(^|/)\./"$1"g; |
2611 |
|
|
($doc)=$lnk=~/([^#]*)/; |
2612 |
|
|
($doctit{$doc})=$tag=~/title\s*=['"]([^'"]*)['"]/i; |
2613 |
|
|
$T=0; |
2614 |
|
|
$anch=2; |
2615 |
|
|
if($loc || $opt_W && !$link && $level<=$maxlev && &follow){ |
2616 |
|
|
$refs{$lnk}=$nref++ unless(defined $refs{$lnk}); |
2617 |
|
|
$anch="$refs{$lnk} 1"; |
2618 |
|
|
$ltype=$rev && $revtoc && $ndoc==1 || $opt_C=~/f/ && $ndoc==1?1:0; |
2619 |
|
|
$rest=~s|</a>|)$refs{$lnk} $ltype TN TL()Ec /AF f D(|i; |
2620 |
|
|
if(&follow && !$levl{$doc}) { |
2621 |
|
|
&dbg("Link: $doc\n") if($opt_d); |
2622 |
|
|
$levl{$doc}=$level+1; |
2623 |
|
|
push(@links,$doc); |
2624 |
|
|
} |
2625 |
|
|
} elsif(defined $refs{$lnk} || grep(/^$doc$/,(@docs,@links))) { |
2626 |
|
|
$refs{$lnk}=$nref++ unless(defined $refs{$lnk}); |
2627 |
|
|
$anch="$refs{$lnk} 1"; |
2628 |
|
|
} |
2629 |
|
|
$addr=$dum{$lnk}?"R$dum{$lnk}":0; |
2630 |
|
|
if(!$dum{$lnk} && $lnk=~m|://|) { |
2631 |
|
|
$dum{$lnk}=$nlnk++; |
2632 |
|
|
$rfs.="/R$dum{$lnk} ($lnk) D\n"; |
2633 |
|
|
$addr="R$dum{$lnk}"; |
2634 |
|
|
} |
2635 |
|
|
$_=$beg.")$addr $anch A(".$rest; |
2636 |
|
|
} |
2637 |
|
|
s|</[aA]>|)EA(|g; |
2638 |
|
|
if((!$mult || $doc_sep eq $pc && $mult) |
2639 |
|
|
&& m|<[bB][aA][nN][nN][eE][rR]$R([\w\W]*)</[bB][aA][nN][nN][eE][rR]>|) { |
2640 |
|
|
$banner=$2; |
2641 |
|
|
$_=$`.$'; |
2642 |
|
|
} |
2643 |
|
|
while(/<[tT][aA][bB][lL][eE]([^>]*)>/) { |
2644 |
|
|
local($beg)=$`; |
2645 |
|
|
local($rest)=$'; |
2646 |
|
|
$tattr=$1; |
2647 |
|
|
$tag=$&; |
2648 |
|
|
$rest=~/(<\/[tT][aA][bB][lL][eE]>|$)/; |
2649 |
|
|
$table=$`; |
2650 |
|
|
$rest=$'; |
2651 |
|
|
while($table=~/<[tT][aA][bB][lL][eE]([^>]*)>/) { |
2652 |
|
|
$tattr=$1; |
2653 |
|
|
$table=$'; |
2654 |
|
|
$beg.=$tag.$`; |
2655 |
|
|
$tag=$&; |
2656 |
|
|
} |
2657 |
|
|
($tla)=$tattr=~/lang\s*=\s*["']?([a-zA-Z-]+)/i; |
2658 |
|
|
if(!$tla) {($tla)=$beg=~/\004_?([^\004]*)\004[^\004]*$/}; |
2659 |
|
|
$ntab++; |
2660 |
|
|
$table=~s/^\s*//; |
2661 |
|
|
undef %cells; |
2662 |
|
|
undef %rd; |
2663 |
|
|
undef @cali; |
2664 |
|
|
undef @cval; |
2665 |
|
|
undef @cgrp; |
2666 |
|
|
undef @cwid; |
2667 |
|
|
undef @codc; |
2668 |
|
|
undef @r0; |
2669 |
|
|
undef @c0; |
2670 |
|
|
($capat,$cap)=$table=~m|<caption$R([\w\W]*)</caption>|i; |
2671 |
|
|
$capat=~/ALIGN\s*=\s*["']?\s*(\w+)/i; |
2672 |
|
|
$capa=0; |
2673 |
|
|
$capa=1 if("\L$1" eq "bottom"); |
2674 |
|
|
$capa=-1 if($cap!~/\S/); |
2675 |
|
|
$bord=0; |
2676 |
|
|
if($tattr=~/border/i) { |
2677 |
|
|
($bord)=$'=~/^\s*=\s*["']?(\d+)/; |
2678 |
|
|
if(!$bord && $bord ne "0") {$bord=1}; |
2679 |
|
|
} |
2680 |
|
|
($talgn)=$tattr=~/ALIGN\s*=\s*["']?\s*(\w+)/i; |
2681 |
|
|
$tal=-1; |
2682 |
|
|
$tal=0 if($talgn=~/^left$/i); |
2683 |
|
|
$tal=1 if($talgn=~/^center$/i); |
2684 |
|
|
$tal=2 if($talgn=~/^right$/i); |
2685 |
|
|
($fra)=$tattr=~/FRAME\s*=\s*["']?\s*(\w+)/i; |
2686 |
|
|
if($fra && $f{"\L$fra"}) {$fra=$f{"\L$fra"}} else {$fra=$bord?9:1}; |
2687 |
|
|
($rul)=$tattr=~/RULES\s*=\s*["']?\s*(\w+)/i; |
2688 |
|
|
if($rul && $r{"\L$rul"}) {$rul=$r{"\L$rul"}} else {$rul=$bord?5:1}; |
2689 |
|
|
unless(($twid)=$tattr=~/WIDTH\s*=\s*["']?(\d+\.?\d*%?)/i) {$twid=0}; |
2690 |
|
|
$twid=$twid=~/%$/?$`/100:-$twid; |
2691 |
|
|
($cpad)=$tattr=~/CELLPADDING\s*=\s*["']?\s*$V/i; |
2692 |
|
|
if($tattr=~/CELLSPACING\s*=\s*["']?\s*$V/i && $1!=0) {$cpad+=$1/2}; |
2693 |
|
|
($tbg)=$tattr=~/BGCOLOR\s*=\s*["']?\s*#?(\w+)/i; |
2694 |
|
|
$tbg=&col2rgb($tbg); |
2695 |
|
|
($tcl)=$tattr=~/CLASS\s*=\s*["']?\s*(\w+)/i; |
2696 |
|
|
$tcl="\L$tcl" eq "telelista"? 1: 0; |
2697 |
|
|
$ic=0; |
2698 |
|
|
$span=1; |
2699 |
|
|
undef $gal; |
2700 |
|
|
undef $gva; |
2701 |
|
|
undef $odc; |
2702 |
|
|
undef $gwi; |
2703 |
|
|
$cgs=0; |
2704 |
|
|
while($table=~/<[cC][oO][lL]([^>]*>)/g && $span>0) { |
2705 |
|
|
$cola=$1; |
2706 |
|
|
$ab=$`; |
2707 |
|
|
$aft=$'; |
2708 |
|
|
$cola=~/(^|\s)ALIGN\s*=\s*["']?\s*(\w+)/i; |
2709 |
|
|
$alg=$algn{"\L$2"}; |
2710 |
|
|
($val)=$cola=~/VALIGN\s*=\s*["']?\s*(\w+)/i; |
2711 |
|
|
$val=$v{"\L$val"}; |
2712 |
|
|
($odc)=$cola=~/CHAR\s*=\s*["']?(.)/i; |
2713 |
|
|
unless(($wid)=$cola=~/WIDTH\s*=\s*["'](\d+%?)/i) {$wid=0}; |
2714 |
|
|
if($wid=~/%$/) {$wid=$`/100}; |
2715 |
|
|
($span)=$cola=~/SPAN\s*=\s*["']?\s*(\d+)/i; |
2716 |
|
|
if(!$span && $span ne "0") {$span=1}; |
2717 |
|
|
$us=1; |
2718 |
|
|
if($cola=~/^GROUP/i) { |
2719 |
|
|
$gal=$alg; |
2720 |
|
|
$gva=$val; |
2721 |
|
|
$gdc=$odc; |
2722 |
|
|
$gwi=$wid; |
2723 |
|
|
$cgs=1; |
2724 |
|
|
if($aft=~/<COL\s/i) { |
2725 |
|
|
$us=$`=~m|</?COLGROUP|i; |
2726 |
|
|
} |
2727 |
|
|
} else { |
2728 |
|
|
while($ab=~/<COLGROUP/i) {$ab=$'}; |
2729 |
|
|
if($ab=~m|</COLGROUP|i) { |
2730 |
|
|
undef $gal; |
2731 |
|
|
undef $gva; |
2732 |
|
|
undef $odc; |
2733 |
|
|
undef $gwi; |
2734 |
|
|
} |
2735 |
|
|
if(!$alg) {$alg=$gal}; |
2736 |
|
|
if(!$val) {$val=$gva}; |
2737 |
|
|
if(!$odc) {$odc=$gdc}; |
2738 |
|
|
if(!$wid) {$wid=$gwi}; |
2739 |
|
|
if($span eq "0") { |
2740 |
|
|
$ic++; |
2741 |
|
|
push(@cali,$alg); |
2742 |
|
|
push(@cval,$val); |
2743 |
|
|
push(@cwid,$wid); |
2744 |
|
|
push(@codc,$odc); |
2745 |
|
|
push(@cgrp,1); |
2746 |
|
|
} |
2747 |
|
|
} |
2748 |
|
|
if($us) { |
2749 |
|
|
for (1..$span) { |
2750 |
|
|
$ic++; |
2751 |
|
|
push(@cali,$alg); |
2752 |
|
|
push(@cval,$val); |
2753 |
|
|
push(@cwid,$wid); |
2754 |
|
|
push(@codc,$odc); |
2755 |
|
|
push(@cgrp,$cgs); |
2756 |
|
|
$cgs=0; |
2757 |
|
|
} |
2758 |
|
|
} |
2759 |
|
|
} |
2760 |
|
|
$table=~/<t[hd][\s>]/i; |
2761 |
|
|
if($`!~/<tr/i) {$table="<TR>$table"}; |
2762 |
|
|
$nrow=-1; |
2763 |
|
|
$ncol=-1; |
2764 |
|
|
$nhead=0; |
2765 |
|
|
$nfoot=0; |
2766 |
|
|
$nb=0; |
2767 |
|
|
unless($table=~/<tbody$R/i || $table=~s|</tfoot>|$&<tbody>|i) { |
2768 |
|
|
$table=~s|</thead>|$&<tbody>|i; |
2769 |
|
|
} |
2770 |
|
|
while($table=~/<[tT][rR]\s*([^>]*)>/g) { |
2771 |
|
|
$nrow++; |
2772 |
|
|
$ab=$`; |
2773 |
|
|
$row=$'; |
2774 |
|
|
$rattr=$1; |
2775 |
|
|
for $j (@c0) { |
2776 |
|
|
$cells{"$nrow,$j,0"}=1; |
2777 |
|
|
} |
2778 |
|
|
$rgrp=0; |
2779 |
|
|
if($ab=~/<tbody$R/i) { |
2780 |
|
|
$ib=0; |
2781 |
|
|
while($ab=~/<[tT][bB][oO][dD][yY]$R/g) { |
2782 |
|
|
$ib++; |
2783 |
|
|
$battr=$1; |
2784 |
|
|
if($ib>$nb) { |
2785 |
|
|
$rgrp=1; |
2786 |
|
|
$nb=$ib; |
2787 |
|
|
} |
2788 |
|
|
} |
2789 |
|
|
} else { |
2790 |
|
|
if($ab=~/<tfoot$R/i) { |
2791 |
|
|
$nfoot++; |
2792 |
|
|
$battr=$1; |
2793 |
|
|
} elsif($ab=~/<thead$R/i) { |
2794 |
|
|
$nhead++; |
2795 |
|
|
$battr=$1; |
2796 |
|
|
} |
2797 |
|
|
} |
2798 |
|
|
$battr=~/(^|\s)ALIGN\s*=\s*["']?\s*(\w+)/i; |
2799 |
|
|
$balgn=$algn{"\L$2"}; |
2800 |
|
|
$battr=~/VALIGN\s*=\s*["']?\s*(\w+)/i; |
2801 |
|
|
$bva=$v{"\L$1"}; |
2802 |
|
|
($bdc)=$battr=~/CHAR\s*=\s*["']?(.)/i; |
2803 |
|
|
$rd{"$nrow,0"}=0; |
2804 |
|
|
$rd{"$nrow,1"}=0; |
2805 |
|
|
$rd{"$nrow,2"}=0 unless($rd{"$nrow,2"}); |
2806 |
|
|
$rd{"$nrow,3"}=$rgrp; |
2807 |
|
|
$rattr=~/(^|\s)ALIGN\s*=\s*["']?\s*(\w+)/i; |
2808 |
|
|
$ralgn=$algn{"\L$2"}; |
2809 |
|
|
$rattr=~/VALIGN\s*=\s*["']?\s*(\w+)/i; |
2810 |
|
|
$rva=$v{"\L$1"}; |
2811 |
|
|
($rla[$nrow])=$rattr=~/lang\s*=\s*["']?([a-zA-Z-]+)/i; |
2812 |
|
|
($rbg)=$rattr=~/BGCOLOR\s*=\s*["']?\s*#?(\w+)/i; |
2813 |
|
|
$rbg[$nrow]=&col2rgb($rbg); |
2814 |
|
|
($rdc)=$rattr=~/CHAR\s*=\s*["']?(.)/i; |
2815 |
|
|
if($row=~/<tr/i) {$row=$`}; |
2816 |
|
|
$rh[$nrow]=$rattr=~/HEIGHT\s*=\s*["']?(\d+)/i?$1:0; |
2817 |
|
|
$icol=0; |
2818 |
|
|
$colsp=1; |
2819 |
|
|
while($row=~/<[tT]([hH]|[dD])(\s*[^>]*)>/g && $colsp>0) { |
2820 |
|
|
$cattr=$2; |
2821 |
|
|
$cell=$'; |
2822 |
|
|
$ctype=$1=~/h/i?1:0; |
2823 |
|
|
if($cell=~/<t[hd]/i) {$cell=$`}; |
2824 |
|
|
$cell=~s/\s+$//; |
2825 |
|
|
$cell=~s/\)HY\($/\255/; |
2826 |
|
|
$cell=~s/[\200-\377]([^\\]|\\20.)/$&)WB(/g if(!$latin1); |
2827 |
|
|
($rowsp)=$cattr=~/ROWSPAN\s*=\s*["']?(\d+)/i; |
2828 |
|
|
$rsp=$rowsp; |
2829 |
|
|
if(!$rsp) { |
2830 |
|
|
if($rsp eq "0") { |
2831 |
|
|
push(@c0,$icol); |
2832 |
|
|
} else { |
2833 |
|
|
$rowsp=1; |
2834 |
|
|
} |
2835 |
|
|
$rsp=1; |
2836 |
|
|
} |
2837 |
|
|
($colsp)=$cattr=~/COLSPAN\s*=\s*["']?(\d+)/i; |
2838 |
|
|
$csp=$colsp; |
2839 |
|
|
if(!$csp) { |
2840 |
|
|
if($csp eq "0") { |
2841 |
|
|
push(@r0,$nrow); |
2842 |
|
|
$csp=$ncol-$icol<0? 1: $ncol-$icol+1; |
2843 |
|
|
} else { |
2844 |
|
|
$colsp=1; |
2845 |
|
|
$csp=1; |
2846 |
|
|
} |
2847 |
|
|
} |
2848 |
|
|
($cdc)=$cattr=~/CHAR\s*=\s*["']?(.)/i; |
2849 |
|
|
while($cells{"$nrow,$icol,0"}==1) {$icol++}; |
2850 |
|
|
# |
2851 |
|
|
for $i ($nrow..$nrow+$rsp-2) {$rd{"$i,2"}=1}; |
2852 |
|
|
for $j ($icol..$icol+$csp-1) { |
2853 |
|
|
for $i ($nrow..$nrow+$rsp-1) { |
2854 |
|
|
$cells{"$i,$j,0"}=1; |
2855 |
|
|
} |
2856 |
|
|
} |
2857 |
|
|
if($colsp) { |
2858 |
|
|
for $j ($ncol+1..$icol+$csp) { |
2859 |
|
|
for $i (@r0) { |
2860 |
|
|
$cells{"$i,$j,0"}=1; |
2861 |
|
|
} |
2862 |
|
|
} |
2863 |
|
|
} |
2864 |
|
|
if($ic<$icol+$csp) { |
2865 |
|
|
for ($ic..$icol+$csp-1) { |
2866 |
|
|
push(@cali,$cali[$ic-1]); |
2867 |
|
|
push(@cval,$cval[$ic-1]); |
2868 |
|
|
push(@cgrp,0); |
2869 |
|
|
} |
2870 |
|
|
$ic=$icol+$csp; |
2871 |
|
|
} |
2872 |
|
|
$cal=$ctype; |
2873 |
|
|
$cal=$balgn-1 if($balgn); |
2874 |
|
|
$cal=$ralgn-1 if($ralgn); |
2875 |
|
|
$cal=$cali[$icol]-1 if($cali[$icol]); |
2876 |
|
|
if($cattr=~/(^|\s)ALIGN\s*=\s*["']?\s*(\w+)/i) { |
2877 |
|
|
$cal=$algn{"\L$2"}-1 if($algn{"\L$2"}); |
2878 |
|
|
} |
2879 |
|
|
$cvl=2; |
2880 |
|
|
$cvl=$cval[$icol] if($cval[$icol]); |
2881 |
|
|
$cvl=$bva if($bva); |
2882 |
|
|
$cvl=$rva if($rva); |
2883 |
|
|
if($cattr=~/VALIGN\s*=\s*["']?\s*(\w+)/i) { |
2884 |
|
|
$cvl=$v{"\L$1"} if($v{"\L$1"}); |
2885 |
|
|
} |
2886 |
|
|
($cbg)=$cattr=~/BGCOLOR\s*=\s*["']?\s*#?(\w+)/i; |
2887 |
|
|
$cbg=&col2rgb($cbg); |
2888 |
|
|
for($rbg[$nrow],$tbg,$deftbg,$bg) {$cbg=$_ if(!$cbg)}; |
2889 |
|
|
$now=0; |
2890 |
|
|
if($cattr=~/NOWRAP/i || $cal==4) {$now=1}; |
2891 |
|
|
$dc="."; |
2892 |
|
|
$dc=$bdc if($bdc || $bdc eq "0"); |
2893 |
|
|
$dc=$rdc if($rdc || $rdc eq "0"); |
2894 |
|
|
$dc=$codc[$icol] if($codc[$icol] || $codc[$icol] eq "0"); |
2895 |
|
|
$dc=$cdc if($cdc || $cdc eq "0"); |
2896 |
|
|
($wid)=$cattr=~/WIDTH\s*=\s*["'](\d+%)/i; |
2897 |
|
|
if($wid=~/%$/) {$wid=$`/100}; |
2898 |
|
|
if($wid>$cwid[$icol]) {$cwid[$icol]=$wid}; |
2899 |
|
|
if($cpad || $cpad eq "0") { |
2900 |
|
|
$clm=$cpad; |
2901 |
|
|
$crm=$cpad; |
2902 |
|
|
$ctm=$cpad; |
2903 |
|
|
$cbm=$cpad; |
2904 |
|
|
} else { |
2905 |
|
|
$clm=$rul<5?8:4; |
2906 |
|
|
$crm=$rul<5?8:4; |
2907 |
|
|
$ctm=2; |
2908 |
|
|
$cbm=6; |
2909 |
|
|
} |
2910 |
|
|
if($tcl==1) { |
2911 |
|
|
$clm=$icol>0?12:2; |
2912 |
|
|
$crm=12; |
2913 |
|
|
$ctm=0; |
2914 |
|
|
$cbm=0; |
2915 |
|
|
} |
2916 |
|
|
if($rul==1 && $fra==1 && $icol==0 && $tal==0) {$clm=0}; |
2917 |
|
|
($lang)=$cattr=~/lang\s*=\s*["']?([a-zA-Z-]+)/i; |
2918 |
|
|
for($rla[$nrow],$tla) {$lang=$_ if(!$lang)}; |
2919 |
|
|
$lang=lc $lang; |
2920 |
|
|
&inihyph if($opt_H); |
2921 |
|
|
$cbg=~/#(\w+).*#(\w+).*#(\w+)/; |
2922 |
|
|
&img($cell,$1,$2,$3); |
2923 |
|
|
@cll=("{(\004$lang\004)WB($cell)}",0,0,$ctype,0,$colsp,$rowsp,$cal, |
2924 |
|
|
"($dc)",$cvl,$now,$clm,$crm,$ctm,$cbm,0,0,0,0,$cbg); |
2925 |
|
|
for $i (0..$#cll) {$cells{"$nrow,$icol,$i"}=$cll[$i]}; |
2926 |
|
|
$icol+=$csp; |
2927 |
|
|
if($icol-1>$ncol) {$ncol=$icol-1}; |
2928 |
|
|
} |
2929 |
|
|
} |
2930 |
|
|
for $j (0..$ncol) { |
2931 |
|
|
for $i (0..$nrow) { |
2932 |
|
|
if($cells{"$i,$j,0"} && $cells{"$i,$j,0"}!=1) { |
2933 |
|
|
if($cells{"$i,$j,6"}>$nrow-$i+1) {$cells{"$i,$j,6"}=$nrow-$i+1}; |
2934 |
|
|
if($cells{"$i,$j,6"}>1) {$rd{"$i,2"}=1}; |
2935 |
|
|
} |
2936 |
|
|
} |
2937 |
|
|
} |
2938 |
|
|
$rd{"$nrow,2"}=0; |
2939 |
|
|
$rw="["; |
2940 |
|
|
for $i (0..$nrow) { |
2941 |
|
|
$rw.="[$rh[$i] ".$rd{"$i,1"}." ".$rd{"$i,2"}." ".$rd{"$i,3"}." 0 0 ["; |
2942 |
|
|
for $j (0..$ncol) { |
2943 |
|
|
$cbg=""; |
2944 |
|
|
for($rbg[$i],$tbg,$deftbg,$bg) {$cbg=$_ if(!$cbg)}; |
2945 |
|
|
$temp="[{()} 0 0 0 0 1 1 0 (.) 0 0 $clm $crm $ctm $cbm 0 0 0 0 $cbg]"; |
2946 |
|
|
if($cells{"$i,$j,0"}==1) { |
2947 |
|
|
$temp="0"; |
2948 |
|
|
} elsif($cells{"$i,$j,0"}) { |
2949 |
|
|
$temp="["; |
2950 |
|
|
for $k (0..$#cll) { |
2951 |
|
|
$temp.=$cells{"$i,$j,$k"}." "; |
2952 |
|
|
} |
2953 |
|
|
$temp.="]"; |
2954 |
|
|
} |
2955 |
|
|
$rw.="$temp\n"; |
2956 |
|
|
} |
2957 |
|
|
$rw.="]]\n"; |
2958 |
|
|
} |
2959 |
|
|
if($nrow==$nhead+$nfoot-1) { |
2960 |
|
|
$nhead=0; |
2961 |
|
|
$nfoot=0; |
2962 |
|
|
} |
2963 |
|
|
$tdesc="[0 0 $tcl 0 0 $tal 0 $twid $bord $nrow $ncol" |
2964 |
|
|
." $nhead $nfoot $fra $rul {($cap)} $capa]\n"; |
2965 |
|
|
$cdesc="["; |
2966 |
|
|
for (0..$ncol) { |
2967 |
|
|
unless($wid=$cwid[$_]) {$wid=0}; |
2968 |
|
|
$cdesc.="[0 0 0 $wid $cgrp[$_] 0 0]"; |
2969 |
|
|
} |
2970 |
|
|
$cdesc.="]\n"; |
2971 |
|
|
$tables.="[$tdesc $cdesc $rw]]\n"; |
2972 |
|
|
$_=$beg.")$ntab PT(".$rest; |
2973 |
|
|
} |
2974 |
|
|
&img($_,$red,$grn,$blu); |
2975 |
|
|
&ack($_); |
2976 |
|
|
$_[0]=$_; |
2977 |
|
|
} |
2978 |
|
|
sub getcom{ |
2979 |
|
|
$com=$&; |
2980 |
|
|
$'=~/--\s*(--|>)/; |
2981 |
|
|
$com.=$`.$&; |
2982 |
|
|
$rest=$'; |
2983 |
|
|
while($1 eq "--") { |
2984 |
|
|
if($'!~/--\s*(--|>)/) {$'=~/(>)/}; |
2985 |
|
|
$com.=$`.$&; |
2986 |
|
|
$rest=$'; |
2987 |
|
|
} |
2988 |
|
|
} |
2989 |
|
|
sub getl { |
2990 |
|
|
($l)=@_; |
2991 |
|
|
if(!$lid{$l}) { |
2992 |
|
|
while($l=~s/-[^-]+$// && !$lid{$l}) {}; |
2993 |
|
|
} |
2994 |
|
|
$lid{$l}; |
2995 |
|
|
} |
2996 |
|
|
sub ack { |
2997 |
|
|
local($_)=@_; |
2998 |
|
|
chdir $tempdir; |
2999 |
|
|
while (/<[mM][aA][tT][hH]/) { |
3000 |
|
|
$beg=$`; |
3001 |
|
|
$rest=$&.$'; |
3002 |
|
|
$rest=~m|</[mM][aA][tT][hH]>|; |
3003 |
|
|
$end=$'; |
3004 |
|
|
$math=$`; |
3005 |
|
|
if(&math2sym($math)) { |
3006 |
|
|
$_=$beg.$sym.$end; |
3007 |
|
|
} elsif($package{'TeX'} && $package{'dvips'}) { |
3008 |
|
|
$math=~s|\\200|\\|g; |
3009 |
|
|
$math=~s|\\201|\(|g; |
3010 |
|
|
$math=~s|\\202|\)|g; |
3011 |
|
|
&math2tex($math); |
3012 |
|
|
open(SCRATCH,">$scr.tex"); |
3013 |
|
|
print SCRATCH $tex; |
3014 |
|
|
close SCRATCH; |
3015 |
|
|
`tex $scr.tex`; |
3016 |
|
|
`dvips -E $scr.dvi`; |
3017 |
|
|
open(LOG,"$scr.log"); |
3018 |
|
|
$log=<LOG>; |
3019 |
|
|
close LOG; |
3020 |
|
|
($h,$d)=$log=~/[\w\W]*$prog: +([\d.]+)pt: +([\d.]+)/ ? ($1,$2) : (1,0); |
3021 |
|
|
$above=$h+$d>0?sprintf("%.4f",$h/($h+$d)):0; |
3022 |
|
|
open(PS,"$scr.ps"); |
3023 |
|
|
$pic=<PS>; |
3024 |
|
|
if($pic=~/^%!/ && $pic=~/%%BoundingBox: +$V +$V +$V +$V/) { |
3025 |
|
|
$xs=$3-$1; |
3026 |
|
|
$ys=$4-$2; |
3027 |
|
|
$llx=$1; |
3028 |
|
|
$lly=$2; |
3029 |
|
|
$ps=""; |
3030 |
|
|
for $i (split(/\n/,$pic)) { |
3031 |
|
|
$ps.=$i."\n" if($i && $i!~/^%/); |
3032 |
|
|
} |
3033 |
|
|
if($ps=~/\nTeXDict begin/) { |
3034 |
|
|
if(!$ph) { |
3035 |
|
|
$ph="/DH {1 F div dup scale /showpage {} D\n$`$&} D\n%EndDH\n"; |
3036 |
|
|
$pv=$ph.$pv; |
3037 |
|
|
} |
3038 |
|
|
$ps="save -$llx -$lly translate\nDH$' restore"; |
3039 |
|
|
} |
3040 |
|
|
} |
3041 |
|
|
$nimg++; |
3042 |
|
|
$nps--; |
3043 |
|
|
push(@XS,$xs); |
3044 |
|
|
push(@YS,$ys); |
3045 |
|
|
push(@IX,$nps); |
3046 |
|
|
push(@IT,2); |
3047 |
|
|
$pv.="/P$nimg {$ps} D\n"; |
3048 |
|
|
$eps{"P$nimg"}=$ps; |
3049 |
|
|
$_=$beg.")$above 3 (P$nimg) $nimg IM(".$end; |
3050 |
|
|
} else { |
3051 |
|
|
$math=~s/<math$R//i; |
3052 |
|
|
$_=$beg.$math.$end; |
3053 |
|
|
} |
3054 |
|
|
} |
3055 |
|
|
chdir $cwd; |
3056 |
|
|
s|<[sS][uU][bB]$R|)Sb(|g; |
3057 |
|
|
s|<[sS][uU][pP]$R|)Sp(|g; |
3058 |
|
|
s"</[sS][uU]([bB]|[pP])>")Es("g; |
3059 |
|
|
s|<[A-Za-z/!?]\w*$R||g; |
3060 |
|
|
&ent($_); |
3061 |
|
|
y/\003/>/; |
3062 |
|
|
s/\004([^\004]*)\004/")".&getl($1)." Sl($&"/eg; |
3063 |
|
|
if($opt_H) { |
3064 |
|
|
&dbg("Inserting potential hyphenation points\n") if($opt_d && $ndoc>0); |
3065 |
|
|
$temp=""; |
3066 |
|
|
while(/\004([^\004]*)\004/) { |
3067 |
|
|
$temp.=$`; |
3068 |
|
|
$lang=$1; |
3069 |
|
|
$end=$'; |
3070 |
|
|
if($end=~/\004([^\004]*)\004/) { |
3071 |
|
|
$htext=$`; |
3072 |
|
|
$end=$&.$'; |
3073 |
|
|
} else { |
3074 |
|
|
$htext=$end; |
3075 |
|
|
$end=""; |
3076 |
|
|
} |
3077 |
|
|
$apa=""; |
3078 |
|
|
while($htext=~/(..?)\(([^)]*)/) { |
3079 |
|
|
$slut=$'; |
3080 |
|
|
if($1 eq "XX") { |
3081 |
|
|
$apa.=$`.$&; |
3082 |
|
|
if($'=~/RP\(/) { |
3083 |
|
|
$apa.=$`; |
3084 |
|
|
$htext=$&.$'; |
3085 |
|
|
} else { |
3086 |
|
|
$apa.=$slut; |
3087 |
|
|
$htext=""; |
3088 |
|
|
} |
3089 |
|
|
} elsif($1 eq ") ") { |
3090 |
|
|
$apa.=$`.$&; |
3091 |
|
|
$htext=$'; |
3092 |
|
|
} else { |
3093 |
|
|
$apa.="$`$1("; |
3094 |
|
|
$htext=$'; |
3095 |
|
|
($txt=$2)=~s/[$ltrs]{$hyphenation{'min'},}/&hyph($&)/eg; |
3096 |
|
|
$apa.=$txt; |
3097 |
|
|
} |
3098 |
|
|
} |
3099 |
|
|
$_=$apa.$slut.$end; |
3100 |
|
|
} |
3101 |
|
|
$_=$temp.$_; |
3102 |
|
|
} |
3103 |
|
|
s/\004([^\004]*)\004//g; |
3104 |
|
|
$_[0]=$_; |
3105 |
|
|
} |
3106 |
|
|
sub ent { |
3107 |
|
|
local($_)=@_; |
3108 |
|
|
for $char (keys %ent) {s/&($char)(;|$|(?=\W))/chr($ent{$char})/eg}; |
3109 |
|
|
for $char (keys %symb) {s/&($char)(;|$|(?=\W))/)SY(\\$symb{$char})ES(/g}; |
3110 |
|
|
s|<?|<|g; |
3111 |
|
|
s|>?|>|g; |
3112 |
|
|
s|"?|"|g; |
3113 |
|
|
s/&($space);?/)$space{$1} Se(/g; |
3114 |
|
|
s|&#x($X+);?|"&#".hex($1).";"|eg; |
3115 |
|
|
s|&#(\d+);?|$1==38?"\005":$1<256?chr($1):$&|eg; |
3116 |
|
|
s/(\005|&?)/\&/g; |
3117 |
|
|
$_[0]=$_; |
3118 |
|
|
} |
3119 |
|
|
sub spec { |
3120 |
|
|
$_[0]=~s/(\\|\(;|$|(?=\W)))/\\200/g; |
3121 |
|
|
$_[0]=~s/(\(|((;|$|(?=\W)))/\\201/g; |
3122 |
|
|
$_[0]=~s/(\)|)(;|$|(?=\W)))/\\202/g; |
3123 |
|
|
$_[0]=~s/&(there4|#8756)(;|$|(?=\W))/)SY(\\200)ES(/g; |
3124 |
|
|
} |
3125 |
|
|
sub math2tex { |
3126 |
|
|
local($_)=@_; |
3127 |
|
|
local($beg,$rest); |
3128 |
|
|
%a=("line","overline", |
3129 |
|
|
"cub","overbrace", |
3130 |
|
|
"hat","widehat", |
3131 |
|
|
"tilde","widetilde", |
3132 |
|
|
"larr", "overleftarrow", |
3133 |
|
|
"rarr", "overrightarrow"); |
3134 |
|
|
%b=("line","underline", |
3135 |
|
|
"cub","underbrace", |
3136 |
|
|
"hat","widehat", |
3137 |
|
|
"tilde","widetilde"); |
3138 |
|
|
%s=("medium","\\big", |
3139 |
|
|
"large","\\Big", |
3140 |
|
|
"huge","\\bigg"); |
3141 |
|
|
($mattr)=/<math$R/i; |
3142 |
|
|
$st=$mattr=~/class\s*=\s*["']?chem/i?'\rm ':''; |
3143 |
|
|
$di=$mattr=~/class\s*=\s*["']?displayed/i?'\displaystyle ':''; |
3144 |
|
|
s/<math$R//gi; |
3145 |
|
|
s/\\/\\backslash/g; |
3146 |
|
|
s/__/_\\>_/gi; |
3147 |
|
|
s/\^\^/^\\>^/gi; |
3148 |
|
|
s/_([^_]+)_/_{$1}/g; |
3149 |
|
|
s/\^([^^]+)\^/^{$1}/g; |
3150 |
|
|
s/ ?/\\,/g; |
3151 |
|
|
s/&sp;?/\\>/g; |
3152 |
|
|
s/ ?/\\;/g; |
3153 |
|
|
s/ ?/\\>/g; |
3154 |
|
|
s/ε?/\\varepsilon /g; |
3155 |
|
|
s/υ?/\\upsilon /g; |
3156 |
|
|
s/ϖ?/\\varpi /g; |
3157 |
|
|
s/ς?/\\varsigma /g; |
3158 |
|
|
s/ϑ?/\\vartheta /g; |
3159 |
|
|
s/ϕ?/\\varphi /g; |
3160 |
|
|
s/ϒ?/\\Upsilon /g; |
3161 |
|
|
s/ο?/o/g; |
3162 |
|
|
s/±?/\\pm /g; |
3163 |
|
|
s/∨?/\\vee /g; |
3164 |
|
|
s/∧?/\\wedge /g; |
3165 |
|
|
s/≈?/\\approx /g; |
3166 |
|
|
s/⊆?/\\subseteq /g; |
3167 |
|
|
s/⊂?/\\subset /g; |
3168 |
|
|
s/⊇?/\\supseteq /g; |
3169 |
|
|
s/⊃?/\\supset /g; |
3170 |
|
|
s/∈?/\\in /g; |
3171 |
|
|
s/←?/\\leftarrow /g; |
3172 |
|
|
s/→?([_^])/\\mathop\\rightarrow\\limits$1 /g; |
3173 |
|
|
s/→?/\\rightarrow /g; |
3174 |
|
|
s/↑?/\\uparrow /g; |
3175 |
|
|
s/↓?/\\downarrow /g; |
3176 |
|
|
s/↔?/\\leftrightarrow /g; |
3177 |
|
|
s/⇐?/\\Leftarrow /g; |
3178 |
|
|
s/⇒?/\\Rightarrow /g; |
3179 |
|
|
s/⇑?/\\Uparrow /g; |
3180 |
|
|
s/⇓?/\\Downarrow /g; |
3181 |
|
|
s/∃?/\\exists /g; |
3182 |
|
|
s/&inf;?/\\infty /g; |
3183 |
|
|
s/&?int;?/\\int\\limits /g; |
3184 |
|
|
s/&?sum;?/\\sum\\limits /g; |
3185 |
|
|
s/&?prod;?/\\prod\\limits /g; |
3186 |
|
|
s/&pd;?/\\partial /g; |
3187 |
|
|
s/{?/\\{/g; |
3188 |
|
|
s/}?/\\}/g; |
3189 |
|
|
s/<t>/\\hbox{/gi; |
3190 |
|
|
s/<b>/\\bf /gi; |
3191 |
|
|
s/<bt>/{\\bf\\hbox{/gi; |
3192 |
|
|
s/<sub$R/_{/gi; |
3193 |
|
|
s/<sup$R/\^{/gi; |
3194 |
|
|
s/<box\s*size=["']?(\w+)["']?>/{\\def\\lft{$s{$1}}\\def\\rgt{$s{$1}}/gi; |
3195 |
|
|
s/<box$R/{/gi; |
3196 |
|
|
s/<text\s*>/\\hbox{/gi; |
3197 |
|
|
s/([\(\[\|])\s*<left>/\\lft$1/gi; |
3198 |
|
|
s/<right>/\\rgt /gi; |
3199 |
|
|
s/<(atop|choose|over)>/\\\L$1 /gi; |
3200 |
|
|
s/<of>/}\\of{/gi; |
3201 |
|
|
s/<bar>/\\overline{/gi; |
3202 |
|
|
s/<vec>/\\overrightarrow{/gi; |
3203 |
|
|
s/<hat>/\\widehat{/gi; |
3204 |
|
|
s/<tilde>/\\widetilde{/gi; |
3205 |
|
|
s/<(sqrt|root|vec|dot|ddot|hat|tilde)>/\\\L$1\{/gi; |
3206 |
|
|
while(/<above\s+sym\s*=\s*["']?equals["']?\s*>/i) { |
3207 |
|
|
$beg=$`."\\overline{\\overline{"; |
3208 |
|
|
$rest=$'; |
3209 |
|
|
$rest=~s/<\/above>/}}/i; |
3210 |
|
|
$_=$beg.$rest; |
3211 |
|
|
} |
3212 |
|
|
s/<above\s*>/\\overline{/gi; |
3213 |
|
|
s/<above\s+sym\s*=\s*["']?(\w+)["']?\s*>/\\$a{$1}\{/gi; |
3214 |
|
|
s/<below\s*>/\\underline{/gi; |
3215 |
|
|
s/<below\s+sym\s*=\s*["']?(\w+)["']?\s*>/\\$b{$1}\{/gi; |
3216 |
|
|
s/<\/(math|row|item|b)>//gi; |
3217 |
|
|
s/<\/(box|t|sup|sub|sqrt|root|vec|bar|dot|ddot|hat|tilde|above|below|text|array)>/}/gi; |
3218 |
|
|
s/<\/bt>/}}/gi; |
3219 |
|
|
s/<?/< /gi; |
3220 |
|
|
s/>?/>/gi; |
3221 |
|
|
s/&(\w+);?/\\$1 /gi; |
3222 |
|
|
s/<array$R/\\matrix{/gi; |
3223 |
|
|
s/<row>\s*<item$R//i; |
3224 |
|
|
s/<row>\s*<item$R/\\cr /gi; |
3225 |
|
|
s/<item>/&/gi; |
3226 |
|
|
s/<[^ ]$R//gi; |
3227 |
|
|
s/\n*$//; |
3228 |
|
|
$tex="\\batchmode\\magnification=$mag\\hsize=40cm\\nopagenumbers\n" |
3229 |
|
|
."\\def\\lft{\\left}\\def\\rgt{\\right}\n\\setbox0=\\hbox{\$$st$di".$_."\$}\n" |
3230 |
|
|
."\\immediate\\write0{$prog: \\the\\ht0: \\the\\dp0}\\box0\n\\end\n"; |
3231 |
|
|
} |
3232 |
|
|
sub Getopts { |
3233 |
|
|
local($optlist)=@_; |
3234 |
|
|
local(@args,$_,$opt,$opts,$rest,$olist,$plist,$found,@popts); |
3235 |
|
|
local($errs)=0; |
3236 |
|
|
local($[)=0; |
3237 |
|
|
@args=split( /\|/, $optlist ); |
3238 |
|
|
for $opt (@args) { |
3239 |
|
|
if(substr($opt,-1,1) ne ':') {$olist.=$opt} |
3240 |
|
|
else {$plist.=$opt} |
3241 |
|
|
} |
3242 |
|
|
@popts=split(/:/,$plist); |
3243 |
|
|
while(@ARGV && ($_=$ARGV[0]) =~ /^-(.*)/) { |
3244 |
|
|
$opt=$1; |
3245 |
|
|
if($opt=~/^-/ && $optalias{"\L$'"}) {$opt=$optalias{"\L$'"}}; |
3246 |
|
|
if($opt =~ /^[$olist]+$/) { |
3247 |
|
|
while ($char=chop $opt) {eval "\$opt_$char=1"} |
3248 |
|
|
shift(@ARGV); |
3249 |
|
|
} |
3250 |
|
|
else { |
3251 |
|
|
$found=0; |
3252 |
|
|
for $opts (@popts) { |
3253 |
|
|
$rest=substr($opt,length($opts)); |
3254 |
|
|
if(index($opt,$opts)==0) { |
3255 |
|
|
$found=1; |
3256 |
|
|
shift(@ARGV); |
3257 |
|
|
if(length($rest)==0) { |
3258 |
|
|
++$errs unless @ARGV; |
3259 |
|
|
$rest=shift(@ARGV); |
3260 |
|
|
} |
3261 |
|
|
eval "\$opt_$opts=\$rest"; |
3262 |
|
|
} |
3263 |
|
|
} |
3264 |
|
|
if(!$found) { |
3265 |
|
|
&dbg("Unknown option: $opt\n"); |
3266 |
|
|
++$errs; |
3267 |
|
|
shift(@ARGV); |
3268 |
|
|
} |
3269 |
|
|
} |
3270 |
|
|
} |
3271 |
|
|
$errs==0; |
3272 |
|
|
} |
3273 |
|
|
sub openps { |
3274 |
|
|
open(STDOUT,">$opt_o") || die "*** Error opening $opt_o for output\n"; |
3275 |
|
|
} |
3276 |
|
|
sub getalt { |
3277 |
|
|
if($imgcmd eq "img") { |
3278 |
|
|
$alt=""; |
3279 |
|
|
$match=0; |
3280 |
|
|
if($img=~/alt\s*=\s*"([^"]*)"/i) {$alt=$1; $match=1}; |
3281 |
|
|
if(!$match && $img=~/alt\s*=\s*([\w\.-]+)/i) {$alt=$1; $match=1}; |
3282 |
|
|
if(!$match) {$alt=")WB IA WB("}; |
3283 |
|
|
$text="$alt )WB("; |
3284 |
|
|
return; |
3285 |
|
|
} |
3286 |
|
|
if($imgcmd eq "hr") { |
3287 |
|
|
$text=$img=~/align\s*=\s*["']?(left|center|right)/i?")$algn{$1} ":")2 "; |
3288 |
|
|
$text.=$img=~/size\s*=\s*["']?$V/i?$1:.6; |
3289 |
|
|
$wd=1; |
3290 |
|
|
if($img=~/width\s*=\s*["']?$V(%?)/i) {$wd=$2?$1/100:-$1}; |
3291 |
|
|
$text.=" $wd HR("; |
3292 |
|
|
return; |
3293 |
|
|
} |
3294 |
|
|
if($imgcmd eq "fig") { |
3295 |
|
|
$text=")BN("; |
3296 |
|
|
} |
3297 |
|
|
} |
3298 |
|
|
sub xbmtops { |
3299 |
|
|
$fc=1; |
3300 |
|
|
$dp=1; |
3301 |
|
|
($xs,$ys)=$pic=~/^#define.* (\d+)[\w\W]*^#define.* (\d+)/; |
3302 |
|
|
$nd=2*int(($xs+7)/8)*$ys; |
3303 |
|
|
($pic)=$pic=~/[^#].* char.*[\w\W]*{([\w\W]*)}/; |
3304 |
|
|
$pic=~s/[ ,\n\r]*0x[ ,]*//g; |
3305 |
|
|
$pic=~y/01246789bdef/f7bd91e62480/; |
3306 |
|
|
$bm=unpack("H*", pack("h*",$pic)); |
3307 |
|
|
} |
3308 |
|
|
sub pmtops { |
3309 |
|
|
$pm=~/^P([4-6])/; |
3310 |
|
|
$maptype=$1; |
3311 |
|
|
return if(!$maptype); |
3312 |
|
|
$pm=$'; |
3313 |
|
|
$bm=""; |
3314 |
|
|
$nint=3; |
3315 |
|
|
$dp=8; |
3316 |
|
|
if($maptype==4) { |
3317 |
|
|
$nint=2; |
3318 |
|
|
$dp=1; |
3319 |
|
|
} |
3320 |
|
|
undef @num; |
3321 |
|
|
$found=0; |
3322 |
|
|
while($pm && $found<$nint) { |
3323 |
|
|
if($pm=~/^\s*(\d+)/) {$num[$found]=$1}; |
3324 |
|
|
if($num[$found]) { |
3325 |
|
|
$found++; |
3326 |
|
|
$pm=$'; |
3327 |
|
|
} elsif($pm=~/^\s*#.*\n/) { |
3328 |
|
|
$pm=$'; |
3329 |
|
|
} else { |
3330 |
|
|
return; |
3331 |
|
|
} |
3332 |
|
|
} |
3333 |
|
|
($b)=$pm=~/\s([\w\W]*)/; |
3334 |
|
|
($xs,$ys,$bits)=@num; |
3335 |
|
|
return if($bits>255); |
3336 |
|
|
$fc=1; |
3337 |
|
|
if($maptype==6) { |
3338 |
|
|
$fc=3; |
3339 |
|
|
$nd=6*$xs*$ys; |
3340 |
|
|
$bm=unpack("H*",$b); |
3341 |
|
|
} else { |
3342 |
|
|
$bm=unpack("H*",$b); |
3343 |
|
|
if($maptype==4) { |
3344 |
|
|
$nd=2*int(($xs+7)/8)*$ys; |
3345 |
|
|
$bm=~y/0123456789abcdef/fedcba9876543210/; |
3346 |
|
|
} else { |
3347 |
|
|
$nd=2*$xs*$ys; |
3348 |
|
|
} |
3349 |
|
|
} |
3350 |
|
|
} |
3351 |
|
|
sub trans { |
3352 |
|
|
$next = 13; |
3353 |
|
|
$temp = ord substr($pic,10,1); |
3354 |
|
|
if($temp & 0x80) {$next += 3*2**(($temp & 0x07) + 1)} else {return}; |
3355 |
|
|
$byte = ord substr($pic,$next,1); |
3356 |
|
|
while($byte != 0x3b && $next <= length $pic) { |
3357 |
|
|
if($byte == 0x21) { |
3358 |
|
|
if(ord substr($pic,$next+1,1) == 0xf9) { |
3359 |
|
|
if(ord substr($pic,$next+3,1) & 0x01) { |
3360 |
|
|
&dbg("Transparent\n") if($opt_d); |
3361 |
|
|
$src{$URL}=$pic; |
3362 |
|
|
$idx = 3*(ord substr($pic,$next+6,1))+13; |
3363 |
|
|
substr($pic,$idx,3) = pack("H*",$red.$grn.$blu) if($idx<length $pic); |
3364 |
|
|
} |
3365 |
|
|
return; |
3366 |
|
|
$next += 2; |
3367 |
|
|
&skip; |
3368 |
|
|
} else { |
3369 |
|
|
$next += 2; |
3370 |
|
|
&skip; |
3371 |
|
|
} |
3372 |
|
|
} elsif($byte == 0x2c) { |
3373 |
|
|
$next += 10; |
3374 |
|
|
$temp = ord substr($pic,$next-1,1); |
3375 |
|
|
if($temp & 0x80) {$next += 3*2**(($temp & 0x07) + 1)}; |
3376 |
|
|
$next++; |
3377 |
|
|
&skip; |
3378 |
|
|
} else {return} |
3379 |
|
|
} |
3380 |
|
|
} |
3381 |
|
|
sub skip { |
3382 |
|
|
$byte = ord substr($pic,$next,1); |
3383 |
|
|
while($byte != 0) { |
3384 |
|
|
$next += $byte + 1; |
3385 |
|
|
$byte = ord substr($pic,$next,1); |
3386 |
|
|
} |
3387 |
|
|
$next++; |
3388 |
|
|
$byte = ord substr($pic,$next,1); |
3389 |
|
|
} |
3390 |
|
|
sub run { |
3391 |
|
|
&dbg("@_\n") if($opt_d); |
3392 |
|
|
$pm=`@_`; |
3393 |
|
|
} |
3394 |
|
|
sub geturl { |
3395 |
|
|
local($url)=@_; |
3396 |
|
|
&dbg("Retrieving $url"); |
3397 |
|
|
if($package{'libwww-perl'} || $package{'jfriedl'}) { |
3398 |
|
|
warn "\n"; |
3399 |
|
|
&gu(); |
3400 |
|
|
if($code==401) { |
3401 |
|
|
&prompt("\nDocument requires username and password\n\nUsername: ",$user); |
3402 |
|
|
&prompt("Password: ",$pass); |
3403 |
|
|
&gu($user,$pass); |
3404 |
|
|
} |
3405 |
|
|
$_[1]=$cont; |
3406 |
|
|
} elsif(defined $geturl) { |
3407 |
|
|
&dbg("..."); |
3408 |
|
|
$_[1]=`$geturl '$url'`; |
3409 |
|
|
if($?) { |
3410 |
|
|
&dbg("\n*** Error opening $url\n"); |
3411 |
|
|
return 0; |
3412 |
|
|
} |
3413 |
|
|
&dbg("done\n"); |
3414 |
|
|
if($_[1]=~/\r?\n\r?\n/) { |
3415 |
|
|
$_[1]=$'; |
3416 |
|
|
$dhead=$`; |
3417 |
|
|
($code)=$dhead=~/HTTP\/\S+ +(\d+)/i; |
3418 |
|
|
($contyp)=$dhead=~/Content-type:\s+(.*)/i; |
3419 |
|
|
} else { |
3420 |
|
|
$code=500; |
3421 |
|
|
} |
3422 |
|
|
} |
3423 |
|
|
$_[0]=$url; |
3424 |
|
|
$code<300; |
3425 |
|
|
} |
3426 |
|
|
sub gu { |
3427 |
|
|
if($package{'libwww-perl'}) { |
3428 |
|
|
require LWP::UserAgent; |
3429 |
|
|
$ua=new LWP::UserAgent; |
3430 |
|
|
$req = HTTP::Request->new(GET => $url); |
3431 |
|
|
$req->authorization_basic(@_) if(@_); |
3432 |
|
|
$ua->agent($spoof) if($spoof); |
3433 |
|
|
my $res = $ua->request($req); |
3434 |
|
|
$code=$res->code; |
3435 |
|
|
$contyp=$res->header('content-type'); |
3436 |
|
|
$cont=$res->content; |
3437 |
|
|
} else { |
3438 |
|
|
require "www.pl"; |
3439 |
|
|
@opts=@_?("authorization=$_[0]:$_[1]"):(); |
3440 |
|
|
push(@opts,"quiet") if(!$opt_d); |
3441 |
|
|
$www::useragent=$spoof if($spoof); |
3442 |
|
|
($status,$memo,%info)=&www::open_http_url(*FILE,$url,@opts); |
3443 |
|
|
$code=$info{'CODE'}; |
3444 |
|
|
($contyp)=$info{'HEADER'}=~/Content-type:\s+(.*)/i; |
3445 |
|
|
$cont=<FILE>; |
3446 |
|
|
} |
3447 |
|
|
} |
3448 |
|
|
sub pictops { |
3449 |
|
|
if($opt_g) { |
3450 |
|
|
$fc=1; |
3451 |
|
|
$pg1="pgm"; |
3452 |
|
|
$pg2="|ppmtopgm"; |
3453 |
|
|
} else { |
3454 |
|
|
$fc=3; |
3455 |
|
|
$pg1="ppm"; |
3456 |
|
|
$pg2=""; |
3457 |
|
|
} |
3458 |
|
|
($type)=$URL=~/([^\?]+)\??/; |
3459 |
|
|
($type)=$type=~/\.(\w+)$/; |
3460 |
|
|
$bm=""; |
3461 |
|
|
$ps=""; |
3462 |
|
|
$pm=""; |
3463 |
|
|
if($opt_U && $src{$URL} && !$cmd{$URL.$red.$grn.$blu}) { |
3464 |
|
|
$pic=$src{$URL}; |
3465 |
|
|
} elsif($URL=~m|://|) { |
3466 |
|
|
&geturl($URL,$pic) || return; |
3467 |
|
|
} else { |
3468 |
|
|
$flag=0; |
3469 |
|
|
if($opt_O) { |
3470 |
|
|
$orig=$URL; |
3471 |
|
|
unless($orig=~s/\.\w*$/.ps/) {$orig.=".ps"}; |
3472 |
|
|
if(open(ORIG,"$orig")) { |
3473 |
|
|
$pic=<ORIG>; |
3474 |
|
|
close ORIG; |
3475 |
|
|
if($pic=~/^%!/ && $pic=~/%%BoundingBox:/) { |
3476 |
|
|
$flag=1; |
3477 |
|
|
&dbg("Using $orig as original for $URL\n") if($opt_d); |
3478 |
|
|
} |
3479 |
|
|
} |
3480 |
|
|
} |
3481 |
|
|
if(!$flag) { |
3482 |
|
|
if(open(PIC,"$URL")) { |
3483 |
|
|
binmode PIC; |
3484 |
|
|
$pic=<PIC>; |
3485 |
|
|
close PIC; |
3486 |
|
|
} else { |
3487 |
|
|
&dbg("*** Error opening $URL\n"); |
3488 |
|
|
return; |
3489 |
|
|
} |
3490 |
|
|
} |
3491 |
|
|
} |
3492 |
|
|
$pic=~s/^[\n\r]*//; |
3493 |
|
|
&trans if($pic=~/^GIF/); |
3494 |
|
|
open(SCRATCH,">$scr"); |
3495 |
|
|
print SCRATCH "$pic"; |
3496 |
|
|
close SCRATCH; |
3497 |
|
|
if($pic=~/^%!/ && $pic=~/%%BoundingBox: +$V +$V +$V +$V/) { |
3498 |
|
|
$xs=$3-$1; |
3499 |
|
|
$ys=$4-$2; |
3500 |
|
|
$ps="save\n0 0 M\nIS IS scale\n/showpage {}D\n-$1 -$2 translate\n"; |
3501 |
|
|
for $i (split(/\n/,$pic)) { |
3502 |
|
|
$ps.=$i."\n" if($i && $i!~/^%/); |
3503 |
|
|
} |
3504 |
|
|
$ps.="restore"; |
3505 |
|
|
} elsif($type=~/.xbm$/i || $pic=~/^#define/) { |
3506 |
|
|
&xbmtops; |
3507 |
|
|
} elsif($package{'ImageMagick'}) { |
3508 |
|
|
if($package{'PerlMagick'}) { |
3509 |
|
|
$imobj=Image::Magick->new; |
3510 |
|
|
$mess=$imobj->Read($scr); |
3511 |
|
|
if($mess) { |
3512 |
|
|
&dbg("$mess\n"); |
3513 |
|
|
} else { |
3514 |
|
|
$mess=$imobj->Write("$scr\.$pg1"); |
3515 |
|
|
&dbg("$mess\n") if($mess); |
3516 |
|
|
} |
3517 |
|
|
undef $imobj; |
3518 |
|
|
} else { |
3519 |
|
|
# &run("convert $scr $pg1:-"); |
3520 |
|
|
&run("convert $scr $scr\.$pg1"); |
3521 |
|
|
} |
3522 |
|
|
open(PNM,"$scr\.$pg1"); |
3523 |
|
|
binmode PNM; |
3524 |
|
|
$pm=<PNM>; |
3525 |
|
|
close PNM; |
3526 |
|
|
if(!$pm && $pic=~/^\377\330/ && $package{'djpeg'}) { |
3527 |
|
|
&run("djpeg $scr$pg2"); |
3528 |
|
|
} |
3529 |
|
|
} elsif($pic=~/^\377\330/ && $package{'djpeg'}) { |
3530 |
|
|
&run("djpeg $scr$pg2"); |
3531 |
|
|
} elsif($package{'pbmplus'} || $package{'netpbm'}) { |
3532 |
|
|
if($pic=~/^GIF/) { |
3533 |
|
|
&run("$giftopm $scr"); |
3534 |
|
|
} else { |
3535 |
|
|
&run("anytopnm $scr"); |
3536 |
|
|
} |
3537 |
|
|
if($opt_g && $pm=~/^P6/) { |
3538 |
|
|
open(SCRATCH,">$scr"); |
3539 |
|
|
print SCRATCH $pm; |
3540 |
|
|
close SCRATCH; |
3541 |
|
|
&run("ppmtopgm $scr"); |
3542 |
|
|
} |
3543 |
|
|
} |
3544 |
|
|
&pmtops if(!$bm); |
3545 |
|
|
return if(!$bm); |
3546 |
|
|
$bm=substr($bm,0,$nd); |
3547 |
|
|
$pad=$nd-length($bm); |
3548 |
|
|
if($pad) {$bm.="f" x $pad}; |
3549 |
|
|
$bm=~s/(.{60})/$1\n/g; |
3550 |
|
|
} |
3551 |
|
|
sub math2sym { |
3552 |
|
|
local($_)=@_; |
3553 |
|
|
s/<math$R//gi; |
3554 |
|
|
for $char (keys %symb) {s/&($char)(;|$|(?=\W))/\\$symb{$char}/g}; |
3555 |
|
|
$stat=!/([&<][a-zA-Z]|[_^{])/; |
3556 |
|
|
s/[a-zA-Z\s]*[a-zA-Z][a-zA-Z\s]*/)ES()I($&)ES()SY(/g; |
3557 |
|
|
s/(\\200|\\201|\\202)/)RO($&)ES(/g; |
3558 |
|
|
$sym=")SY($_)ES("; |
3559 |
|
|
$stat; |
3560 |
|
|
} |
3561 |
|
|
sub varsub { |
3562 |
|
|
for (@_) { |
3563 |
|
|
if(s/(^|[^\\])\$(T|N|U|H|A)/$1)join $vars{$2} join(/g) {$_="()$_\join"}; |
3564 |
|
|
s/(^|[^\\])\$D\{($S)\}/"$1".POSIX::strftime($+,@now)/eg; |
3565 |
|
|
s/(^|[^\\])\$D/"$1".POSIX::strftime($datefmt,@now)/eg; |
3566 |
|
|
s/(^|[^\\])\\/$1/g; |
3567 |
|
|
s/\(\)join//g; |
3568 |
|
|
s/\(\) ?(\([^)]*\)|\w+) ?join/$1/g; |
3569 |
|
|
} |
3570 |
|
|
} |
3571 |
|
|
sub follow { |
3572 |
|
|
return 0 if(!$opt_W); |
3573 |
|
|
$H=$lnk=~/\.html?(#|$)/i || $lnk=~m|.+//.+/[^/\.]*$|; |
3574 |
|
|
$T=$rev && ($revtoc && $ndoc==1 || $ndoc>1 && $H); |
3575 |
|
|
$L=$b1=~m|://| && $lnk=~m"^$b1(/|$)" || $b1!~m|://| && $lnk!~m|://|; |
3576 |
|
|
$B=$B2 && $lnk=~/^$B2/ || !$B2 && $lnk!~m"(^\.\.|://)"; |
3577 |
|
|
return $rlnk && ($H || $T) if($rel); |
3578 |
|
|
return $L && ($H || $T) if($local); |
3579 |
|
|
return $B && ($H || $T) if($below); |
3580 |
|
|
return $H || $T if($rev); |
3581 |
|
|
$H; |
3582 |
|
|
} |
3583 |
|
|
sub DSC { |
3584 |
|
|
&dbg("Generating DSC PostScript\n") if($opt_d); |
3585 |
|
|
%op=("moveto",2, "rmoveto",2, "lineto",2, "rlineto",2, "translate",2, |
3586 |
|
|
"scale",2, "show",1, "awidthshow",6, "stroke",0, "save",0, "restore",0, |
3587 |
|
|
"gsave",0, "grestore",0, "showpage",0, "newpath",0, "setlinewidth",1, |
3588 |
|
|
"setlinejoin",1, "setgray",1, "closepath",0, "fill",0, "arc",5, |
3589 |
|
|
"setrgbcolor",3, "rotate",1, "image",5, "colorimage",7); |
3590 |
|
|
%sho=("moveto","M", "rmoveto","RM", "lineto","L", "rlineto","RL", "show","S", |
3591 |
|
|
"showpage","N", "awidthshow","A"); |
3592 |
|
|
$i=0; |
3593 |
|
|
$po="/OU true D\n"; |
3594 |
|
|
for (keys %op) { |
3595 |
|
|
$cmd=$sho{$_}?$sho{$_}:$_; |
3596 |
|
|
push(@val,$cmd); |
3597 |
|
|
$in{$_}=$i++; |
3598 |
|
|
$j=$op{$_}+1; |
3599 |
|
|
$extra=""; |
3600 |
|
|
if(/showpage/) {$extra="Bb{Xl Yl Xh Yh}if Pn "}; |
3601 |
|
|
if(/image/) {$extra="K ";$j++}; |
3602 |
|
|
$t=$op{$_}?"$op{$_} copy $extra$in{$_} $j array astore":"[$extra$in{$_}]"; |
3603 |
|
|
$po.="/$_ {OU {$t ==} if $_}d\n"; |
3604 |
|
|
} |
3605 |
|
|
$po.="/pdfmark {$i] ==} D\n"; |
3606 |
|
|
$in{"pdfmark"}=$i++; |
3607 |
|
|
push(@val,"pdfmark"); |
3608 |
|
|
$po.="/NF {OU{2 copy E $i 3 array astore ==}if ONF}d\n" |
3609 |
|
|
."/EX {[IS EC] ==} D\n/Cd {} D\n/DU {TU PM 1 eq and TP and{Pn ==}if}d\n" |
3610 |
|
|
."/BB {US Bb{dup Yl lt{dup /Yl E D}if dup Yh gt{/Yh E D}{pop}ie\n" |
3611 |
|
|
." dup Xl lt{dup /Xl E D}if dup Xh gt{/Xh E D}{pop}ie}\n" |
3612 |
|
|
." {/Yl E D /Yh Yl D /Xl E D /Xh Xl D /Bb t D}ie}D\n"; |
3613 |
|
|
$in{"Nf"}=$i++; |
3614 |
|
|
s|/(NF.*)|/O$1|; |
3615 |
|
|
s|/BB.*|$po|; |
3616 |
|
|
push(@val,"Nf"); |
3617 |
|
|
if($psin) { |
3618 |
|
|
($ti)=/%%Title: (.*)/; |
3619 |
|
|
if(m|/BM (\d+)|) { |
3620 |
|
|
$nbit=$1; |
3621 |
|
|
for $vec ("IT","WS") { |
3622 |
|
|
/\/$vec \[(.*)\]/; |
3623 |
|
|
@$vec=split(' ',$1); |
3624 |
|
|
} |
3625 |
|
|
/\nSB/; |
3626 |
|
|
for (0..$nbit-1) { |
3627 |
|
|
$'=~/\n\n/; |
3628 |
|
|
push(@BM,$`); |
3629 |
|
|
} |
3630 |
|
|
} |
3631 |
|
|
($epsf)=/(\n\/P\d+_?\d* [\w\W]*)%Endpv/; |
3632 |
|
|
while($epsf=~/\n\/(P\d+_?\d*) \{/g) { |
3633 |
|
|
$pid=$1; |
3634 |
|
|
$rest=$'; |
3635 |
|
|
$temp=$'=~/\/P\d+_?\d* \{/?$`:$rest; |
3636 |
|
|
($eps{$pid})=$temp=~/([\w\W]*)} D/; |
3637 |
|
|
} |
3638 |
|
|
if(/\/DH {/) { |
3639 |
|
|
$'=~/%EndDH/; |
3640 |
|
|
$ph="/DH {$`"; |
3641 |
|
|
} |
3642 |
|
|
} |
3643 |
|
|
$j=-1; |
3644 |
|
|
for $i (0..$#IT) { |
3645 |
|
|
$j++ if($IT[$i] == 0); |
3646 |
|
|
push(@ix,$j); |
3647 |
|
|
} |
3648 |
|
|
$dfn="/F $opt_s D\n$ph"; |
3649 |
|
|
for (keys %sho) { |
3650 |
|
|
$dfn.="/$sho{$_} {$_} d\n"; |
3651 |
|
|
} |
3652 |
|
|
|
3653 |
|
|
open(SCR,">$scr.ps"); |
3654 |
|
|
print SCR "$_ quit\n"; |
3655 |
|
|
close SCR; |
3656 |
|
|
$cd{')]'}="Cd "; |
3657 |
|
|
$io="($in{'image'}|$in{'colorimage'})"; |
3658 |
|
|
$_=""; |
3659 |
|
|
$temp=""; |
3660 |
|
|
$pn=""; |
3661 |
|
|
$start=1; |
3662 |
|
|
$EPS="%%EndPageSetup"; |
3663 |
|
|
$pp=0; |
3664 |
|
|
$n=0; |
3665 |
|
|
for $line (split(/\r?\n/,`gs -q -dNODISPLAY $scr.ps</dev/null`)) { |
3666 |
|
|
if(!$pp) { |
3667 |
|
|
$mv=""; |
3668 |
|
|
$cx=""; |
3669 |
|
|
$cy=""; |
3670 |
|
|
} |
3671 |
|
|
if($start && $line!~/ $in{"pdfmark"}\]$/) { |
3672 |
|
|
$pdf=$temp; |
3673 |
|
|
$temp=""; |
3674 |
|
|
$start=0; |
3675 |
|
|
} |
3676 |
|
|
$pp=$line=~/^\[(\S+) (\S+) ($in{'moveto'}|$in{'rmoveto'}|$in{'Nf'})\]$/; |
3677 |
|
|
S:{ |
3678 |
|
|
if($3==$in{"Nf"}) { |
3679 |
|
|
$fn="$1 $2 $val[$3]\n"; |
3680 |
|
|
last S; |
3681 |
|
|
} |
3682 |
|
|
if($3==$in{"moveto"}) { |
3683 |
|
|
$cx=$1; |
3684 |
|
|
$cy=$2; |
3685 |
|
|
$mv=sprintf("%.1f %.1f %s\n",$1,$2,$val[$3]); |
3686 |
|
|
last S; |
3687 |
|
|
} |
3688 |
|
|
if($3==$in{"rmoveto"}) { |
3689 |
|
|
if($mv) { |
3690 |
|
|
$cx+=$1; |
3691 |
|
|
$cy+=$2; |
3692 |
|
|
$mv=sprintf("%.1f %.1f %s\n",$cx,$cy,$val[$in{"moveto"}]); |
3693 |
|
|
} else { |
3694 |
|
|
$temp.=sprintf("%.1f %.1f %s\n",$1,$2,$val[$3]) if($1||$2); |
3695 |
|
|
} |
3696 |
|
|
last S; |
3697 |
|
|
} |
3698 |
|
|
if($line=~s/^\[(.*)\((\S*)\) ($in{"showpage"})\]$/pgsave restore $val[$3]/) { |
3699 |
|
|
$pbb=""; |
3700 |
|
|
if($1) { |
3701 |
|
|
($llx,$lly,$urx,$ury)=split(/ /,$1); |
3702 |
|
|
$llx=int($llx); |
3703 |
|
|
$lly=int($lly); |
3704 |
|
|
$urx=int($urx+1); |
3705 |
|
|
$ury=int($ury+1); |
3706 |
|
|
$pbb="%%PageBoundingBox: $llx $lly $urx $ury\n"; |
3707 |
|
|
if(!defined($Llx) || $llx<$Llx) {$Llx=$llx}; |
3708 |
|
|
if(!defined($Lly) || $lly<$Lly) {$Lly=$lly}; |
3709 |
|
|
if(!defined($Urx) || $urx>$Urx) {$Urx=$urx}; |
3710 |
|
|
if(!defined($Ury) || $ury>$Ury) {$Ury=$ury}; |
3711 |
|
|
} |
3712 |
|
|
$pn.="," if($pn && $2); |
3713 |
|
|
$n++; |
3714 |
|
|
@df=(); |
3715 |
|
|
for(0..$#docfonts) { |
3716 |
|
|
push(@df,$docfonts[$_]) if($uf{$_}==$n); |
3717 |
|
|
} |
3718 |
|
|
push(@df,"Symbol") if($uf{"-1"}==$n); |
3719 |
|
|
$fu=""; |
3720 |
|
|
$tmp=@df?"%%PageResources: font":""; |
3721 |
|
|
&splitline(@df); |
3722 |
|
|
$_.="%%Page: $pn$2 $n\n$fu$pbb%%BeginPageSetup\n/pgsave save D\n$temp$line\n"; |
3723 |
|
|
$EPS="%%EndPageSetup"; |
3724 |
|
|
$temp=""; |
3725 |
|
|
$line=""; |
3726 |
|
|
$fn=""; |
3727 |
|
|
$mv=""; |
3728 |
|
|
$pn=""; |
3729 |
|
|
last S; |
3730 |
|
|
} |
3731 |
|
|
if($line=~/^\[([^(]*)(\(.*\)) ($in{"show"}|$in{"awidthshow"})\]$/) { |
3732 |
|
|
if(length $2>2) { |
3733 |
|
|
$line="$fn$1$2 $val[$3]"; |
3734 |
|
|
if($fn=~/(\S+) Nf/ && $uf{$1}!=$n+1) { |
3735 |
|
|
$uf{$1}=$n+1; |
3736 |
|
|
$fnt=$1<0?"Symbol":$docfonts[$1]; |
3737 |
|
|
$line="%%IncludeResource: font $fnt\n$line"; |
3738 |
|
|
} |
3739 |
|
|
$fn=""; |
3740 |
|
|
$pp=0; |
3741 |
|
|
} else { |
3742 |
|
|
$pp=1; |
3743 |
|
|
} |
3744 |
|
|
last S; |
3745 |
|
|
} |
3746 |
|
|
if($line=~/^\[(\S+) (\S+) ($in{"scale"})\]$/) { |
3747 |
|
|
$line=$1!=1||$2!=1?"$1 $2 $val[$3]\n$EPS":"$EPS"; |
3748 |
|
|
$EPS=""; |
3749 |
|
|
last S; |
3750 |
|
|
} |
3751 |
|
|
if($line=~/^\[(.*) (\d+) $io\]$/) { |
3752 |
|
|
$li=$BM[$2]=~y/\n/\n/+2; |
3753 |
|
|
$line="\/picstr $WS[$ix[$2]] string D\n$1\n" |
3754 |
|
|
."%%BeginData: $li Hex Lines\n$val[$3]\n$BM[$2]\n%%EndData"; |
3755 |
|
|
last S; |
3756 |
|
|
} |
3757 |
|
|
if($line=~/^\((.*)\)$/) { |
3758 |
|
|
$pn=$1; |
3759 |
|
|
$line=""; |
3760 |
|
|
last S; |
3761 |
|
|
} |
3762 |
|
|
last S if($line=~s/^\[([^\/].* )?(\d+)\]$/$1$val[$2]/); |
3763 |
|
|
last S if($line=~s/(\)\])? (\/\w+) $in{"pdfmark"}\]$/$1 $cd{$1}$2 pdfmark/); |
3764 |
|
|
last S if($line=~s/^\[(\S+) \((P\d+.*)\)\]$/\/IS $1 D\n$eps{$2}/); |
3765 |
|
|
&dbg("$line\n"); |
3766 |
|
|
} |
3767 |
|
|
if(!$pp && $mv.$line) { |
3768 |
|
|
$mv=~s/\.0//g; |
3769 |
|
|
$temp.="$mv$line\n"; |
3770 |
|
|
} |
3771 |
|
|
} |
3772 |
|
|
@nf=(); |
3773 |
|
|
@sf=(); |
3774 |
|
|
$fontdef=""; |
3775 |
|
|
for(0..$#docfonts) { |
3776 |
|
|
$ff=$ff{$docfonts[$_]}; |
3777 |
|
|
if($ff && $uf{$_}>0) { |
3778 |
|
|
push(@sf,$docfonts[$_]); |
3779 |
|
|
$fontdef.="%%BeginResource: font $docfonts[$_]\n$cont{$ff}\n%%EndResource\n"; |
3780 |
|
|
$cont{$ff}=""; |
3781 |
|
|
} |
3782 |
|
|
push(@nf,$docfonts[$_]) if(!$ff && $uf{$_}>0); |
3783 |
|
|
} |
3784 |
|
|
push(@nf,"Symbol") if($uf{"-1"}>0); |
3785 |
|
|
$ti="@ARGV" unless($psin); |
3786 |
|
|
$or=$opt_L?"Landscape":"Portrait"; |
3787 |
|
|
$setup="%%BeginSetup\n"; |
3788 |
|
|
$setup.="$dupl\n" if($dupl); |
3789 |
|
|
$setup.="$fontdef" if($fontdef); |
3790 |
|
|
$fu=""; |
3791 |
|
|
$tmp=@nf?"%%DocumentNeededResources: font":""; |
3792 |
|
|
&splitline(@nf); |
3793 |
|
|
$tmp=@sf?"%%DocumentSuppliedResources: font":""; |
3794 |
|
|
&splitline(@sf); |
3795 |
|
|
s/\\(200|201|202)/\\$ssy{$1}/g; |
3796 |
|
|
$dd="Clean7Bit"; |
3797 |
|
|
$dd="Clean8Bit" if(($fontdef.$_)=~/[\200-\377]/); |
3798 |
|
|
$dd="Binary" if(($fontdef.$_)=~/[\000-\010\013-\014\016-\036]/); |
3799 |
|
|
$time=localtime; |
3800 |
|
|
print <<EOT; |
3801 |
|
|
%!PS-Adobe-3.0 |
3802 |
|
|
%%Title: $title |
3803 |
|
|
%%Creator: $version |
3804 |
|
|
%%CreationDate: $time |
3805 |
|
|
$fu%%DocumentData: $dd |
3806 |
|
|
%%Orientation: $or |
3807 |
|
|
%%BoundingBox: $Llx $Lly $Urx $Ury |
3808 |
|
|
%%Pages: $n |
3809 |
|
|
%%EndComments |
3810 |
|
|
%%BeginProlog |
3811 |
|
|
/d {bind def} bind def |
3812 |
|
|
/D {def} d |
3813 |
|
|
/ie {ifelse} d |
3814 |
|
|
/E {exch} d |
3815 |
|
|
/t true D |
3816 |
|
|
/f false D |
3817 |
|
|
$fl |
3818 |
|
|
$cd |
3819 |
|
|
$defs/Nf {dup 0 ge{FL E get}{pop /Symbol}ie findfont E scalefont setfont} D |
3820 |
|
|
/IP {currentfile picstr readhexstring pop} D |
3821 |
|
|
/WF $wf D |
3822 |
|
|
$dfn%%EndProlog |
3823 |
|
|
$setup$reenc$pdf%%EndSetup |
3824 |
|
|
$_%%EOF |
3825 |
|
|
EOT |
3826 |
|
|
} |
3827 |
|
|
sub splitline { |
3828 |
|
|
for (@_) { |
3829 |
|
|
if(length($tmp.$_)>78) { |
3830 |
|
|
$fu.="$tmp\n"; |
3831 |
|
|
$tmp="%%+ font"; |
3832 |
|
|
} |
3833 |
|
|
$tmp.=" $_"; |
3834 |
|
|
} |
3835 |
|
|
$fu.="$tmp\n" if($tmp); |
3836 |
|
|
} |
3837 |
|
|
sub ref { |
3838 |
|
|
@pnum=(); |
3839 |
|
|
/.*\s*$/; |
3840 |
|
|
open(SCR,">$scr.ps"); |
3841 |
|
|
print SCR "$`HN{==}forall $& quit\n"; |
3842 |
|
|
close SCR; |
3843 |
|
|
$pnum=`gs -q -dNODISPLAY $scr.ps</dev/null`; |
3844 |
|
|
while($pnum=~/\([^)]*\)/g) {push(@pnum,$&)}; |
3845 |
|
|
$pnum="@pnum"; |
3846 |
|
|
&cut($pnum); |
3847 |
|
|
s|/HN [^D]*D|/HN [$pnum] D|; |
3848 |
|
|
} |
3849 |
|
|
sub cut { |
3850 |
|
|
$_[0]=~s/(.{70}[^ \n]*) ([^ ])/$1\n$2/g; |
3851 |
|
|
} |
3852 |
|
|
sub fin { |
3853 |
|
|
if($opt_D) { |
3854 |
|
|
&DSC; |
3855 |
|
|
} else { |
3856 |
|
|
print; |
3857 |
|
|
} |
3858 |
|
|
if($opt_d) { |
3859 |
|
|
print DBG "\n"; |
3860 |
|
|
close DBG; |
3861 |
|
|
} |
3862 |
|
|
unlink "$scr","$scr.ps","$scr.ppm","$scr.tex","$scr.dvi","$scr.log" if($scr); |
3863 |
|
|
exit; |
3864 |
|
|
} |
3865 |
|
|
sub col2rgb { |
3866 |
|
|
$rgb=$colour{"\L$_[0]"}?($colour{"\L$_[0]"}):$_[0]; |
3867 |
|
|
@cvec=$rgb=~/($X$X)($X$X)($X$X)/?($1,$2,$3):(); |
3868 |
|
|
@cvec?"[16#$1 16#$2 16#$3]":""; |
3869 |
|
|
} |
3870 |
|
|
sub inihyph { |
3871 |
|
|
if($hyphenation_file{$lang}) { |
3872 |
|
|
$hyfile=$hyphenation_file{$lang}; |
3873 |
|
|
} else { |
3874 |
|
|
&dbg("No hyphenation file for language '$lang'\n"); |
3875 |
|
|
$lng=$lang; |
3876 |
|
|
while($lng=~s/-?[^-]+$// && !$hyphenation_file{$lng}) {}; |
3877 |
|
|
$hyfile=$hyphenation_file{$lng}; |
3878 |
|
|
&dbg(" ..using $hyfile\n"); |
3879 |
|
|
} |
3880 |
|
|
if($init{$hyfile}) { |
3881 |
|
|
$rep{$lang}=$refl{$hyfile}; |
3882 |
|
|
return; |
3883 |
|
|
} |
3884 |
|
|
if(open(HYPH,$hyfile)) { |
3885 |
|
|
&dbg("Reading hyphenation patterns from $hyfile\n") if($opt_d); |
3886 |
|
|
<HYPH>=~/\\patterns{.*/; |
3887 |
|
|
close HYPH; |
3888 |
|
|
$def=$`; |
3889 |
|
|
($patterns=$')=~s/\^\^($X$X)/chr hex $1/eg; |
3890 |
|
|
$upp{$lang}=''; |
3891 |
|
|
$low{$lang}=''; |
3892 |
|
|
while ($def=~/\\lccode(`\\?\^\^|")($X$X)=(`\\?\^\^|")($X$X)/g) { |
3893 |
|
|
if($2 ne $4) { |
3894 |
|
|
$uc=$2; |
3895 |
|
|
$lc=$4; |
3896 |
|
|
if($`=~/\n$/ || $`!~/%.*$/) { |
3897 |
|
|
$upp{$lang}.=chr hex $uc; |
3898 |
|
|
$low{$lang}.=chr hex $lc; |
3899 |
|
|
} |
3900 |
|
|
} |
3901 |
|
|
} |
3902 |
|
|
while ($def=~/\\let\\(\w+)=(\^\^|")($X$X)/g) { |
3903 |
|
|
$key=$1; |
3904 |
|
|
$value=chr hex $3; |
3905 |
|
|
$tex{$key}=$value if($`=~/\n$/ || $`!~/%.*$/); |
3906 |
|
|
} |
3907 |
|
|
for $key (keys %tex) { |
3908 |
|
|
$patterns=~s/\\$key */$tex{$key}/g; |
3909 |
|
|
} |
3910 |
|
|
if($lang=~/^de/) { |
3911 |
|
|
%de=('"a',228, '"o',246, '"u',252, '\3', 223); |
3912 |
|
|
$patterns=~s/\\c\{[^}]*\}//g; |
3913 |
|
|
$patterns=~s/\\n\{([^}]*)\}/$1/g; |
3914 |
|
|
$patterns=~s/("a|"o|"u|\\3)/chr $de{$1}/eg; |
3915 |
|
|
$upp{"de"}=~s/\337//; |
3916 |
|
|
$low{"de"}=~s/\377//; |
3917 |
|
|
} |
3918 |
|
|
if($lang=~/^is/ && !$upp{"is"}) { |
3919 |
|
|
%is=("'a","\341", "'e","\351", "'i","\355", "'o","\363", "'u","\372", |
3920 |
|
|
"'y","\375", '"x',"\346", '"o',"\366", "'d","\360", "`t","\376"); |
3921 |
|
|
$isch=join("|",keys %is); |
3922 |
|
|
$patterns=~s/($isch)/$is{$1}/g; |
3923 |
|
|
$upp{"is"}="\301\311\315\323\332\335\306\326\336\320"; |
3924 |
|
|
$low{"is"}="\341\351\355\363\372\375\346\366\376\360"; |
3925 |
|
|
} |
3926 |
|
|
if($lang=~/^fi/ && !$upp{"fi"}) { |
3927 |
|
|
$upp{"fi"}="\304\326"; |
3928 |
|
|
$low{"fi"}="\344\366"; |
3929 |
|
|
} |
3930 |
|
|
if($lang=~/^fr/ && !$upp{"fr"}) { |
3931 |
|
|
$upp{"fr"}="\300\302\307\311\310\312\313\316\317\324\326\333\226"; |
3932 |
|
|
$low{"fr"}="\340\342\347\351\350\352\353\356\357\364\366\373\225"; |
3933 |
|
|
} |
3934 |
|
|
if($lang=~/^es/ && !$upp{"es"}) { |
3935 |
|
|
$upp{"es"}="\301\311\315\323\321\332\334"; |
3936 |
|
|
$low{"es"}="\341\351\355\363\361\372\374"; |
3937 |
|
|
} |
3938 |
|
|
$patterns=~s/\{([\w\W]*?)\}/[$1]/g; |
3939 |
|
|
$patterns=~/}/; |
3940 |
|
|
$end=$`; |
3941 |
|
|
if($def.$'=~/\\hyphenation\[.*/) { |
3942 |
|
|
$'=~/]/; |
3943 |
|
|
$hyext=$`; |
3944 |
|
|
} |
3945 |
|
|
($patterns=$end)=~s/%.*//g; |
3946 |
|
|
for $key (split('\s+',$patterns)) { |
3947 |
|
|
$value=$key; |
3948 |
|
|
$key=~s/\d//g; |
3949 |
|
|
$value=~s/^([$ltrs.])/0$1/; |
3950 |
|
|
$value=~s/[$ltrs](\d)/$1/g; |
3951 |
|
|
$value=~s/[$ltrs.]/0/g; |
3952 |
|
|
$patt{"$key,$lang"}=$value if($value=~/^\d+$/); |
3953 |
|
|
} |
3954 |
|
|
} else { |
3955 |
|
|
&dbg("Cannot open hyphenation file: $hyfile\n"); |
3956 |
|
|
} |
3957 |
|
|
$hext=$hyphenation_extfile{$lang}; |
3958 |
|
|
for(split('\s*:\s*',$hext)) { |
3959 |
|
|
if(open(HEXT,$_)) { |
3960 |
|
|
&dbg("Reading hyphenation extensions from $_\n") if($opt_d); |
3961 |
|
|
$hyext.=<HEXT>; |
3962 |
|
|
close HEXT; |
3963 |
|
|
} else { |
3964 |
|
|
&dbg("Cannot open hyphenation extension file: $_\n"); |
3965 |
|
|
} |
3966 |
|
|
} |
3967 |
|
|
if($hyext) { |
3968 |
|
|
for $key (keys %tex) { |
3969 |
|
|
$hyext=~s/$key */$tex{$key}/g; |
3970 |
|
|
} |
3971 |
|
|
for $key (split('\s+',$hyext)) { |
3972 |
|
|
$key=~s/\s+//g; |
3973 |
|
|
$value="00$key\0"; |
3974 |
|
|
$key=~s/-//g; |
3975 |
|
|
$value=~s/[$ltrs]/0/g; |
3976 |
|
|
$value=~s/0-/1/g; |
3977 |
|
|
$hext{"$key,$lang"}=$value; |
3978 |
|
|
} |
3979 |
|
|
} |
3980 |
|
|
$refl{$hyfile}=$lang; |
3981 |
|
|
$rep{$lang}=$lang; |
3982 |
|
|
$init{$hyfile}=1; |
3983 |
|
|
} |
3984 |
|
|
sub hyph { |
3985 |
|
|
$word="\L$_[0]"; |
3986 |
|
|
eval "\$word=~y/$upp{$rep{$lang}}/$low{$rep{$lang}}/" if($upp{$rep{$lang}}); |
3987 |
|
|
$len=length($word); |
3988 |
|
|
$h=$hext{"$word,$rep{$lang}"}; |
3989 |
|
|
if($h) { |
3990 |
|
|
@br=split(//,$h); |
3991 |
|
|
} else { |
3992 |
|
|
@br=(0) x ($len+3); |
3993 |
|
|
for $i (0..$len) { |
3994 |
|
|
for $j (0..$len-$i) { |
3995 |
|
|
$str=substr(".$word.",$j,$i+2); |
3996 |
|
|
$pstr=$patt{"$str,$rep{$lang}"}; |
3997 |
|
|
if($pstr) { |
3998 |
|
|
@patt=split(//,$pstr); |
3999 |
|
|
for $k (0..$#patt) { |
4000 |
|
|
$br[$k+$j]=$patt[$k] if($br[$k+$j]<$patt[$k]); |
4001 |
|
|
} |
4002 |
|
|
} |
4003 |
|
|
} |
4004 |
|
|
} |
4005 |
|
|
} |
4006 |
|
|
$hword=""; |
4007 |
|
|
for $i (0..$len-1) { |
4008 |
|
|
$hword.=substr($_[0],$i,1); |
4009 |
|
|
if(($h || $i>$hyphenation{'start'}-2 && $i<$len-$hyphenation{'end'}) |
4010 |
|
|
&& $br[$i+2]%2==1) {$hword.=")HY("}; |
4011 |
|
|
} |
4012 |
|
|
$hword.=")YH(" if(length $word < length $hword); |
4013 |
|
|
$hword; |
4014 |
|
|
} |
4015 |
|
|
sub setel { |
4016 |
|
|
$el=$_[0]; |
4017 |
|
|
eval "\%arr=\%$el"; |
4018 |
|
|
&fs($el); |
4019 |
|
|
push(@font,$fontid{"\L$font"}); |
4020 |
|
|
push(@styl,$styl); |
4021 |
|
|
push(@size,$arr{'font-size'}); |
4022 |
|
|
push(@alig,$algn{$arr{'text-align'}}-1); |
4023 |
|
|
push(@topm,$arr{'margin-top'}); |
4024 |
|
|
push(@botm,$arr{'margin-bottom'}); |
4025 |
|
|
push(@lftm,$arr{'margin-left'}); |
4026 |
|
|
push(@rgtm,$arr{'margin-right'}); |
4027 |
|
|
push(@colr,$col eq "[16#00 16#00 16#00]"?0:$col); |
4028 |
|
|
$temp=$arr{'margin-top'}*$arr{'font-size'}; |
4029 |
|
|
$mi=$temp if($temp>$mi); |
4030 |
|
|
$temp=$arr{'margin-bottom'}*$arr{'font-size'}; |
4031 |
|
|
$mi=$temp if($temp>$mi); |
4032 |
|
|
} |
4033 |
|
|
sub fs { |
4034 |
|
|
$arr{'font-family'}='times' if($el ne 'p' && !$latin1 && !defined $arr{$_}); |
4035 |
|
|
for ("font-family","font-size") { |
4036 |
|
|
$arr{$_}=$body{$_} if(!defined $arr{$_}); |
4037 |
|
|
} |
4038 |
|
|
($font=$arr{'font-family'})=~s/\W/-/g; |
4039 |
|
|
if(!$font_names{"\L$font"}) {$font=$fal{$font}}; |
4040 |
|
|
if(!$font_names{"\L$font"}) { |
4041 |
|
|
&dbg("Unknown font: $arr{'font-family'}, using $deffnt{$_[0]}\n"); |
4042 |
|
|
$font=$deffnt{$_[0]}; |
4043 |
|
|
} |
4044 |
|
|
if(!defined $fontid{"\L$font"}) { |
4045 |
|
|
$fontid{"\L$font"}=$nfont++; |
4046 |
|
|
@names=split(/\s+/,$font_names{"\L$font"}); |
4047 |
|
|
for($#names+1..3) {push(@names,$names[0])}; |
4048 |
|
|
@docfonts=(@docfonts,@names); |
4049 |
|
|
} |
4050 |
|
|
&getval($arr{"font-size"},2); |
4051 |
|
|
for ('left','right','top','bottom') { |
4052 |
|
|
$arr{"margin-$_"}=0 if(!defined $arr{"margin-$_"}); |
4053 |
|
|
} |
4054 |
|
|
for ($arr{"text-indent"},$arr{"margin-top"},$arr{"margin-bottom"}, |
4055 |
|
|
$arr{"margin-left"},$arr{"margin-right"}) { |
4056 |
|
|
&getval($_,0); |
4057 |
|
|
} |
4058 |
|
|
$styl=$arr{'font-style'}=~/^(i|o)/+2*($arr{'font-weight'}=~/^b/); |
4059 |
|
|
$col=$arr{'color'}?&col2rgb($arr{'color'}):-1; |
4060 |
|
|
} |
4061 |
|
|
sub img { |
4062 |
|
|
local($_,$red,$grn,$blu)=@_; |
4063 |
|
|
local($beg,$end); |
4064 |
|
|
($red,$grn,$blu)=("FF","FF","FF") if(!$opt_U); |
4065 |
|
|
while (/<(img|fig|hr|overlay|object)\s/i) { |
4066 |
|
|
$imgcmd="\L$1"; |
4067 |
|
|
$beg=$`; |
4068 |
|
|
$'=~/>/; |
4069 |
|
|
$img=" $`"; |
4070 |
|
|
$end=$'; |
4071 |
|
|
$img=~s/\n/ /g; |
4072 |
|
|
if($imgcmd ne "object" || $img=~/data\s*=\s*['"]?([\w\/\.:~%-]+\.$IM)/i |
4073 |
|
|
|| $img=~/type\s*=\s*['"]?(image\/|application\/postscript)/i){ |
4074 |
|
|
if($opt_T) { |
4075 |
|
|
&getalt; |
4076 |
|
|
} else { |
4077 |
|
|
$al=0; |
4078 |
|
|
$off=""; |
4079 |
|
|
($align)=$img=~/align\s*=\s*['"]?(\w*)/i; |
4080 |
|
|
if($align=~/^middle$/i) {$al=1}; |
4081 |
|
|
if($align=~/^top$/i) {$al=2}; |
4082 |
|
|
if($imgcmd eq "overlay") { |
4083 |
|
|
$al=4; |
4084 |
|
|
$xoff=0; |
4085 |
|
|
$yoff=0; |
4086 |
|
|
if($img=~/\s*x\s*=\s*['"]?(\d+)/i) {$xoff=$1}; |
4087 |
|
|
if($img=~/\s*y\s*=\s*['"]?(\d+)/i) {$yoff=$1}; |
4088 |
|
|
$off="$xoff $yoff "; |
4089 |
|
|
} |
4090 |
|
|
$url=""; |
4091 |
|
|
if($img=~/\s(src|data)\s*=\s*($S)/i) {($url)=$+=~/([^ \n]*)/}; |
4092 |
|
|
&dbg("Image: $url\n") if($opt_d && $url); |
4093 |
|
|
$URL=$url; |
4094 |
|
|
unless($url=~m|://|) { |
4095 |
|
|
if($url=~m|^http:(.*)|) {$url=$1} |
4096 |
|
|
if($url=~m|^/|) {$URL=$b1.$url} else {$URL=$b2.$url} |
4097 |
|
|
} |
4098 |
|
|
while($URL!~m|^\.\./| && $URL=~m|[^/]*/\.\./|) {$URL=$`.$'}; |
4099 |
|
|
$URL=~s|/\./|/|g; |
4100 |
|
|
$text=$src{$URL}?$cmd{$URL.$red.$grn.$blu}:$cmd{$URL}; |
4101 |
|
|
if(!$text || $opt_U && $src{$URL} && !$cmd{$URL.$red.$grn.$blu}) { |
4102 |
|
|
if(!$url || $failed{$url}) { |
4103 |
|
|
&getalt; |
4104 |
|
|
} else { |
4105 |
|
|
&pictops; |
4106 |
|
|
if($bm || $ps) { |
4107 |
|
|
&dbg("Size: $xs*$ys\n") if($opt_d); |
4108 |
|
|
$nimg++; |
4109 |
|
|
push(@XS,$xs); |
4110 |
|
|
push(@YS,$ys); |
4111 |
|
|
if($bm) { |
4112 |
|
|
$nm++; |
4113 |
|
|
push(@DP,$dp); |
4114 |
|
|
push(@BM,$bm); |
4115 |
|
|
push(@WS,int(($xs-1)*$dp/8)+1); |
4116 |
|
|
push(@FC,$fc); |
4117 |
|
|
push(@IX,$nm); |
4118 |
|
|
push(@IT,0); |
4119 |
|
|
} |
4120 |
|
|
if($ps) { |
4121 |
|
|
$nps--; |
4122 |
|
|
push(@IX,$nps); |
4123 |
|
|
push(@IT,1); |
4124 |
|
|
$nli=99999; |
4125 |
|
|
$n=1; |
4126 |
|
|
$npr=$ps=~s|(.*\n){$nli}|sprintf("$&} D\n/P$nimg\_%d {",$n++)|eg; |
4127 |
|
|
if($npr) { |
4128 |
|
|
$proc=" ("; |
4129 |
|
|
for $i (0..$npr) { |
4130 |
|
|
$proc.="P$nimg\_$i "; |
4131 |
|
|
} |
4132 |
|
|
$proc.=")"; |
4133 |
|
|
$pv.="/P$nimg\_0 {$ps} D\n"; |
4134 |
|
|
$eps{"P$nimg\_0"}=$ps; |
4135 |
|
|
} else { |
4136 |
|
|
$proc=" (P$nimg)"; |
4137 |
|
|
$pv.="/P$nimg {$ps} D\n"; |
4138 |
|
|
$eps{"P$nimg"}=$ps; |
4139 |
|
|
} |
4140 |
|
|
} |
4141 |
|
|
$text="$proc $nimg IM("; |
4142 |
|
|
$cmd{$URL}=$text if(!$cmd{$URL}); |
4143 |
|
|
$cmd{$URL.$red.$grn.$blu}=$text if($src{$URL}); |
4144 |
|
|
$proc=""; |
4145 |
|
|
$end=$' if($imgcmd eq "object" && $end=~m|</object>|i); |
4146 |
|
|
} else { |
4147 |
|
|
&getalt; |
4148 |
|
|
$failed{"$url"}=1; |
4149 |
|
|
} |
4150 |
|
|
} |
4151 |
|
|
} elsif($imgcmd eq "object" && $end=~m|</object>|i) { |
4152 |
|
|
$end=$'; |
4153 |
|
|
} |
4154 |
|
|
} |
4155 |
|
|
if($cmd{$URL}) { |
4156 |
|
|
$text=")".$off.$al.$text; |
4157 |
|
|
if($imgcmd eq "fig") { |
4158 |
|
|
$end=~m|</fig>|i; |
4159 |
|
|
$fig=$`; |
4160 |
|
|
$end=$'; |
4161 |
|
|
$over=""; |
4162 |
|
|
while($fig=~/(<overlay$R)/ig) {$over.=$1}; |
4163 |
|
|
($dum,$cap)=$fig=~m|<caption$R([\w\W]*)</caption>|i; |
4164 |
|
|
($dum,$cred)=$fig=~m|<credit$R([\w\W]*)</credit>|i; |
4165 |
|
|
$text=")BN($text$over)BN($cap)BN($cred)BN("; |
4166 |
|
|
} |
4167 |
|
|
} |
4168 |
|
|
} |
4169 |
|
|
$_=$beg.$text.$end; |
4170 |
|
|
} |
4171 |
|
|
s|<[hH][rR]$R|)2 1 1 HR(|g; |
4172 |
|
|
$_[0]=$_; |
4173 |
|
|
} |
4174 |
|
|
sub getval{ |
4175 |
|
|
local($val,$unit)=$_[0]=~/$V\s*(\w*)/g; |
4176 |
|
|
$val*=$cm{$unit} if($_[1]==1 && defined $cm{$unit}); |
4177 |
|
|
$val*=$pt{$unit} if($_[1]==2 && defined $pt{$unit}); |
4178 |
|
|
$_[0]=$val; |
4179 |
|
|
} |
4180 |
|
|
sub getconf { |
4181 |
|
|
local($_)=@_; |
4182 |
|
|
while(/\@import\s+(([\w.\/-]+)|"([^"]*)"|'([^']*)')\s*;/) { |
4183 |
|
|
if(open(SS,$+) && !$read{$+}) { |
4184 |
|
|
$conf=<SS>; |
4185 |
|
|
$_=$`.$conf.$'; |
4186 |
|
|
print DBG "***** $+:\n$conf" if($opt_d); |
4187 |
|
|
close SS; |
4188 |
|
|
$read{$+}=1; |
4189 |
|
|
} else { |
4190 |
|
|
&dbg($read{$+}?"Infinite \@import loop: $+\n":"Error opening: $+\n"); |
4191 |
|
|
$_=$`.$'; |
4192 |
|
|
} |
4193 |
|
|
} |
4194 |
|
|
@block=(); |
4195 |
|
|
while(&getblk($_)){}; |
4196 |
|
|
} |
4197 |
|
|
sub getblk { |
4198 |
|
|
local($_)=@_; |
4199 |
|
|
local ($beg,$match,$end,$blk,$key,$val,$id,$temp); |
4200 |
|
|
while(/^\s*\/\*/) { |
4201 |
|
|
/\*\/|$/; |
4202 |
|
|
$_=$'; |
4203 |
|
|
} |
4204 |
|
|
return 0 if !/\S/; |
4205 |
|
|
/[\w,:.@\s-]+\{/; |
4206 |
|
|
$_=$'; |
4207 |
|
|
($id=$&)=~s/^\s*|\s*\{//g; |
4208 |
|
|
$id=lc $id; |
4209 |
|
|
push(@block,"\L$id"); |
4210 |
|
|
if($#block==1) { |
4211 |
|
|
$valid{$id}=1 if(!$user); |
4212 |
|
|
if($id eq "color") {$id="colour"}; |
4213 |
|
|
if(!$valid{$id}) { |
4214 |
|
|
&dbg("Error in configuration file: unknown block name '$id'\n"); |
4215 |
|
|
} |
4216 |
|
|
} |
4217 |
|
|
$blk=""; |
4218 |
|
|
W:while(/\s*(\/\*|[\w][\w-]*\s*:|[\w,:.\s-]+\{|\})\s*/) { |
4219 |
|
|
$blk.=$1 if($1 ne "/*"); |
4220 |
|
|
$beg=$`; |
4221 |
|
|
$match=$1; |
4222 |
|
|
$end=$'; |
4223 |
|
|
S:{ |
4224 |
|
|
if($match=~/\{$/) { |
4225 |
|
|
$temp=$match.$end; |
4226 |
|
|
$blk.=&getblk($temp); |
4227 |
|
|
$_=$temp; |
4228 |
|
|
last S; |
4229 |
|
|
} |
4230 |
|
|
if($match=~/:$/) { |
4231 |
|
|
($key=$`)=~s/\s*$//; |
4232 |
|
|
$end=~/([\w.\$-]+|"[^"]*"|'[^']*')\s*;?/; |
4233 |
|
|
$blk.=$`.$&; |
4234 |
|
|
$_=$'; |
4235 |
|
|
($val=$1)=~s/^["']|["']$//g; |
4236 |
|
|
$val=~s/'/\\'/g; |
4237 |
|
|
$typ=1; |
4238 |
|
|
$typ=2 if($val=~/^$V(cm|mm|in|pt|pc|em)$/); |
4239 |
|
|
$typ=3 if($val=~/^$V$/); |
4240 |
|
|
$typ=4 if($val=~/^-?\d+$/); |
4241 |
|
|
$typ=5 if($val eq "0" || $val eq "1"); |
4242 |
|
|
if($block[0] eq '@html2ps') { |
4243 |
|
|
if($#block==0) { |
4244 |
|
|
if(!$user) { |
4245 |
|
|
$valid{$key}=1; |
4246 |
|
|
$type{$key}=$typ if(!defined $type{$key}); |
4247 |
|
|
} |
4248 |
|
|
if($valid{$key}) { |
4249 |
|
|
if($typ>=$type{$key}) { |
4250 |
|
|
$key=~s/-/_/g; |
4251 |
|
|
eval "\$$key='$val'" if($user || $val ne ''); |
4252 |
|
|
# print DBG "\$$key='$val'\n" if($opt_d && $user); |
4253 |
|
|
} elsif($user) { |
4254 |
|
|
&dbg("Error in configuration file: bad value for $key: $val\n"); |
4255 |
|
|
} |
4256 |
|
|
} else { |
4257 |
|
|
&dbg("Error in configuration file: unknown key '$key'\n"); |
4258 |
|
|
} |
4259 |
|
|
} |
4260 |
|
|
if($#block==1) { |
4261 |
|
|
if($id eq "option" && $optalias{$key}) {$key=$optalias{$key}}; |
4262 |
|
|
if(!$user) { |
4263 |
|
|
$valid{"$id,$key"}=1; |
4264 |
|
|
$type{"$id,$key"}=$typ if(!defined $type{"$id,$key"}); |
4265 |
|
|
} |
4266 |
|
|
if($valid{"$id,$key"} || $extend{$id}) { |
4267 |
|
|
if($typ>=$type{"$id,$key"} || $id eq "colour") { |
4268 |
|
|
eval "\$$id\{'$key'}='$val'" if($user || $val ne ''); |
4269 |
|
|
# print DBG "\$$id\{'$key'}='$val'\n" if($opt_d && $user); |
4270 |
|
|
} elsif($user) { |
4271 |
|
|
&dbg("Error in configuration file: bad value for $key: $val\n"); |
4272 |
|
|
} |
4273 |
|
|
} else { |
4274 |
|
|
&dbg("Error in block '$id' in configuration file:" |
4275 |
|
|
." unknown key '$key'\n"); |
4276 |
|
|
} |
4277 |
|
|
} |
4278 |
|
|
if($#block>1) { |
4279 |
|
|
$temp="$block[$#block-1]_$key"; |
4280 |
|
|
$valid{$temp}=1 if(!$user); |
4281 |
|
|
$parblk=$block[$#block-1]; |
4282 |
|
|
if($valid{$temp}) { |
4283 |
|
|
eval "\$$parblk\_$key\{'$id'}='$val'"; |
4284 |
|
|
# print DBG "\$$parblk\_$key\{'$id'}='$val'\n" if($opt_d && $user); |
4285 |
|
|
} elsif($valid{$parblk}) { |
4286 |
|
|
&dbg("Error in block '$parblk' in configuration file:" |
4287 |
|
|
." unknown key '$key'\n"); |
4288 |
|
|
} |
4289 |
|
|
} |
4290 |
|
|
} else { |
4291 |
|
|
for $i (split(',\s*',$id)) { |
4292 |
|
|
$i=~s/\./_/; |
4293 |
|
|
$i=~s/:/__/; |
4294 |
|
|
eval "\$$i\{'\L$key'}='\L$val'"; |
4295 |
|
|
# print DBG "\$$i\{'\L$key'}='\L$val'\n" if($opt_d && $user); |
4296 |
|
|
} |
4297 |
|
|
} |
4298 |
|
|
last S; |
4299 |
|
|
} |
4300 |
|
|
if($match eq "/*") { |
4301 |
|
|
/\*\/|$/; |
4302 |
|
|
$_=$'; |
4303 |
|
|
last S; |
4304 |
|
|
} |
4305 |
|
|
last W; |
4306 |
|
|
} |
4307 |
|
|
} |
4308 |
|
|
pop(@block); |
4309 |
|
|
$_[0]=$end; |
4310 |
|
|
$blk; |
4311 |
|
|
} |
4312 |
|
|
sub prompt { |
4313 |
|
|
local($/)="\n"; |
4314 |
|
|
&dbg($_[0]); |
4315 |
|
|
chop($_[1]=<STDIN>); |
4316 |
|
|
} |
4317 |
|
|
sub dbg { |
4318 |
|
|
print STDERR $_[0]; |
4319 |
|
|
print DBG $_[0]; |
4320 |
|
|
} |
4321 |
|
|
sub hb { |
4322 |
|
|
local($_)=@_; |
4323 |
|
|
local($head,$body,$beg,$end,$match,$tag); |
4324 |
|
|
#If neither </HEAD> nor <BODY> can be found, find the separation point (messy). |
4325 |
|
|
if(!/<(body|\/head)/i || $`=~/<plaintext|<xmp|<listing|<!--/i) { |
4326 |
|
|
$head=""; |
4327 |
|
|
$int=""; |
4328 |
|
|
S1: while(/<(\/?\w+|!--|!|\?)/) { |
4329 |
|
|
S2:{ |
4330 |
|
|
$beg=$`; |
4331 |
|
|
$end=$'; |
4332 |
|
|
$match=$&; |
4333 |
|
|
$tag=$1; |
4334 |
|
|
if($tag eq "!--") { |
4335 |
|
|
$int.=$`; |
4336 |
|
|
&getcom; |
4337 |
|
|
$int.=$com; |
4338 |
|
|
$_=$rest; |
4339 |
|
|
last S2; |
4340 |
|
|
} |
4341 |
|
|
if($tag=~/[!?]/) { |
4342 |
|
|
$end=~/>/; |
4343 |
|
|
$int.="$beg$match$`>"; |
4344 |
|
|
$_=$'; |
4345 |
|
|
last S2; |
4346 |
|
|
} |
4347 |
|
|
$tag=~s|/||; |
4348 |
|
|
last S1 if(!$head{"\L$tag"}); |
4349 |
|
|
$end=~/$R/; |
4350 |
|
|
$head.=$int.$beg.$match.$&; |
4351 |
|
|
$int=""; |
4352 |
|
|
$_=$'; |
4353 |
|
|
} |
4354 |
|
|
} |
4355 |
|
|
$body=$int.$_; |
4356 |
|
|
} else { |
4357 |
|
|
$head=$`; |
4358 |
|
|
$body=$&.$'; |
4359 |
|
|
} |
4360 |
|
|
$_[0]=$body; |
4361 |
|
|
$_[1]=$head; |
4362 |
|
|
} |
4363 |
|
|
sub open { |
4364 |
|
|
if($_[0]=~m|://|) { |
4365 |
|
|
&geturl($_[0],$_[1]); |
4366 |
|
|
} elsif(open(FILE,$_[0])) { |
4367 |
|
|
$_[1]=<FILE>; |
4368 |
|
|
close FILE; |
4369 |
|
|
} else { |
4370 |
|
|
0; |
4371 |
|
|
} |
4372 |
|
|
} |