summaryrefslogtreecommitdiff
path: root/Build
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2008-03-09 16:34:06 +0000
committerKarl Berry <karl@freefriends.org>2008-03-09 16:34:06 +0000
commit41a7a75361d4a6771bb90d0a4669fde1930a93a1 (patch)
tree0df478875aeb9588cb3e2b3ff314110199a153d0 /Build
parentd79979609ec34b43e94019bc44670888da909869 (diff)
symlink perltex
git-svn-id: svn://tug.org/texlive/trunk@6914 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build')
-rw-r--r--Build/source/texk/tetex/Makefile.in1
-rw-r--r--Build/source/texk/texlive/Makefile.in2
-rw-r--r--Build/source/texk/texlive/perltex471
-rwxr-xr-xBuild/source/texk/texlive/pkfix860
-rwxr-xr-xBuild/source/texk/texlive/ppower427
5 files changed, 2 insertions, 1359 deletions
diff --git a/Build/source/texk/tetex/Makefile.in b/Build/source/texk/tetex/Makefile.in
index 3a04b7e4073..d3189f2b8cf 100644
--- a/Build/source/texk/tetex/Makefile.in
+++ b/Build/source/texk/tetex/Makefile.in
@@ -25,6 +25,7 @@ LINKEDSCRIPTS = \
texmf/scripts/tetex/e2pall.pl \
texmf/scripts/tetex/texdoctk.pl \
texmf-dist/scripts/glossaries/makeglossaries \
+ texmf-dist/scripts/perltex/perltex.pl \
texmf-dist/scripts/thumbpdf/thumbpdf.pl \
texmf-dist/scripts/vpe/vpe.pl
diff --git a/Build/source/texk/texlive/Makefile.in b/Build/source/texk/texlive/Makefile.in
index 84e96e5edf2..5c487a2cfad 100644
--- a/Build/source/texk/texlive/Makefile.in
+++ b/Build/source/texk/texlive/Makefile.in
@@ -8,7 +8,7 @@ kpse_include ../make/programs.mk
LIVESCRIPTS = simpdftex \
ebong getnonfreefonts giftopng \
- pdfthumb perltex pkfix ppower4 vpe wordcount.sh \
+ pdfthumb ppower4 wordcount.sh \
texlua-perl-runner
TEXLUARUNNERS = generate-updmap generate-language generate-fmtutil
diff --git a/Build/source/texk/texlive/perltex b/Build/source/texk/texlive/perltex
deleted file mode 100644
index 52b14ef394f..00000000000
--- a/Build/source/texk/texlive/perltex
+++ /dev/null
@@ -1,471 +0,0 @@
-#! /usr/bin/env perl
-
-###########################################################
-# Prepare a LaTeX run for two-way communication with Perl #
-# By Scott Pakin <scott+pt@pakin.org> #
-###########################################################
-
-#-------------------------------------------------------------------
-# This is file `perltex.pl',
-# generated with the docstrip utility.
-#
-# The original source files were:
-#
-# perltex.dtx (with options: `perltex')
-#
-# This is a generated file.
-#
-# Copyright (C) 2007 Scott Pakin <scott+pt@pakin.org>
-#
-# This file may be distributed and/or modified under the conditions
-# of the LaTeX Project Public License, either version 1.3c of this
-# license or (at your option) any later version. The latest
-# version of this license is in:
-#
-# http://www.latex-project.org/lppl.txt
-#
-# and version 1.3c or later is part of all distributions of LaTeX
-# version 2006/05/20 or later.
-#-------------------------------------------------------------------
-
-sub top_level_eval ($)
-{
- return eval $_[0];
-}
-use Safe;
-use Opcode;
-use Getopt::Long;
-use Pod::Usage;
-use File::Basename;
-use Fcntl;
-use POSIX;
-use warnings;
-use strict;
-my $latexprog;
-my $runsafely = 1;
-my @permittedops;
-my $progname = basename $0;
-my $jobname = "texput";
-my @latexcmdline;
-my $toperl;
-my $fromperl;
-my $toflag;
-my $fromflag;
-my $doneflag;
-my $logfile;
-my $pipe;
-my $styfile;
-my @macroexpansions;
-my $sandbox = new Safe;
-my $sandbox_eval;
-my $latexpid;
-$latexprog = $ENV{"PERLTEX"} || "latex";
-Getopt::Long::Configure("require_order", "pass_through");
-GetOptions("help" => sub {pod2usage(-verbose => 1)},
- "latex=s" => \$latexprog,
- "safe!" => \$runsafely,
- "makesty" => sub {$styfile = "noperltex.sty"},
- "permit=s" => \@permittedops) || pod2usage(2);
-@latexcmdline = @ARGV;
-my $firstcmd = 0;
-for ($firstcmd=0; $firstcmd<=$#latexcmdline; $firstcmd++) {
- my $option = $latexcmdline[$firstcmd];
- next if substr($option, 0, 1) eq "-";
- if (substr ($option, 0, 1) ne "\\") {
- $jobname = basename $option, ".tex" ;
- $latexcmdline[$firstcmd] = "\\input $option";
- }
- last;
-}
-push @latexcmdline, "" if $#latexcmdline==-1;
-my $separator = "";
-foreach (1 .. 20) {
- $separator .= chr(ord("A") + rand(26));
-}
-$toperl = $jobname . ".topl";
-$fromperl = $jobname . ".frpl";
-$toflag = $jobname . ".tfpl";
-$fromflag = $jobname . ".ffpl";
-$doneflag = $jobname . ".dfpl";
-$logfile = $jobname . ".lgpl";
-$pipe = $jobname . ".pipe";
-$latexcmdline[$firstcmd] =
- sprintf '\makeatletter' . '\def%s{%s}' x 7 . '\makeatother%s',
- '\plmac@tag', $separator,
- '\plmac@tofile', $toperl,
- '\plmac@fromfile', $fromperl,
- '\plmac@toflag', $toflag,
- '\plmac@fromflag', $fromflag,
- '\plmac@doneflag', $doneflag,
- '\plmac@pipe', $pipe,
- $latexcmdline[$firstcmd];
-foreach my $file ($toperl, $fromperl, $toflag, $fromflag, $doneflag, $pipe) {
- unlink $file while -e $file;
-}
-open (LOGFILE, ">$logfile") || die "open(\"$logfile\"): $!\n";
-if (defined $styfile) {
- open (STYFILE, ">$styfile") || die "open(\"$styfile\"): $!\n";
-}
-if (!eval {mkfifo($pipe, 0600)}) {
- sysopen PIPE, $pipe, O_WRONLY|O_CREAT, 0755;
- print PIPE "\\endinput\n";
- close PIPE;
-}
-defined ($latexpid = fork) || die "fork: $!\n";
-unshift @latexcmdline, $latexprog;
-if (!$latexpid) {
- exec {$latexcmdline[0]} @latexcmdline;
- die "exec('@latexcmdline'): $!\n";
-}
-if ($runsafely) {
- @permittedops=(":browse") if $#permittedops==-1;
- $sandbox->permit_only (@permittedops);
- $sandbox_eval = sub {$sandbox->reval($_[0])};
-}
-else {
- $sandbox_eval = \&top_level_eval;
-}
-while (1) {
- my $awaitexists = sub {
- while (!-e $_[0]) {
- sleep 0;
- if (waitpid($latexpid, &WNOHANG)==-1) {
- foreach my $file ($toperl, $fromperl, $toflag,
- $fromflag, $doneflag, $pipe) {
- unlink $file while -e $file;
- }
- undef $latexpid;
- exit 0;
- }
- }
- };
- $awaitexists->($toflag);
- my $entirefile;
- {
- local $/ = undef;
- open (TOPERL, "<$toperl") || die "open($toperl): $!\n";
- $entirefile = <TOPERL>;
- close TOPERL;
- }
- my ($optag, $macroname, @otherstuff) =
- map {chomp; $_} split "$separator\n", $entirefile;
- $macroname =~ s/^[^A-Za-z]+//;
- $macroname =~ s/\W/_/g;
- $macroname = "latex_" . $macroname;
- if ($optag eq "USE") {
- foreach (@otherstuff) {
- s/\\/\\\\/g;
- s/\'/\\\'/g;
- $_ = "'$_'";
- }
- }
- my $perlcode;
- if ($optag eq "DEF") {
- $perlcode =
- sprintf "sub %s {%s}\n",
- $macroname, $otherstuff[0];
- }
- elsif ($optag eq "USE") {
- $perlcode = sprintf "%s (%s);\n", $macroname, join(", ", @otherstuff);
- }
- elsif ($optag eq "RUN") {
- $perlcode = $otherstuff[0];
- }
- else {
- die "${progname}: Internal error -- unexpected operation tag \"$optag\"\n";
- }
- print LOGFILE "#" x 31, " PERL CODE ", "#" x 32, "\n";
- print LOGFILE $perlcode, "\n";
- undef $_;
- my $result;
- {
- my $warningmsg;
- local $SIG{__WARN__} =
- sub {chomp ($warningmsg=$_[0]); return 0};
- $result = $sandbox_eval->($perlcode);
- if (defined $warningmsg) {
- $warningmsg =~ s/at \(eval \d+\) line \d+\W+//;
- print LOGFILE "# ===> $warningmsg\n\n";
- }
- }
- $result = "" if !$result || $optag eq "RUN";
- if ($@) {
- my $msg = $@;
- $msg =~ s/at \(eval \d+\) line \d+\W+//;
- $msg =~ s/\s+/ /;
- $result = "\\PackageError{perltex}{$msg}";
- my @helpstring;
- if ($msg =~ /\btrapped by\b/) {
- @helpstring =
- ("The preceding error message comes from Perl. Apparently,",
- "the Perl code you tried to execute attempted to perform an",
- "`unsafe' operation. If you trust the Perl code (e.g., if",
- "you wrote it) then you can invoke perltex with the --nosafe",
- "option to allow arbitrary Perl code to execute.",
- "Alternatively, you can selectively enable Perl features",
- "using perltex's --permit option. Don't do this if you don't",
- "trust the Perl code, however; malicious Perl code can do a",
- "world of harm to your computer system.");
- }
- else {
- @helpstring =
- ("The preceding error message comes from Perl. Apparently,",
- "there's a bug in your Perl code. You'll need to sort that",
- "out in your document and re-run perltex.");
- }
- my $helpstring = join ("\\MessageBreak\n", @helpstring);
- $helpstring =~ s/\. /.\\space\\space /g;
- $result .= "{$helpstring}";
- }
- push @macroexpansions, $result if defined $styfile && $optag eq "USE";
- print LOGFILE "%" x 30, " LATEX RESULT ", "%" x 30, "\n";
- print LOGFILE $result, "\n\n";
- $result .= '\endinput';
- open (FROMPERL, ">$fromperl") || die "open($fromperl): $!\n";
- syswrite FROMPERL, $result;
- close FROMPERL;
- unlink $toflag while -e $toflag;
- unlink $toperl while -e $toperl;
- unlink $doneflag while -e $doneflag;
- open (FROMFLAG, ">$fromflag") || die "open($fromflag): $!\n";
- close FROMFLAG;
- if (open (PIPE, ">$pipe")) {
-print PIPE "\\endinput\n";
-close PIPE;
- }
- $awaitexists->($toperl);
- unlink $fromflag while -e $fromflag;
- open (DONEFLAG, ">$doneflag") || die "open($doneflag): $!\n";
- close DONEFLAG;
- if (open (PIPE, ">$pipe")) {
-print PIPE "\\endinput\n";
-close PIPE;
- }
-}
-END {
- close LOGFILE;
- if (defined $latexpid) {
- kill (9, $latexpid);
- exit 1;
- }
-
- if (defined $styfile) {
- print STYFILE <<"STYFILEHEADER1";
-\\NeedsTeXFormat{LaTeX2e}[1999/12/01]
-\\ProvidesPackage{noperltex}
- [2007/09/29 v1.4 Perl-free version of PerlTeX specific to $jobname.tex]
-STYFILEHEADER1
- ;
- print STYFILE <<'STYFILEHEADER2';
-\RequirePackage{filecontents}
-
-\let\noperltex@PackageError=\PackageError
-\renewcommand{\PackageError}[3]{}
-\RequirePackage{perltex}
-\let\PackageError=\noperltex@PackageError
-
-\newcount\plmac@macro@invocation@num
-\gdef\plmac@show@placeholder#1#2\@empty{%
- \ifx#1U\relax
- \endgroup
- \advance\plmac@macro@invocation@num by 1\relax
- \global\plmac@macro@invocation@num=\plmac@macro@invocation@num
- \input{noperltex-\the\plmac@macro@invocation@num.tex}%
- \else
- \endgroup
- \fi
-}
-STYFILEHEADER2
- ;
- foreach my $e (0 .. $#macroexpansions) {
- print STYFILE "\n";
- printf STYFILE "%% Invocation #%d\n", 1+$e;
- printf STYFILE "\\begin{filecontents}{noperltex-%d.tex}\n", 1+$e;
- print STYFILE $macroexpansions[$e], "\\endinput\n";
- print STYFILE "\\end{filecontents}\n";
- }
- print STYFILE "\\endinput\n";
- close STYFILE;
- }
-
- exit 0;
-}
-
-__END__
-
-=head1 NAME
-
-perltex - enable LaTeX macros to be defined in terms of Perl code
-
-=head1 SYNOPSIS
-
-perltex
-[B<--help>]
-[B<--latex>=I<program>]
-[B<-->[B<no>]B<safe>]
-[B<--permit>=I<feature>]
-[B<--makesty>]
-[I<latex options>]
-
-=head1 DESCRIPTION
-
-LaTeX -- through the underlying TeX typesetting system -- produces
-beautifully typeset documents but has a macro language that is
-difficult to program. In particular, support for complex string
-manipulation is largely lacking. Perl is a popular general-purpose
-programming language whose forte is string manipulation. However, it
-has no typesetting capabilities whatsoever.
-
-Clearly, Perl's programmability could complement LaTeX's typesetting
-strengths. B<perltex> is the tool that enables a symbiosis between
-the two systems. All a user needs to do is compile a LaTeX document
-using B<perltex> instead of B<latex>. (B<perltex> is actually a
-wrapper for B<latex>, so no B<latex> functionality is lost.) If the
-document includes a C<\usepackage{perltex}> in its preamble, then
-C<\perlnewcommand> and C<\perlrenewcommand> macros will be made
-available. These behave just like LaTeX's C<\newcommand> and
-C<\renewcommand> except that the macro body contains Perl code instead
-of LaTeX code.
-
-=head1 OPTIONS
-
-B<perltex> accepts the following command-line options:
-
-=over 4
-
-=item B<--help>
-
-Display basic usage information.
-
-=item B<--latex>=I<program>
-
-Specify a program to use instead of B<latex>. For example,
-C<--latex=pdflatex> would typeset the given document using
-B<pdflatex> instead of ordinary B<latex>.
-
-=item B<-->[B<no>]B<safe>
-
-Enable or disable sandboxing. With the default of B<--safe>,
-B<perltex> executes the code from a C<\perlnewcommand> or
-C<\perlrenewcommand> macro within a protected environment that
-prohibits ``unsafe'' operations such as accessing files or executing
-external programs. Specifying B<--nosafe> gives the LaTeX document
-I<carte blanche> to execute any arbitrary Perl code, including that
-which can harm the user's files. See L<Safe> for more information.
-
-=item B<--permit>=I<feature>
-
-Permit particular Perl operations to be performed. The B<--permit>
-option, which can be specified more than once on the command line,
-enables finer-grained control over the B<perltex> sandbox. See
-L<Opcode> for more information.
-
-=item B<--makesty>
-
-Generate a LaTeX style file called F<noperltex.sty>. Replacing the
-document's C<\usepackage{perltex}> line with C<\usepackage{noperltex}>
-produces the same output but does not require PerlTeX, making the
-document suitable for distribution to people who do not have PerlTeX
-installed. The disadvantage is that F<noperltex.sty> is specific to
-the document that produced it. Any changes to the document's PerlTeX
-macro definitions or macro invocations necessitates rerunning
-B<perltex> with the B<--makesty> option.
-
-=back
-
-These options are then followed by whatever options are normally
-passed to B<latex> (or whatever program was specified with
-C<--latex>), including, for instance, the name of the F<.tex> file to
-compile.
-
-=head1 EXAMPLES
-
-In its simplest form, B<perltex> is run just like B<latex>:
-
- perltex myfile.tex
-
-To use B<pdflatex> instead of regular B<latex>, use the B<--latex>
-option:
-
- perltex --latex=pdflatex myfile.tex
-
-If LaTeX gives a ``C<trapped by operation mask>'' error and you trust
-the F<.tex> file you're trying to compile not to execute malicious
-Perl code (e.g., because you wrote it yourself), you can disable
-B<perltex>'s safety mechansisms with B<--nosafe>:
-
- perltex --nosafe myfile.tex
-
-The following command gives documents only B<perltex>'s default
-permissions (C<:browse>) plus the ability to open files and invoke the
-C<time> command:
-
- perltex --permit=:browse --permit=:filesys_open
- --permit=time myfile.tex
-
-=head1 ENVIRONMENT
-
-B<perltex> honors the following environment variables:
-
-=over 4
-
-=item PERLTEX
-
-Specify the filename of the LaTeX compiler. The LaTeX compiler
-defaults to ``C<latex>''. The C<PERLTEX> environment variable
-overrides this default, and the B<--latex> command-line option (see
-L</OPTIONS>) overrides that.
-
-=back
-
-=head1 FILES
-
-While compiling F<jobname.tex>, B<perltex> makes use of the following
-files:
-
-=over 4
-
-=item F<jobname.lgpl>
-
-log file written by Perl; helpful for debugging Perl macros
-
-=item F<jobname.topl>
-
-information sent from LaTeX to Perl
-
-=item F<jobname.frpl>
-
-information sent from Perl to LaTeX
-
-=item F<jobname.tfpl>
-
-``flag'' file whose existence indicates that F<jobname.topl> contains
-valid data
-
-=item F<jobname.ffpl>
-
-``flag'' file whose existence indicates that F<jobname.frpl> contains
-valid data
-
-=item F<jobname.dfpl>
-
-``flag'' file whose existence indicates that F<jobname.ffpl> has been
-deleted
-
-=item F<noperltex-#.tex>
-
-file generated by F<noperltex.sty> for each PerlTeX macro invocation
-
-=back
-
-=head1 NOTES
-
-B<perltex>'s sandbox defaults to what L<Opcode> calls ``C<:browse>''.
-
-=head1 SEE ALSO
-
-latex(1), pdflatex(1), perl(1), Safe(3pm), Opcode(3pm)
-
-=head1 AUTHOR
-
-Scott Pakin, I<scott+pt@pakin.org>
diff --git a/Build/source/texk/texlive/pkfix b/Build/source/texk/texlive/pkfix
deleted file mode 100755
index 1429889b9ec..00000000000
--- a/Build/source/texk/texlive/pkfix
+++ /dev/null
@@ -1,860 +0,0 @@
-eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' && eval 'exec perl -S $0 $argv:q'
- if 0;
-use strict;
-$^W=1; # turn warning on
-#
-# pkfix.pl
-#
-# Copyright (C) 2001, 2005 Heiko Oberdiek.
-#
-# This work may be distributed and/or modified under the
-# conditions of the LaTeX Project Public License, either version 1.3
-# of this license or (at your option) any later version.
-# The latest version of this license is in
-# http://www.latex-project.org/lppl.txt
-# and version 1.3 or later is part of all distributions of LaTeX
-# version 2003/12/01 or later.
-# This work has the LPPL maintenance status "maintained".
-# This Current Maintainer of this work is Heiko Oberdiek.
-#
-# See file "README" for a list of files that belongs to this project.
-#
-# This file "pkfix.pl" may be renamed to "pkfix"
-# for installation purposes.
-#
-my $file = "pkfix.pl";
-my $program = uc($&) if $file =~ /^\w+/;
-my $project = lc($program);
-my $version = "1.3";
-my $date = "2005/02/25";
-my $author = "Heiko Oberdiek";
-my $copyright = "Copyright (c) 2001, 2005 by $author.";
-#
-# Reqirements: Perl5, dvips
-# History:
-# 2001/04/12 v0.1:
-# * First try.
-# 2001/04/13 v0.2:
-# * TeX/dvips is called for each font for the case of errors.
-# * First release.
-# 2001/04/15 v0.3:
-# * Call of kpsewhich with option --progname.
-# * Extracting of texps.pro from temporary PostScript file,
-# if kpsewhich failed.
-# * Option -G0 for dvips run added.
-# 2001/04/16 v0.4:
-# * Support for merging PostScript fonts added.
-# * \special{!...}/@fedspecial detection added.
-# * Bug fix: I detection.
-# 2001/04/17 v0.5:
-# * Redirection of stderr (dvips run) if possible.
-# 2001/04/20 v0.6:
-# * Bug fix: dvips font names can contain numbers.
-# 2001/04/21 v0.7:
-# * Bug fix: long dvi file name in ps file.
-# 2001/04/23 v0.8:
-# * Bug fix: post string parsing.
-# 2001/04/26 v0.9:
-# * Check of version number of dvips in PostScript file.
-# 2001/06/30 v1.0:
-# * Problem with DOS line endings fixed.
-# 2005/01/28 v1.1:
-# * Bug fix: encoding files are now included also.
-# * The intermediate DVI files are written directly.
-# * LPPL 1.3
-# 2005/01/29 v1.2:
-# * Merging is now based on type 1 names. This solves
-# the problem, if different bitmap fonts maps to the
-# same type 1 font, eg. (ecrm1000, larm1000) -> SFRM1000.
-# * Suppression of PK generation, if environment variable
-# MKTEXPK is supported.
-# * If output file is "-" (standard output) then messages of
-# pkfix are written to standard error output.
-# 2005/02/25 v1.3:
-# * Bug fix: Detection of "@fedspecial end" improved.
-# * Bug fix: Typo corrected (PRT -> $PRT).
-#
-
-### program identification
-my $title = "$program $version, $date - $copyright\n";
-
-### error strings
-my $Error = "!!! Error:"; # error prefix
-my $Warning = "!!! Warning:"; # warning prefix
-
-### variables
-my $envvar = uc($project);
-my $infile = "";
-my $outfile = "";
-my $texpsfile = "texps.pro";
-my $prefix = "_${project}_$$";
-# my $prefix = "_${project}_";
-my $tempfile = "$prefix";
-my $texfile = "$tempfile.tex";
-my $dvifile = "$tempfile.dvi";
-my $logfile = "$tempfile.log";
-my $psfile = "$tempfile.ps";
-my $missfile = "missfont.log";
-my @cleanlist = ($dvifile, $psfile);
-push(@cleanlist, $missfile) unless -f $missfile;
-
-my $err_redirect = " 2>&1";
-$err_redirect = "" if $^O =~ /dos/i ||
- $^O =~ /os2/i ||
- $^O =~ /mswin32/i ||
- $^O =~ /cygwin/i;
-
-my $x_resolution = 0;
-my $y_resolution = 0;
-my $blocks_found = 0;
-my $fonts_converted = 0;
-my $fonts_merged = 0;
-my $fonts_misses = 0;
-my $PRT = \*STDOUT;
-
-### option variables
-my @bool = ("false", "true");
-$::opt_tex = "tex";
-$::opt_dvips = "dvips";
-$::opt_kpsewhich = "kpsewhich --progname $project";
-$::opt_options = "-Ppdf -G0";
-$::opt_usetex = 0;
-$::opt_help = 0;
-$::opt_quiet = 0;
-$::opt_debug = 0;
-$::opt_verbose = 0;
-$::opt_clean = 1;
-
-my $usage = <<"END_OF_USAGE";
-${title}Syntax: \L$program\E [options] <inputfile.ps> <outputfile.ps>
-Function: This program tries to replace pk fonts in <inputfile.ps>
- by the type 1 versions. The result is written in <outputfile.ps>.
-Options: (defaults:)
- --help print usage
- --(no)quiet suppress messages ($bool[$::opt_quiet])
- --(no)verbose verbose printing ($bool[$::opt_verbose])
- --(no)debug debug informations ($bool[$::opt_debug])
- --(no)clean clear temp files ($bool[$::opt_clean])
- --(no)usetex use TeX for generating the DVI file ($bool[$::opt_usetex])
- --tex texcmd tex command name (plain format) ($::opt_tex)
- --dvips dvipscmd dvips command name ($::opt_dvips)
- --options opt dvips options ($::opt_options)
-END_OF_USAGE
-
-### environment variable PKFIX
-if ($ENV{$envvar}) {
- unshift(@ARGV, split(/\s+/, $ENV{$envvar}));
-}
-
-### process options
-my @OrgArgv = @ARGV;
-use Getopt::Long;
-GetOptions(
- "help!",
- "quiet!",
- "debug!",
- "verbose!",
- "clean!",
- "usetex!",
- "tex=s",
- "dvips=s",
- "options=s"
-) or die $usage;
-!$::opt_help or die $usage;
-@ARGV < 3 or die "$usage$Error Too many files!\n";
-@ARGV == 2 or die "$usage$Error Missing file names!\n";
-
-$::opt_quiet = 0 if $::opt_verbose;
-$::opt_clean = 0 if $::opt_debug;
-
-push(@cleanlist, $texfile, $logfile) if $::opt_usetex;
-
-### get file names
-$infile = $ARGV[0];
-$outfile = $ARGV[1];
-
-### suppress PK generation
-$ENV{'MKTEXPK'} = "0";
-
-$PRT = \*STDERR if $outfile eq "-";
-
-print $PRT $title unless $::opt_quiet;
-
-print $PRT "*** input file: `$infile'\n" if $::opt_verbose;
-print $PRT "*** output file: `$outfile'\n" if $::opt_verbose;
-
-if ($::opt_debug) {
- print $PRT <<"END_DEB";
-*** OSNAME: $^O
-*** PERL_VERSION: $]
-*** ARGV: @OrgArgv
-END_DEB
-}
-
-### get texps.pro
-my $texps_data = 0;
-my $texps_string = get_texps_pro();
-
-### Encoding definitions
-my %encoding_files = ();
-my $encoding_string = "";
-
-### open input and output files
-open(IN, $infile) or die "$Error Cannot open `$infile'!\n";
-open(OUT, ">$outfile") or die "$Error Cannot write `$outfile'!\n";
-
-##################################
-# expected format:
-# ...
-# %%DVIPSParameters:... dpi=([\dx]+)...
-# ...
-# TeXDict begin \d+ \d+ \d+ \d+ \d+ \(\S+\)
-# @start ...
-# ...
-# %DVIPSBitmapFont: (\S+) (\S+) ([\d\.]+) (\d+)
-# /(\S+) ...
-# ...
-# %EndDVIPSBitmapFont
-# ...
-# ... end
-# %%EndProlog
-#
-# or if \special{!...} was used, the lines with TeXDict:
-# TeXdict begin @defspecial
-#
-# ...
-#
-# @fedspecial end TeXDict begin
-# \d+ \d+ \d+ \d+ \d+ \(\S+\) @start
-#
-# or
-# @fedspecial end
-# ...
-#
-# bitmap font:
-# start:
-# %%DVIPSBitmapFont: {dvips font} {font name} {at x pt} {chars}
-# /{dvips font} {chars} {max. char number + 1} df
-# character, variant a:
-# <{hex code}>{char number} D
-# character, variant b:\
-# [<{hex code}>{num1} {num2} {num3} {num4} {num5} {char number} D
-# end:
-# E
-# %%EndDVIPSBitmapFont
-#
-# type 1 font:
-# before TeXDict line:
-# %%BeginFont: CMR10
-# ...
-# %%EndFont
-# after @start:
-# /Fa ... /CMR10 rf
-#
-# Font names: /[F-Z][a-zA-Z0-9]
-#
-# Encoding files before texps.pro:
-# %%BeginProcSet: {file name}.enc 0 0
-# ...
-# %%EndProcSet
-###################################
-
-my $x_comment_resolution = 0;
-my $y_comment_resolution = 0;
-my $start_string = "";
-my $post_string = "";
-my $dvips_resolution = "";
-my $texps_found = 0;
-my @font_list = ();
-my %font_txt = ();
-my %font_count = ();
-my %font_entry = ();
-
-sub init {
- $x_comment_resolution = 0;
- $y_comment_resolution = 0;
- $x_resolution = 0;
- $y_resolution = 0;
- $start_string = "";
- $texps_found = 0;
- @font_list = ();
- %font_txt = ();
- %font_count = ();
- %font_entry = ();
-}
-
-init();
-
-while (<IN>) {
-
- if (/^%%Creator: (dvips\S*) (\S+)\s/) {
- print $PRT "*** %%Creator: $1 $2\n" if $::opt_debug;
- my $foundversion = $2;
- if ($foundversion =~ /(\d+\.\d+)/) {
- $foundversion = $1;
- # 5.62 is ok, 5.58 does not produce font comments
- if ($foundversion <= 5.58) {
- print $PRT "$Warning dvips version $1 does not generate " .
- "the required font comments!\n";
- }
- }
- }
-
- if (/^%%BeginProcSet:\s*(.+)\.enc/) {
- $encoding_files{$1} = "";
- }
-
- if (/^%DVIPSParameters:.*dpi=([\dx]+)/) {
- print OUT;
- my $str = $1;
- $x_comment_resolution = 0;
- $y_comment_resolution = 0;
- if ($str =~ /^(\d+)x(\d+)$/) {
- $x_comment_resolution = $1;
- $y_comment_resolution = $2;
- }
- if ($str =~ /^(\d+)$/) {
- $x_comment_resolution = $1;
- $y_comment_resolution = $1;
- }
- print $PRT "*** %DVIPSParameters: dpi=$str " .
- "(x=$x_comment_resolution, y=$y_comment_resolution)\n"
- if $::opt_debug;
- $x_comment_resolution > 0 && $y_comment_resolution > 0 or
- die "$Error Wrong resolution value " .
- "($x_comment_resolution x $y_comment_resolution)!\n";
- next;
- }
-
- if (/^%%BeginProcSet: texps.pro/) {
- $texps_found = 1;
- print $PRT "*** texps.pro found\n" if $::opt_debug;
- }
-
- if (/^TeXDict begin \@defspecial/) {
- my $saved = $_;
- print $PRT "*** \@defspecial found.\n" if $::opt_debug;
- $start_string = $_;
- while (<IN>) {
- $start_string .= $_;
- if (/^\@fedspecial end/) {
- s/^\@fedspecial end\s*(\S)/$1/;
- last;
- }
- }
- }
- elsif (/^TeXDict begin \d+ \d+ \d+ \d+ \d+/) {
- print $PRT "*** TeXDict begin <5 nums> found.\n" if $::opt_debug;
- $start_string = $_;
- }
- if ($start_string ne "") {
- # look for @start
- unless (/\@start/) {
- while (<IN>) {
- $start_string .= $_;
- last if /\@start/;
- }
- }
-
- # divide post part
- $start_string =~ /^([\s\S]*\@start)\s*([\s\S]*)$/ or
- die "$Error Parse error (\@start)!\n";
- $start_string = "$1\n";
- $post_string = $2;
- $post_string =~ s/\s*$//;
- $post_string .= "\n" unless $post_string eq "";
-
- $start_string =~
- /\d+\s+\d+\s+\d+\s+(\d+)\s+(\d+)\s+\((.*)\)\s+\@start/ or
- die "$Error Parse error (\@start parameters)!\n";
-
- $blocks_found++;
- print $PRT "*** dvi file: $3\n" if $::opt_debug;
-
- # get and check resolution values
- $x_resolution = $1;
- $y_resolution = $2;
- print $PRT "*** resolution: $x_resolution x $y_resolution\n"
- if $::opt_debug;
- $x_comment_resolution > 0 or
- die "$Error Missing comment `%DVIPSParameters'!\n";
- $x_resolution == $x_comment_resolution &&
- $y_resolution == $y_comment_resolution or
- die "$Error Resolution values in comment and PostScript " .
- "does not match!\n";
- # setting dvips resolution option(s)
- if ($x_resolution == $y_resolution) {
- $dvips_resolution = "-D $x_resolution";
- }
- else {
- $dvips_resolution = "-X $x_resolution -Y $y_resolution";
- }
-
- while (<IN>) {
- if (/^%%EndProlog/) {
- print OUT $encoding_string;
- $texps_data > 0 or die "$Error File `texps.pro' not found!\n";
- print OUT $texps_string unless $texps_found;
- foreach (@font_list) {
- my $fontname = $_;
- print $PRT "*** Adding font `$fontname'\n"
- if $::opt_debug;
- my ($dummy1, $dummy2, $err);
- if ($font_count{$fontname} > 1) {
- $fonts_merged++;
- print $PRT "*** Merging font `$fontname' ($font_count{$fontname}).\n"
- unless $::opt_quiet;
- ($dummy1, $font_txt{$fontname}, $dummy2, $err) =
- get_font($font_entry{$fontname});
- $err == 0 or die "$Error Cannot merge font `$fontname'!\n";
- }
- print OUT $font_txt{$fontname};
- }
- print OUT $start_string,
- $post_string,
- $_;
- print $PRT "*** %%EndProlog\n" if $::opt_debug;
- init();
- last;
- }
-
- if (/^%DVIPSBitmapFont: (\S+) (\S+) ([\d.]+) (\d+)/) {
- my $bitmap_string = $_;
- my $dvips_fontname = $1;
- my $fontname = $2;
- my $entry = "\\Font\{$1\}\{$2\}\{$3\}\{";
- print $PRT "*** Font $1: $2 at $3pt, $4 chars\n" if $::opt_verbose;
- my $line = "";
- my $num = -1;
- my $chars = $4;
- my $count = 0;
- while (<IN>) {
- $bitmap_string .= $_;
- last if /^%EndDVIPSBitmapFont/;
- s/\r$//; # remove \r of possible DOS line ending
- chomp;
- $line .= " " . $_;
- }
- $line =~ s/<[0-9A-F ]*>/ /g;
-
- print $PRT "*** <Font> $line\n" if $::opt_debug;
-
- while ($line =~ /\s(\d+)\s+D(.*)/) {
- $num = $1;
- $count++;
- $entry .= "$num,";
- $line = $2;
- while ($line =~ /^[\s\d\[]*I(.*)/) {
- $num++;
- $count++;
- $entry .= "$num,";
- $line = $1;
- }
- }
- $chars == $count or
- die "$Error Parse error, $count chars of $chars found " .
- "($fontname)!\n";
-
- $entry =~ s/,$//;
- $entry .= "\}";
-
- print $PRT "*** Font conversion of `$fontname' started.\n"
- if $::opt_verbose;
- my ($newfontname, $font_part, $start_part, $err) = get_font($entry);
- if ($err == 0) {
- print $PRT "*** Font conversion: `$fontname' -> `$newfontname'.\n"
- unless $::opt_quiet;
- if (defined($font_count{$newfontname})) {
- $font_count{$newfontname}++;
- $font_entry{$newfontname} .= "\n$entry";
- }
- else {
- push @font_list, $newfontname;
- $font_txt{$newfontname} = $font_part;
- $font_count{$newfontname} = 1;
- $font_entry{$newfontname} = $entry;
- }
- $start_part =~ s/\/Fa/\/$dvips_fontname/;
- $start_string .= $start_part;
- $fonts_converted++;
- }
- else {
- print $PRT "!!! Failed font conversion of `$fontname'!\n";
- $start_string .= $bitmap_string;
- $fonts_misses++;
- }
-
- next;
- }
-
- $post_string .= $_;
- }
- next;
- }
-
- print OUT;
-}
-
-close(IN);
-close(OUT);
-
-if ($::opt_clean) {
- print $PRT "*** clear temp files\n" if $::opt_verbose;
- foreach (@cleanlist) {
- unlink;
- }
-}
-
-if (!$::opt_quiet) {
- if ($blocks_found > 1) {
- print $PRT "==> $blocks_found blocks.\n";
- }
- if ($fonts_misses) {
- print $PRT "==> $fonts_misses font conversion",
- (($fonts_misses > 1) ? "s" : ""),
- " failed.\n";
- }
- if ($fonts_converted) {
- print $PRT "==> ",
- (($fonts_converted > 0) ? $fonts_converted : "No"),
- " converted font",
- (($fonts_converted > 1) ? "s" : ""),
- ".\n";
- if ($fonts_merged) {
- print $PRT "==> $fonts_merged merged font",
- (($fonts_merged > 1) ? "s" : ""),
- ".\n";
- }
- }
- else {
- print $PRT "==> no fonts converted\n";
- }
-}
-
-
-# get type 1 font
-# param: $entry: font entry as TeX string
-# return: $name: type 1 font name
-# $font: font file as string
-# $start: font definition after @start
-# $err: error indication
-sub get_font {
- my $entry = shift;
- my $name = "";
- my $font = "";
- my $start = "";
- my $err = 0;
- my @err = ("", "", "", 1);
- local *OUT;
- local *IN;
-
- if ($::opt_usetex) {
- ### write temp tex file
- open(OUT, ">$texfile") or die "$Error Cannot write `$texfile'!\n";
- print OUT <<'TEX_HEADER';
-\nonstopmode
-\nopagenumbers
-\def\Font#1#2#3#4{%
- \expandafter\font\csname font@#1\endcsname=#2 at #3pt\relax
- \csname font@#1\endcsname
- \hbox to 0pt{%
- \ScanChar#4,\NIL
- \hss
- }%
-}
-\def\ScanChar#1,#2\NIL{%
- \char#1\relax
- \ifx\\#2\\%
- \else
- \ReturnAfterFi{%
- \ScanChar#2\NIL
- }%
- \fi
-}
-\long\def\ReturnAfterFi#1\fi{\fi#1}
-\noindent
-TEX_HEADER
-
- print OUT "$entry\n\\bye\n";
- close(OUT);
-
- ### run tex
- {
- print $PRT "*** run TeX\n" if $::opt_verbose;
-
- my $cmd = "$::opt_tex $tempfile";
- print $PRT ">>> $cmd\n" if $::opt_verbose;
- my @capture = `$cmd`;
- if (!defined(@capture)) {
- print $PRT "$Warning Cannot execute TeX!\n";
- return @err;
- }
- if ($::opt_verbose) {
- print $PRT @capture;
- }
- else {
- foreach (@capture) {
- print $PRT if /^!\s/;
- }
- }
- if ($?) {
- my $exitvalue = $?;
- if ($exitvalue > 255) {
- $exitvalue >>= 8;
- print $PRT "$Warning Closing TeX (exit status: $exitvalue)!\n";
- return @err;
- }
- print $PRT "$Warning Closing TeX ($exitvalue)!\n";
- return @err;
- }
- }
- }
- else {
- # write dvi directly
-
- # DVI format description: dvitype.web
- my $DVI_pre = 247;
- my $DVI_id_byte = 2;
- my $DVI_num = 25400000;
- my $DVI_den = 473628672; # 7227 * 2^16
- my $DVI_mag = 1000;
- my @t = localtime(time);
- my $DVI_comment = "$program $version output "
- . sprintf("%04d/%02d/%02d %02d:%02d:%02d",
- ($t[5] + 1900), ($t[4] + 1), $t[3], $t[2], $t[1], $t[0]);
- my $DVI_comment_len = length($DVI_comment);
- my $DVI_bop = 139;
- my $DVI_eop = 140;
- my $DVI_fontdef1 = 243;
- my $DVI_fontdef2 = 244;
- my $DVI_fontdef4 = 246;
- my $DVI_design_size = 10; # an arbitrary value
- # A wrong value will trigger a dvips warning
- # (it can be seen in verbose mode):
- # dvips: Design size mismatch in [...].tfm
- # But other consequences could not be noticed.
- # Thus a TFM lookup will be saved.
- my $DVI_checksum = 0; # because of unknown checksum
- my $DVI_fnt_num_0 = 171;
- my $DVI_fnt1 = 235;
- my $DVI_fnt2 = 236;
- my $DVI_fnt4 = 238;
- my $DVI_set1 = 128;
- my $DVI_push = 141;
- my $DVI_pop = 142;
- my $DVI_post = 248;
- my $DVI_u = 67108864; # 1024 pt, an arbitrary value
- my $DVI_l = 67108864; # 1024 pt, an arbitrary value
- my $DVI_post_post = 249;
- my $DVI_trailing = 223;
-
- open(OUT, ">$dvifile") or die "$Error Cannot write `$dvifile'!\n";
- binmode(OUT);
-
- # Preamble (pre)
- print OUT pack("C2N3Ca$DVI_comment_len",
- $DVI_pre, $DVI_id_byte, $DVI_num, $DVI_den, $DVI_mag,
- $DVI_comment_len, $DVI_comment);
- # Begin of page (bop)
- my $pos_bop = tell(OUT);
- print OUT pack("CN1x[N9]l", $DVI_bop, 1, -1);
-
- my $font_defs = "";
- my $font_num = 0;
- foreach(split("\n", $entry)) {
- my $font_def = "";
- /\\Font\{[^}]*\}\{([^}]*)\}\{([^}]*)\}\{([^}]*)\}/ or
- die "!!! Error: Internal parsing error!\n";
- my $font_name = $1;
- my $font_name_len = length($font_name);
- my $font_size = $2;
- my $font_chars = $3;
-
- # define font
- if ($font_num < 256) {
- $font_def = pack("CC", $DVI_fontdef1, $font_num);
- }
- # The other cases are very unlikely, especially there are
- # more than one font in the merging case only.
- elsif ($font_num < 65536) {
- $font_def = pack("Cn", $DVI_fontdef2, $font_num);
- }
- else {
- $font_def = pack("CN", $DVI_fontdef4, $font_num);
- }
- $font_def .= pack("x[N]N2xCa$font_name_len",
- ($font_size * 65536), $DVI_design_size,
- $font_name_len, $font_name);
- print OUT $font_def;
- $font_defs .= $font_def;
-
- # use font
- my $fnt_num;
- if ($font_num < 64) {
- $fnt_num = pack("C", $DVI_fnt_num_0 + $font_num);
- }
- # Other cases are unlikely, see above.
- elsif ($font_num < 256) {
- $fnt_num = pack("CC", $DVI_fnt1, $font_num);
- }
- elsif ($font_num < 65536) {
- $fnt_num = pack("Cn", $DVI_fnt2, $font_num);
- }
- else {
- $fnt_num = pack("CN", $DVI_fnt4, $font_num);
- }
- print OUT $fnt_num;
-
- # print characters
- print OUT pack("C", $DVI_push);
- foreach (split(",", $font_chars)) {
- if ($_ < 128) {
- print OUT pack("C", $_);
- }
- else {
- print OUT pack("CC", $DVI_set1, $_);
- }
- }
- print OUT pack("C", $DVI_pop);
-
- $font_num++;
- }
-
- print OUT pack("C", $DVI_eop);
-
- # Begin of postamble (post)
- my $pos_post = tell(OUT);
- print OUT pack("CN6n2",
- $DVI_post, $pos_bop, $DVI_num, $DVI_den, $DVI_mag,
- $DVI_l, $DVI_u, 1, 1);
- print OUT $font_defs;
- # End of postamble (post_post)
- print OUT pack("CNC5",
- $DVI_post_post, $pos_post, $DVI_id_byte,
- $DVI_trailing, $DVI_trailing, $DVI_trailing, $DVI_trailing);
- my $t_num = (4 - (tell(OUT) % 4)) % 4;
- print OUT pack("C", $DVI_trailing) x $t_num;
- close(OUT);
- }
-
- ### run dvips
- {
- print $PRT "*** run dvips\n" if $::opt_verbose;
-
- my $cmd = "$::opt_dvips $::opt_options $dvips_resolution $tempfile";
- print $PRT ">>> $cmd\n" if $::opt_verbose;
- # dvips writes on stderr :-(
- my @capture = `$cmd$err_redirect`;
- if ($::opt_verbose) {
- print $PRT @capture;
- }
- if ($?) {
- my $exitvalue = $?;
- if ($exitvalue > 255) {
- $exitvalue >>= 8;
- print $PRT "$Warning Closing dvips (exit status: $exitvalue)!\n";
- return @err;
- }
- print $PRT "$Warning Closing dvips ($exitvalue)!\n";
- return @err;
- }
- }
-
- ### get font and start part
- open(IN, $psfile) or die "$Error Cannot open `$psfile'!\n";
-
- while (<IN>) {
- ### get possible encoding files
- if (/^%%BeginProcSet:\s*(.+)\.enc/) {
- my $encoding_file = $1;
- print $PRT "*** encoding file `$encoding_file.enc' found.\n"
- if $::opt_debug;
- next if defined($encoding_files{$encoding_file});
- $encoding_files{$encoding_file} = "";
- $encoding_string .= $_;
- while (<IN>) {
- $encoding_string .= $_;
- last if /^%%EndProcSet/;
- }
- next;
- }
-
- ### get texps.pro if get_texps_pro() has failed
- if ($texps_data == 0 && /^%%BeginProcSet: texps.pro/) {
- $texps_string = $_;
- while (<IN>) {
- $texps_string .= $_;
- last if /^%%EndProcSet/;
- }
- $texps_data = 1;
- print $PRT "*** texps.pro extracted.\n" if $::opt_debug;
- next;
- }
-
- if (/^%%BeginFont:\s*(\S+)/) {
- $name = $1;
- $font .= $_;
- while (<IN>) {
- $font .= $_;
- last if /^%%EndFont/;
- }
- next;
- }
- if (/^\@start/) {
- s/^\@start\s*//;
- $start .= $_;
- while (<IN>) {
- last if /^%%EndProlog/;
- $start .= $_;
- }
- if (($start =~ s/\s*end\s*$/\n/) != 1) {
- $err = 1;
- print $PRT "$Warning Parse error, `end' not found!\n";
- }
- print $PRT "*** start: $start" if $::opt_debug;
- last;
- }
- }
- close(IN);
-
- if ($font eq "") {
- print $PRT "$Warning `%%BeginFont' not found!\n";
- return @err;
- }
- return ($name, $font, $start, $err);
-}
-
-
-# get_texps_pro
-# return: string with content of texps.pro
-sub get_texps_pro {
- $texps_data = 0;
- # get file name
- my $backupWarn = $^W;
- $^W = 0;
- my $file = `$::opt_kpsewhich $texpsfile`;
- $^W = $backupWarn;
- if (!defined($file) or $file eq "") {
- print $PRT "$Warning: Cannot find `$texpsfile' with kpsewhich!\n"
- if $::opt_debug;
- return "";
- }
- chomp $file;
- print $PRT "*** texps.pro: $file\n" if $::opt_debug;
-
- # read file
- local *IN;
- open(IN, $file) or die "$Error: Cannot open `$file'!\n";
- my @lines = <IN>;
- @lines > 0 or die "$Error: Empty file `$file'!\n";
- chomp $lines[@lines-1];
- my $str = "%%BeginProcSet: texps.pro\n";
- $"="";
- $str .= "@lines\n";
- $"=" ";
- $str .= "%%EndProcSet\n";
- $texps_data = 1;
- return $str;
-}
-
-__END__
diff --git a/Build/source/texk/texlive/ppower4 b/Build/source/texk/texlive/ppower4
deleted file mode 100755
index 77b9f61337f..00000000000
--- a/Build/source/texk/texlive/ppower4
+++ /dev/null
@@ -1,27 +0,0 @@
-#!/bin/sh
-#
-# PPower4 shell script file last update: 30oct05 (tl2005)
-#
-# minimal usage:
-# ppower4 input.pdf output.pdf
-#
-# Note: input.pdf and output.pdf must be different.
-#
-# It is assumed that you have at least Java 1.2.x installed
-# and can call it with the command java. Otherwise specify the
-# path for your Java runtime system.
-#
-# Modify this script such that jarfile contains the full path
-# of the pp4p.jar file.
-#
-# jarfile=/common/Java/lib/ppower4/pp4p.jar
-#
-# If you use a web2c distribution, you can place pp4p.jar
-# e.g. into the directory texmf/java/ppower4, run mktexlsr,
-# comment the assignment above and uncomment the assignment below.
-# Thanks to Reinhard Kotucha for contributing this suggestion.
-#
-jarfile=`kpsewhich -format=texmfscripts pp4p.jar`
-#
-#
-java -jar ${jarfile} "$@"