| 1 |
|
|---|
| 2 |
use Getopt::Long; |
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
$pi = 3.14159265358979; |
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 |
|
|---|
| 19 |
$version = "jps2ps version 0.019, 27 mai 2008"; |
|---|
| 20 |
|
|---|
| 21 |
|
|---|
| 22 |
|
|---|
| 23 |
|
|---|
| 24 |
|
|---|
| 25 |
|
|---|
| 26 |
|
|---|
| 27 |
|
|---|
| 28 |
|
|---|
| 29 |
$montest = `ps a`; |
|---|
| 30 |
$montest =~ s/([^\n]*jps2ps[^ ]*)//; |
|---|
| 31 |
$montest = $1; |
|---|
| 32 |
$montest =~ s/([^ ]*jps2ps[^ ]*)//; |
|---|
| 33 |
$montest = $1; |
|---|
| 34 |
|
|---|
| 35 |
$ok = 1; |
|---|
| 36 |
$i = 0; |
|---|
| 37 |
while ($ok and ($i < 10)) { |
|---|
| 38 |
|
|---|
| 39 |
$localisation = `ls -l $montest`; |
|---|
| 40 |
|
|---|
| 41 |
if ($localisation =~ /^l/) { |
|---|
| 42 |
|
|---|
| 43 |
$montest = $localisation; |
|---|
| 44 |
$montest =~ s/.*-> //; |
|---|
| 45 |
|
|---|
| 46 |
$i++; |
|---|
| 47 |
} else { |
|---|
| 48 |
$ok = 0; |
|---|
| 49 |
} |
|---|
| 50 |
} |
|---|
| 51 |
|
|---|
| 52 |
if (($i < 9) and ($montest =~ /jps2ps/)) { |
|---|
| 53 |
$montest =~ s/jps2ps\.pl//; |
|---|
| 54 |
$montest =~ s/\n//g; |
|---|
| 55 |
|
|---|
| 56 |
$JPS2PS_DIR = "$montest"; |
|---|
| 57 |
} else { |
|---|
| 58 |
|
|---|
| 59 |
$JPS2PS_DIR = "/opt/syracuse/app/jps2ps/"; |
|---|
| 60 |
} |
|---|
| 61 |
|
|---|
| 62 |
|
|---|
| 63 |
$BBGRAF_DIR = "/var/www/syracuse/bbgraf/"; |
|---|
| 64 |
|
|---|
| 65 |
|
|---|
| 66 |
|
|---|
| 67 |
|
|---|
| 68 |
|
|---|
| 69 |
|
|---|
| 70 |
|
|---|
| 71 |
|
|---|
| 72 |
|
|---|
| 73 |
|
|---|
| 74 |
|
|---|
| 75 |
|
|---|
| 76 |
|
|---|
| 77 |
$nbarg = $#ARGV; |
|---|
| 78 |
|
|---|
| 79 |
$source = "-"; |
|---|
| 80 |
$sortieimposee = 0; |
|---|
| 81 |
$sortielpst = 0; |
|---|
| 82 |
$sortiepst = 0; |
|---|
| 83 |
|
|---|
| 84 |
|
|---|
| 85 |
|
|---|
| 86 |
|
|---|
| 87 |
|
|---|
| 88 |
|
|---|
| 89 |
|
|---|
| 90 |
|
|---|
| 91 |
for $i (0 .. $nbarg) { |
|---|
| 92 |
$argument = $ARGV[$i]; |
|---|
| 93 |
if ($argument !~ /^-/) { |
|---|
| 94 |
$source = $argument; |
|---|
| 95 |
|
|---|
| 96 |
if ($source !~ /\./) { |
|---|
| 97 |
$source = $source . "\.jps"; |
|---|
| 98 |
}; |
|---|
| 99 |
} |
|---|
| 100 |
} |
|---|
| 101 |
|
|---|
| 102 |
|
|---|
| 103 |
|
|---|
| 104 |
GetOptions ( |
|---|
| 105 |
"i=s" => \@includefile, |
|---|
| 106 |
|
|---|
| 107 |
|
|---|
| 108 |
"v" => \$demandeversion, |
|---|
| 109 |
"a" => \$sortieimposee, |
|---|
| 110 |
"pst" => \$sortiepst, |
|---|
| 111 |
"lpst" => \$sortielpst, |
|---|
| 112 |
); |
|---|
| 113 |
|
|---|
| 114 |
if ($demandeversion) { |
|---|
| 115 |
print (STDOUT "$version\n"); |
|---|
| 116 |
exit (0); |
|---|
| 117 |
} |
|---|
| 118 |
|
|---|
| 119 |
|
|---|
| 120 |
|
|---|
| 121 |
require $JPS2PS_DIR . "labels.pl"; |
|---|
| 122 |
require $JPS2PS_DIR . "listpps.pl"; |
|---|
| 123 |
require $JPS2PS_DIR . "priorite.pl"; |
|---|
| 124 |
require $JPS2PS_DIR . "dephash.pl"; |
|---|
| 125 |
|
|---|
| 126 |
$exp2rpn = $JPS2PS_DIR . "exp2rpn.pl -v'a b c d e f g h i j k l m n o p q r s t u v w x y z xmin xmax ymin ymax tmin tmax pi' "; |
|---|
| 127 |
$filtre = $JPS2PS_DIR . "filtre-file.pl"; |
|---|
| 128 |
|
|---|
| 129 |
|
|---|
| 130 |
|
|---|
| 131 |
|
|---|
| 132 |
|
|---|
| 133 |
|
|---|
| 134 |
|
|---|
| 135 |
sub init_vars { |
|---|
| 136 |
$xmin_str = "/xmin -6 def\n"; |
|---|
| 137 |
$xmax_str = "/xmax 6 def\n"; |
|---|
| 138 |
$ymin_str = "/ymin -6 def\n"; |
|---|
| 139 |
$ymax_str = "/ymax 6 def\n"; |
|---|
| 140 |
$border_str = "/border 7.5 def\n"; |
|---|
| 141 |
$xmin = -6; |
|---|
| 142 |
$xmax = 6; |
|---|
| 143 |
$ymin = -6; |
|---|
| 144 |
$ymax = 6; |
|---|
| 145 |
$border = 7.5; |
|---|
| 146 |
$rotate = 0; |
|---|
| 147 |
$angle_repere = 90; |
|---|
| 148 |
$xunit = 0; |
|---|
| 149 |
$yunit = 0; |
|---|
| 150 |
$generic = 0; |
|---|
| 151 |
$autocrop = 0; |
|---|
| 152 |
|
|---|
| 153 |
|
|---|
| 154 |
|
|---|
| 155 |
$width_str = "/width 250 def\n"; |
|---|
| 156 |
$height_str = "/height 250 def\n"; |
|---|
| 157 |
}; |
|---|
| 158 |
|
|---|
| 159 |
init_vars; |
|---|
| 160 |
|
|---|
| 161 |
|
|---|
| 162 |
|
|---|
| 163 |
|
|---|
| 164 |
|
|---|
| 165 |
|
|---|
| 166 |
|
|---|
| 167 |
|
|---|
| 168 |
|
|---|
| 169 |
|
|---|
| 170 |
|
|---|
| 171 |
$xtem = 1; |
|---|
| 172 |
$ytem = 1; |
|---|
| 173 |
|
|---|
| 174 |
$format = ""; |
|---|
| 175 |
$xyrapport = 1; |
|---|
| 176 |
|
|---|
| 177 |
|
|---|
| 178 |
$i = 0; |
|---|
| 179 |
|
|---|
| 180 |
if (defined @includefile) { |
|---|
| 181 |
foreach $file (@includefile) { |
|---|
| 182 |
open (FILE, $file) or die "ouverture du fichier $file impossible"; |
|---|
| 183 |
while (<FILE>) { |
|---|
| 184 |
$le_source [$i] = $_; |
|---|
| 185 |
$i++; |
|---|
| 186 |
}; |
|---|
| 187 |
close (FILE); |
|---|
| 188 |
} |
|---|
| 189 |
} |
|---|
| 190 |
|
|---|
| 191 |
open (SRC, $source) or die "ouverture du fichier source $source impossible"; |
|---|
| 192 |
while (<SRC>) { |
|---|
| 193 |
$le_source [$i] = $_; |
|---|
| 194 |
$i = $i + 1; |
|---|
| 195 |
}; |
|---|
| 196 |
close (SRC); |
|---|
| 197 |
|
|---|
| 198 |
|
|---|
| 199 |
|
|---|
| 200 |
|
|---|
| 201 |
foreach $line (@le_source) { |
|---|
| 202 |
$ligne = $line; |
|---|
| 203 |
|
|---|
| 204 |
if ($ligne =~ /%/) { |
|---|
| 205 |
$ligne =~ s/%.*$//; |
|---|
| 206 |
}; |
|---|
| 207 |
if ($ligne =~ /\t/) { |
|---|
| 208 |
$ligne =~ s/\t/ /g; |
|---|
| 209 |
}; |
|---|
| 210 |
|
|---|
| 211 |
if ($ligne =~ /^autocrop/) { |
|---|
| 212 |
$autocrop = 1; |
|---|
| 213 |
}; |
|---|
| 214 |
if ($ligne =~ /^[^[%]*make_generic/) { |
|---|
| 215 |
$generic = 1; |
|---|
| 216 |
}; |
|---|
| 217 |
if ($ligne =~ /setunit/) { |
|---|
| 218 |
($xunit = $ligne) =~ s/^([0-9-.]*) ([0-9.]*) .*[\n]?$/$1/; |
|---|
| 219 |
($yunit = $ligne) =~ s/^([0-9-.]*) ([0-9.]*) .*[\n]?$/$2/; |
|---|
| 220 |
}; |
|---|
| 221 |
if ($ligne =~ /setxunit/) { |
|---|
| 222 |
$xunit = $ligne; |
|---|
| 223 |
$xunit =~ s/ setxunit.*[\n]?$//; |
|---|
| 224 |
}; |
|---|
| 225 |
if ($ligne =~ /setyunit/) { |
|---|
| 226 |
$yunit = $ligne; |
|---|
| 227 |
$yunit =~ s/ setyunit.*[\n]?$//; |
|---|
| 228 |
}; |
|---|
| 229 |
if ($ligne =~ /setxrange[^3]/ and $xtem =~ 1) { |
|---|
| 230 |
$xmin_str = ""; |
|---|
| 231 |
$xmax_str = ""; |
|---|
| 232 |
$xtem = 0; |
|---|
| 233 |
($xmin = $ligne) =~ s/^([0-9-.]*) ([0-9.]*) .*[\n]?$/$1/; |
|---|
| 234 |
($xmax = $ligne) =~ s/^([0-9-.]*) ([0-9-.]*) .*[\n]?$/$2/; |
|---|
| 235 |
$setxrange_str = $ligne; |
|---|
| 236 |
}; |
|---|
| 237 |
if ($ligne =~ /setyrange[^3]/ and $ytem =~ 1) { |
|---|
| 238 |
$ymin_str = ""; |
|---|
| 239 |
$ymax_str = ""; |
|---|
| 240 |
$ytem = 0; |
|---|
| 241 |
($ymin = $ligne) =~ s/^([0-9-.]*) ([0-9.]*) .*[\n]?$/$1/; |
|---|
| 242 |
($ymax = $ligne) =~ s/^([0-9-.]*) ([0-9-.]*) .*[\n]?$/$2/; |
|---|
| 243 |
$setyrange_str = $ligne; |
|---|
| 244 |
}; |
|---|
| 245 |
|
|---|
| 246 |
|
|---|
| 247 |
|
|---|
| 248 |
|
|---|
| 249 |
|
|---|
| 250 |
|
|---|
| 251 |
|
|---|
| 252 |
|
|---|
| 253 |
|
|---|
| 254 |
|
|---|
| 255 |
|
|---|
| 256 |
|
|---|
| 257 |
|
|---|
| 258 |
|
|---|
| 259 |
|
|---|
| 260 |
|
|---|
| 261 |
|
|---|
| 262 |
|
|---|
| 263 |
|
|---|
| 264 |
|
|---|
| 265 |
if ($ligne =~ /setborder/) { |
|---|
| 266 |
$border_str = $ligne; |
|---|
| 267 |
($border = $border_str) =~ s/ setborder.*[\n]?$//; |
|---|
| 268 |
}; |
|---|
| 269 |
if ($ligne =~ /setxyrapport/) { |
|---|
| 270 |
$xyrapport = $ligne; |
|---|
| 271 |
$xyrapport =~ s/ setxyrapport.*[\n]?$//; |
|---|
| 272 |
}; |
|---|
| 273 |
if ($ligne =~ /setformat/) { |
|---|
| 274 |
$format = $ligne; |
|---|
| 275 |
$format =~ s/ setformat.*[\n]?$//; |
|---|
| 276 |
}; |
|---|
| 277 |
if ($ligne =~ /setrotate/) { |
|---|
| 278 |
$rotate = $ligne; |
|---|
| 279 |
$rotate =~ s/ setrotate.*[\n]?$//; |
|---|
| 280 |
}; |
|---|
| 281 |
if ($ligne =~ /setangle_repere/) { |
|---|
| 282 |
$angle_repere = $ligne; |
|---|
| 283 |
$angle_repere =~ s/ setangle_repere.*[\n]?$//; |
|---|
| 284 |
}; |
|---|
| 285 |
|
|---|
| 286 |
|
|---|
| 287 |
|
|---|
| 288 |
|
|---|
| 289 |
|
|---|
| 290 |
if ($ligne =~ /setwidth/) { |
|---|
| 291 |
$width_str = $ligne; |
|---|
| 292 |
$width = $ligne; |
|---|
| 293 |
$width =~ s/ setwidth.*[\n]?$//; |
|---|
| 294 |
}; |
|---|
| 295 |
|
|---|
| 296 |
|
|---|
| 297 |
|
|---|
| 298 |
|
|---|
| 299 |
|
|---|
| 300 |
if ($ligne =~ /setheight/) { |
|---|
| 301 |
$height_str = $ligne; |
|---|
| 302 |
($height = $ligne) =~ s/ setheight.*[\n]?$//; |
|---|
| 303 |
}; |
|---|
| 304 |
|
|---|
| 305 |
|
|---|
| 306 |
|
|---|
| 307 |
|
|---|
| 308 |
|
|---|
| 309 |
if ($ligne =~ /%/) { |
|---|
| 310 |
$ligne =~ s/%.*$//; |
|---|
| 311 |
} |
|---|
| 312 |
if ($ligne =~ /\(|\)|{|}|!|\[|\]|\//) { |
|---|
| 313 |
$ligne =~ s/\(|\)|!|{|}|\[|\]|\// /g; |
|---|
| 314 |
} |
|---|
| 315 |
if ($ligne =~ / /) { |
|---|
| 316 |
$ligne =~ s/ / /g; |
|---|
| 317 |
} |
|---|
| 318 |
$ligne =~ s/\r\n//; |
|---|
| 319 |
$ligne =~ s/\n//; |
|---|
| 320 |
@contenu = split (/ /, $ligne); |
|---|
| 321 |
foreach $mot (@contenu) { |
|---|
| 322 |
if ($mot =~ /[a-zA-Z]/) { |
|---|
| 323 |
|
|---|
| 324 |
|
|---|
| 325 |
|
|---|
| 326 |
|
|---|
| 327 |
|
|---|
| 328 |
foreach $dep (@{ $dependances {$mot} }) { |
|---|
| 329 |
$besoin {$dep} = 1; |
|---|
| 330 |
|
|---|
| 331 |
|
|---|
| 332 |
} |
|---|
| 333 |
} |
|---|
| 334 |
} |
|---|
| 335 |
}; |
|---|
| 336 |
|
|---|
| 337 |
$besoin {AAA} = 1; |
|---|
| 338 |
$besoin {AAAnode} = 1; |
|---|
| 339 |
$besoin {AAAscale} = 1; |
|---|
| 340 |
$besoin {mulv} = 1; |
|---|
| 341 |
$besoin {addv} = 1; |
|---|
| 342 |
|
|---|
| 343 |
|
|---|
| 344 |
|
|---|
| 345 |
|
|---|
| 346 |
|
|---|
| 347 |
|
|---|
| 348 |
|
|---|
| 349 |
|
|---|
| 350 |
|
|---|
| 351 |
|
|---|
| 352 |
|
|---|
| 353 |
|
|---|
| 354 |
|
|---|
| 355 |
|
|---|
| 356 |
|
|---|
| 357 |
|
|---|
| 358 |
|
|---|
| 359 |
|
|---|
| 360 |
|
|---|
| 361 |
|
|---|
| 362 |
|
|---|
| 363 |
|
|---|
| 364 |
|
|---|
| 365 |
|
|---|
| 366 |
|
|---|
| 367 |
|
|---|
| 368 |
|
|---|
| 369 |
|
|---|
| 370 |
|
|---|
| 371 |
|
|---|
| 372 |
|
|---|
| 373 |
$dx = $xmax - $xmin; |
|---|
| 374 |
$dy = $ymax - $ymin; |
|---|
| 375 |
|
|---|
| 376 |
|
|---|
| 377 |
if ($xunit != 0) { |
|---|
| 378 |
$width = $dx * $xunit; |
|---|
| 379 |
$width_str = "/width $width def\n"; |
|---|
| 380 |
}; |
|---|
| 381 |
if ($yunit != 0) { |
|---|
| 382 |
$height = $dy * $yunit; |
|---|
| 383 |
$height_str = "/height $height def\n"; |
|---|
| 384 |
}; |
|---|
| 385 |
|
|---|
| 386 |
|
|---|
| 387 |
|
|---|
| 388 |
|
|---|
| 389 |
|
|---|
| 390 |
|
|---|
| 391 |
|
|---|
| 392 |
|
|---|
| 393 |
if ((not $width) and (not $height)) { |
|---|
| 394 |
if ($dx > $dy) { |
|---|
| 395 |
$height = 250; |
|---|
| 396 |
} |
|---|
| 397 |
else { |
|---|
| 398 |
$width = 250; |
|---|
| 399 |
} |
|---|
| 400 |
} |
|---|
| 401 |
|
|---|
| 402 |
if ($width and $height) { |
|---|
| 403 |
|
|---|
| 404 |
} |
|---|
| 405 |
elsif ($format) { |
|---|
| 406 |
if ($width) { |
|---|
| 407 |
|
|---|
| 408 |
$height = $width / $format; |
|---|
| 409 |
$height_str = "/height $height def\n"; |
|---|
| 410 |
} else { |
|---|
| 411 |
|
|---|
| 412 |
$width = $height * $format; |
|---|
| 413 |
$width_str = "/width $width def\n"; |
|---|
| 414 |
} |
|---|
| 415 |
} |
|---|
| 416 |
else { |
|---|
| 417 |
if ($width) { |
|---|
| 418 |
$height = $dy * sin ($angle_repere * $pi / 180) * $width / ($xyrapport * $dx); |
|---|
| 419 |
$height_str = "/height $height def\n"; |
|---|
| 420 |
} |
|---|
| 421 |
else { |
|---|
| 422 |
$width = $height * ($xyrapport * $dx) / ($dy * sin ($angle_repere * $pi / 180)); |
|---|
| 423 |
$width_str = "/width $width def\n"; |
|---|
| 424 |
} |
|---|
| 425 |
} |
|---|
| 426 |
|
|---|
| 427 |
|
|---|
| 428 |
|
|---|
| 429 |
|
|---|
| 430 |
|
|---|
| 431 |
|
|---|
| 432 |
|
|---|
| 433 |
|
|---|
| 434 |
|
|---|
| 435 |
|
|---|
| 436 |
|
|---|
| 437 |
|
|---|
| 438 |
|
|---|
| 439 |
|
|---|
| 440 |
|
|---|
| 441 |
|
|---|
| 442 |
|
|---|
| 443 |
|
|---|
| 444 |
|
|---|
| 445 |
|
|---|
| 446 |
|
|---|
| 447 |
|
|---|
| 448 |
|
|---|
| 449 |
|
|---|
| 450 |
|
|---|
| 451 |
|
|---|
| 452 |
$bbx = $width + 2 * $border; |
|---|
| 453 |
$bby = $height + 2 * $border; |
|---|
| 454 |
|
|---|
| 455 |
$bbx = int ($bbx); |
|---|
| 456 |
$bby = int ($bby); |
|---|
| 457 |
|
|---|
| 458 |
sub max { |
|---|
| 459 |
my ($x, $y) = @_; |
|---|
| 460 |
if ($x>$y) { |
|---|
| 461 |
return ($x); |
|---|
| 462 |
} else { |
|---|
| 463 |
return ($y); |
|---|
| 464 |
} |
|---|
| 465 |
} |
|---|
| 466 |
|
|---|
| 467 |
sub min { |
|---|
| 468 |
my ($x, $y) = @_; |
|---|
| 469 |
if ($x > $y) { |
|---|
| 470 |
return ($y); |
|---|
| 471 |
} else { |
|---|
| 472 |
return ($x); |
|---|
| 473 |
} |
|---|
| 474 |
} |
|---|
| 475 |
|
|---|
| 476 |
$alpha = $rotate * ($pi / 180); |
|---|
| 477 |
|
|---|
| 478 |
|
|---|
| 479 |
|
|---|
| 480 |
|
|---|
| 481 |
|
|---|
| 482 |
|
|---|
| 483 |
$dlx = min (-$bby * sin ($alpha), 0); |
|---|
| 484 |
$dlx = min ($dlx, $bbx * cos ($alpha)); |
|---|
| 485 |
$dlx = min ($dlx, $bbx * cos ($alpha) - $bby * sin ($alpha)); |
|---|
| 486 |
$dly = min ($bby * cos ($alpha), 0); |
|---|
| 487 |
$dly = min ($dly, $bbx * sin ($alpha)); |
|---|
| 488 |
$dly = min ($dly, $bbx * sin ($alpha) + $bby * cos ($alpha)); |
|---|
| 489 |
|
|---|
| 490 |
$dlx = int ($dlx); |
|---|
| 491 |
$dly = int ($dly); |
|---|
| 492 |
|
|---|
| 493 |
|
|---|
| 494 |
|
|---|
| 495 |
|
|---|
| 496 |
$urx = max (-$bby * sin ($alpha), 0); |
|---|
| 497 |
$urx = max ($urx, $bbx * cos ($alpha)); |
|---|
| 498 |
$urx = max ($urx, $bbx * cos ($alpha) - $bby * sin ($alpha)); |
|---|
| 499 |
$ury = max ($bby * cos ($alpha), 0); |
|---|
| 500 |
$ury = max ($ury, $bbx * sin ($alpha)); |
|---|
| 501 |
$ury = max ($ury, $bbx * sin ($alpha) + $bby * cos ($alpha)); |
|---|
| 502 |
|
|---|
| 503 |
$urx = int ($urx); |
|---|
| 504 |
$ury = int ($ury); |
|---|
| 505 |
|
|---|
| 506 |
|
|---|
| 507 |
|
|---|
| 508 |
|
|---|
| 509 |
|
|---|
| 510 |
$botx = ($xmin * $width) / ($xmax - $xmin) - $border ; |
|---|
| 511 |
$boty = ($ymin * $height) / ($ymax - $ymin) - $border ; |
|---|
| 512 |
$topx = ($xmax * $width) / ($xmax - $xmin) + $border ; |
|---|
| 513 |
$topy = ($ymax * $height) / ($ymax - $ymin) + $border ; |
|---|
| 514 |
|
|---|
| 515 |
$botx = (int ($botx * 100)) / 100; |
|---|
| 516 |
$boty = (int ($boty * 100)) / 100; |
|---|
| 517 |
$topx = (int ($topx * 100)) / 100; |
|---|
| 518 |
$topy = (int ($topy * 100)) / 100; |
|---|
| 519 |
|
|---|
| 520 |
|
|---|
| 521 |
|
|---|
| 522 |
|
|---|
| 523 |
|
|---|
| 524 |
$PSTxunit = (int (($width / $dx) * 100)) / 100 ; |
|---|
| 525 |
$PSTyunit = (int (($height / $dy) * 100)) / 100 ; |
|---|
| 526 |
|
|---|
| 527 |
$PSTOx = $xmin + ($dx/2); |
|---|
| 528 |
$PSTOy = $ymin + ($dy/2); |
|---|
| 529 |
|
|---|
| 530 |
|
|---|
| 531 |
|
|---|
| 532 |
|
|---|
| 533 |
|
|---|
| 534 |
|
|---|
| 535 |
|
|---|
| 536 |
if ($sortiepst or $sortielpst) { |
|---|
| 537 |
$dimptx = $bbx; |
|---|
| 538 |
$dimpty = $bby; |
|---|
| 539 |
|
|---|
| 540 |
$dimx = ($dimptx / 72.27) * 25.4; |
|---|
| 541 |
$dimy = ($dimpty / 72.27) * 25.4; |
|---|
| 542 |
|
|---|
| 543 |
$dimx = (int ($dimx * 100)) / 100; |
|---|
| 544 |
$dimy = (int ($dimy * 100)) / 100; |
|---|
| 545 |
print "%% xsize: $dimx mm, $dimptx pt\n"; |
|---|
| 546 |
print "%% ysize: $dimy mm, $dimpty pt\n"; |
|---|
| 547 |
print "\\psset{unit=1pt}\n"; |
|---|
| 548 |
if ($sortiepst) { |
|---|
| 549 |
print "\\pspicture($botx,$boty)($topx,$topy)\n"; |
|---|
| 550 |
print "\\psset{xunit=$PSTxunit,yunit=$PSTyunit}\n"; |
|---|
| 551 |
print "\\rput($PSTOx,$PSTOy){\\epsfbox{img}}\n"; |
|---|
| 552 |
print "\\endpspicture\n"; |
|---|
| 553 |
} |
|---|
| 554 |
else { |
|---|
| 555 |
print "\\begin{pspicture}($botx,$boty)($topx,$topy)\n"; |
|---|
| 556 |
print "\\psset{xunit=$PSTxunit,yunit=$PSTyunit}\n"; |
|---|
| 557 |
print "\\rput($PSTOx,$PSTOy){\\includegraphics{img}}\n"; |
|---|
| 558 |
print "\\end{pspicture}\n"; |
|---|
| 559 |
} |
|---|
| 560 |
} |
|---|
| 561 |
|
|---|
| 562 |
|
|---|
| 563 |
|
|---|
| 564 |
|
|---|
| 565 |
|
|---|
| 566 |
|
|---|
| 567 |
|
|---|
| 568 |
if ((not $autocrop) and $sortieimposee) { |
|---|
| 569 |
$sortie = $source; |
|---|
| 570 |
$sortie =~ s/\.jps/\.ps/; |
|---|
| 571 |
open (SORTIE, ">$sortie") or die "ouverture du fichier $sortie impossible"; |
|---|
| 572 |
select (SORTIE); |
|---|
| 573 |
} |
|---|
| 574 |
if ($autocrop) { |
|---|
| 575 |
|
|---|
| 576 |
|
|---|
| 577 |
$tmp_sortie = "/tmp/$$.ps"; |
|---|
| 578 |
$log = "/tmp/$$.log"; |
|---|
| 579 |
open (SORTIE, ">$tmp_sortie") or die "ouverture du fichier $tmp_sortie impossible"; |
|---|
| 580 |
select (SORTIE); |
|---|
| 581 |
} |
|---|
| 582 |
|
|---|
| 583 |
|
|---|
| 584 |
|
|---|
| 585 |
|
|---|
| 586 |
|
|---|
| 587 |
|
|---|
| 588 |
|
|---|
| 589 |
print "%!PS-Adobe-3.0 EPSF \n"; |
|---|
| 590 |
|
|---|
| 591 |
sub affiche_en_tete_BB { |
|---|
| 592 |
print "%%Title: \n"; |
|---|
| 593 |
print "%%Creator: $version \n"; |
|---|
| 594 |
print "%%Pages: 1 \n"; |
|---|
| 595 |
|
|---|
| 596 |
print "%%BoundingBox: $dlx $dly $urx $ury \n"; |
|---|
| 597 |
}; |
|---|
| 598 |
|
|---|
| 599 |
sub affiche_en_tete_suite { |
|---|
| 600 |
print "%%Pspicture: ($botx,$boty)($topx,$topy)\n"; |
|---|
| 601 |
print "%%PSTunit: xunit=$PSTxunit,yunit=$PSTyunit\n"; |
|---|
| 602 |
print "%%OriginePspicture: ($PSTOx,$PSTOy)\n"; |
|---|
| 603 |
print "%%EndComments \n"; |
|---|
| 604 |
print "%%Page: 1 1\n"; |
|---|
| 605 |
}; |
|---|
| 606 |
|
|---|
| 607 |
if (not $autocrop) { |
|---|
| 608 |
affiche_en_tete_BB; |
|---|
| 609 |
} |
|---|
| 610 |
|
|---|
| 611 |
&affiche_en_tete_suite; |
|---|
| 612 |
|
|---|
| 613 |
|
|---|
| 614 |
|
|---|
| 615 |
|
|---|
| 616 |
|
|---|
| 617 |
|
|---|
| 618 |
|
|---|
| 619 |
print "/Pictdic 50 dict def Pictdic begin \n"; |
|---|
| 620 |
print "/jpsdic 500 dict def \n"; |
|---|
| 621 |
print "gsave \n"; |
|---|
| 622 |
print "jpsdic begin \n"; |
|---|
| 623 |
print "/pathdict 4 dict def \n"; |
|---|
| 624 |
print "/setrotate {pop} def\n"; |
|---|
| 625 |
print "/setformat {pop} def\n"; |
|---|
| 626 |
print "/setxyrapport {pop} def\n"; |
|---|
| 627 |
print "$rotate rotate\n"; |
|---|
| 628 |
|
|---|
| 629 |
|
|---|
| 630 |
|
|---|
| 631 |
|
|---|
| 632 |
|
|---|
| 633 |
|
|---|
| 634 |
|
|---|
| 635 |
print ("%%%%%%%%%%%%%%%%%%%% la BoundingBox %%%%%%%%%%%%%%%%%%%%%\n"); |
|---|
| 636 |
|
|---|
| 637 |
if ($besoin {setwidth}) { |
|---|
| 638 |
print (`cat ${setwidth}`); |
|---|
| 639 |
} |
|---|
| 640 |
if ($besoin {setheight}) { |
|---|
| 641 |
print (`cat ${setheight}`); |
|---|
| 642 |
} |
|---|
| 643 |
if ($besoin {setborder}) { |
|---|
| 644 |
print (`cat ${setborder}`); |
|---|
| 645 |
} |
|---|
| 646 |
print $width_str; |
|---|
| 647 |
print $height_str; |
|---|
| 648 |
print $border_str; |
|---|
| 649 |
|
|---|
| 650 |
print ("%%%%%%%%%%%%%%%% les bornes sur les axes %%%%%%%%%%%%%%%%\n"); |
|---|
| 651 |
|
|---|
| 652 |
print $xmin_str; |
|---|
| 653 |
print $xmax_str; |
|---|
| 654 |
print $ymin_str; |
|---|
| 655 |
print $ymax_str; |
|---|
| 656 |
|
|---|
| 657 |
if ($besoin {setxrange}) { |
|---|
| 658 |
print (`cat ${setxrange}`); |
|---|
| 659 |
print $setxrange_str;} |
|---|
| 660 |
if ($besoin {setyrange}) { |
|---|
| 661 |
print (`cat ${setyrange}`); |
|---|
| 662 |
print $setyrange_str;} |
|---|
| 663 |
|
|---|
| 664 |
print ("/angle_repere " . $angle_repere . " def\n"); |
|---|
| 665 |
|
|---|
| 666 |
|
|---|
| 667 |
|
|---|
| 668 |
|
|---|
| 669 |
|
|---|
| 670 |
|
|---|
| 671 |
|
|---|
| 672 |
|
|---|
| 673 |
|
|---|
| 674 |
|
|---|
| 675 |
|
|---|
| 676 |
|
|---|
| 677 |
|
|---|
| 678 |
|
|---|
| 679 |
|
|---|
| 680 |
|
|---|
| 681 |
|
|---|
| 682 |
|
|---|
| 683 |
|
|---|
| 684 |
|
|---|
| 685 |
|
|---|
| 686 |
|
|---|
| 687 |
|
|---|
| 688 |
|
|---|
| 689 |
|
|---|
| 690 |
|
|---|
| 691 |
|
|---|
| 692 |
|
|---|
| 693 |
|
|---|
| 694 |
|
|---|
| 695 |
|
|---|
| 696 |
|
|---|
| 697 |
|
|---|
| 698 |
|
|---|
| 699 |
|
|---|
| 700 |
|
|---|
| 701 |
|
|---|
| 702 |
|
|---|
| 703 |
|
|---|
| 704 |
|
|---|
| 705 |
|
|---|
| 706 |
|
|---|
| 707 |
|
|---|
| 708 |
|
|---|
| 709 |
|
|---|
| 710 |
|
|---|
| 711 |
|
|---|
| 712 |
|
|---|
| 713 |
|
|---|
| 714 |
|
|---|
| 715 |
|
|---|
| 716 |
|
|---|
| 717 |
|
|---|
| 718 |
|
|---|
| 719 |
|
|---|
| 720 |
|
|---|
| 721 |
sub affiche_source_jps { |
|---|
| 722 |
|
|---|
| 723 |
|
|---|
| 724 |
|
|---|
| 725 |
|
|---|
| 726 |
|
|---|
| 727 |
|
|---|
| 728 |
|
|---|
| 729 |
$label_en_cours = 0; |
|---|
| 730 |
$label_tex = ""; |
|---|
| 731 |
|
|---|
| 732 |
$expr_en_cours = 0; |
|---|
| 733 |
$expr_cart = ""; |
|---|
| 734 |
|
|---|
| 735 |
print ("\n" . "%"x20 . " debut du code jps " . "%"x20 . "\n"); |
|---|
| 736 |
|
|---|
| 737 |
foreach $ligne (@le_source) { |
|---|
| 738 |
|
|---|
| 739 |
if (($ligne =~ /^<tex>/) or ($ligne =~ /^<latex>/)) { |
|---|
| 740 |
$label_en_cours = 1; |
|---|
| 741 |
}; |
|---|
| 742 |
if ($ligne =~ /^ |
|---|
| 743 |
|
|---|
| 744 |
|
|---|
| 745 |
$ligne =~ s/\ |
|---|
| 746 |
$ligne =~ s/\n//g; |
|---|
| 747 |
$ligne =~ s/[^a-zA-Z0-9\+\*\-\^\/\^\(\)\.,;]//g; |
|---|
| 748 |
print (LOG "apres la manip : " . "$ligne" . "____\n"); |
|---|
| 749 |
|
|---|
| 750 |
|
|---|
| 751 |
$ligne = `$exp2rpn ' $ligne'` . "\n"; |
|---|
| 752 |
}; |
|---|
| 753 |
if ($ligne =~ /^ |
|---|
| 754 |
$ligne =~ s/ |
|---|
| 755 |
print (`cat $ligne`); |
|---|
| 756 |
$ligne = ""; |
|---|
| 757 |
}; |
|---|
| 758 |
if ($ligne =~ /^ |
|---|
| 759 |
$ligne =~ s/ |
|---|
| 760 |
|
|---|
| 761 |
($inclusion, $dim_label, @tablefont) = &traite_label ("<tex>\n" . "$ligne", @tablefont); |
|---|
| 762 |
print ($inclusion); |
|---|
| 763 |
print ($dim_label); |
|---|
| 764 |
$ligne = ""; |
|---|
| 765 |
}; |
|---|
| 766 |
if ($ligne =~ /^ |
|---|
| 767 |
$ligne =~ s/ |
|---|
| 768 |
|
|---|
| 769 |
($inclusion, $dim_label, @tablefont) = &traite_label ("<latex>\n" . "$ligne", @tablefont); |
|---|
| 770 |
print ($inclusion); |
|---|
| 771 |
print ($dim_label); |
|---|
| 772 |
$ligne = ""; |
|---|
| 773 |
}; |
|---|
| 774 |
if (not $label_en_cours){ |
|---|
| 775 |
print ($ligne); |
|---|
| 776 |
} else { |
|---|
| 777 |
$label_tex = $label_tex . $ligne; |
|---|
| 778 |
}; |
|---|
| 779 |
if (($ligne =~ /^<\/tex>/) or ($ligne =~ /^<\/latex>/)) { |
|---|
| 780 |
$label_en_cours = 0; |
|---|
| 781 |
($inclusion, $dim_label, @tablefont) = &traite_label ($label_tex, @tablefont); |
|---|
| 782 |
print ($inclusion); |
|---|
| 783 |
print ($dim_label); |
|---|
| 784 |
$label_tex = ""; |
|---|
| 785 |
}; |
|---|
| 786 |
} |
|---|
| 787 |
print ("\n" . "%"x20 . " fin du code jps " . "%"x20 . "\n"); |
|---|
| 788 |
}; |
|---|
| 789 |
|
|---|
| 790 |
|
|---|
| 791 |
|
|---|
| 792 |
|
|---|
| 793 |
|
|---|
| 794 |
|
|---|
| 795 |
|
|---|
| 796 |
if ($generic) { |
|---|
| 797 |
foreach $word (sort (@cles)) { |
|---|
| 798 |
print ("%======= fichier $word =========\n"); |
|---|
| 799 |
print (`cat ${$word}`); |
|---|
| 800 |
} |
|---|
| 801 |
print ("%"x20 . " debut du preliminaire pour generique " . "%"x20 . "\n"); |
|---|
| 802 |
print ("/make_generic {} def\n"); |
|---|
| 803 |
print ("setTimesRoman\n"); |
|---|
| 804 |
|
|---|
| 805 |
print ("(fichier générique, $version) O show_dim ptojpoint pop /b exch def pop /a exch def pop pop\n"); |
|---|
| 806 |
print ("(fichier générique, $version) xmin ymin xmax ymax milieu [xmax xmin sub .9 mul b a sub div dup] cctext\n"); |
|---|
| 807 |
|
|---|
| 808 |
print "\n"; |
|---|
| 809 |
print ("%"x20 . " fin du preliminaire pour generique " . "%"x20 . "\n"); |
|---|
| 810 |
} else { |
|---|
| 811 |
foreach $word (sort (@cles)) { |
|---|
| 812 |
if ($besoin {$word}) { |
|---|
| 813 |
print ("%% ======== fichier $word ======== %%\n"); |
|---|
| 814 |
print ("%% ======== ${$word} ======== %%\n"); |
|---|
| 815 |
print (`cat ${$word}`); |
|---|
| 816 |
}; |
|---|
| 817 |
} |
|---|
| 818 |
print "\n"; |
|---|
| 819 |
print ("newpath\n"); |
|---|
| 820 |
print (" xmin ymin smoveto\n"); |
|---|
| 821 |
print (" xmax ymin slineto\n"); |
|---|
| 822 |
print (" xmax ymax slineto\n"); |
|---|
| 823 |
print (" xmin ymax slineto\n"); |
|---|
| 824 |
print (" closepath\n"); |
|---|
| 825 |
print ("clip\n"); |
|---|
| 826 |
|
|---|
| 827 |
|
|---|
| 828 |
if ($besoin {camview}) { |
|---|
| 829 |
print (`cat $camview_default`)} |
|---|
| 830 |
}; |
|---|
| 831 |
|
|---|
| 832 |
&affiche_source_jps; |
|---|
| 833 |
|
|---|
| 834 |
sub affiche_conclusion { |
|---|
| 835 |
|
|---|
| 836 |
print "\n"; |
|---|
| 837 |
print "end\n"; |
|---|