summaryrefslogtreecommitdiff
path: root/Master
diff options
context:
space:
mode:
Diffstat (limited to 'Master')
-rwxr-xr-xMaster/bin/i386-linux/perltex67
1 files changed, 65 insertions, 2 deletions
diff --git a/Master/bin/i386-linux/perltex b/Master/bin/i386-linux/perltex
index dd8dda2804b..2cd326f5f57 100755
--- a/Master/bin/i386-linux/perltex
+++ b/Master/bin/i386-linux/perltex
@@ -15,7 +15,7 @@
#
# This is a generated file.
#
-# Copyright (C) 2006, Scott Pakin <scott+pt@pakin.org>
+# 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
@@ -52,6 +52,8 @@ my $toflag;
my $fromflag;
my $doneflag;
my $logfile;
+my $styfile;
+my @macroexpansions;
my $sandbox = new Safe;
my $sandbox_eval;
my $latexpid;
@@ -60,6 +62,7 @@ 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;
@@ -96,6 +99,9 @@ foreach my $file ($toperl, $fromperl, $toflag, $fromflag, $doneflag) {
unlink $file while -e $file;
}
open (LOGFILE, ">$logfile") || die "open(\"$logfile\"): $!\n";
+if (defined $styfile) {
+ open (STYFILE, ">$styfile") || die "open(\"$styfile\"): $!\n";
+}
defined ($latexpid = fork) || die "fork: $!\n";
unshift @latexcmdline, $latexprog;
if (!$latexpid) {
@@ -173,7 +179,7 @@ while (1) {
print LOGFILE "# ===> $warningmsg\n\n";
}
}
- $result="" if !$result || $optag eq "RUN";
+ $result = "" if !$result || $optag eq "RUN";
if ($@) {
my $msg = $@;
$msg =~ s/at \(eval \d+\) line \d+\W+//;
@@ -202,6 +208,7 @@ while (1) {
$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';
@@ -224,6 +231,46 @@ END {
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;
}
@@ -240,6 +287,7 @@ perltex
[B<--latex>=I<program>]
[B<-->[B<no>]B<safe>]
[B<--permit>=I<feature>]
+[B<--makesty]
[I<latex options>]
=head1 DESCRIPTION
@@ -295,6 +343,17 @@ 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
@@ -376,6 +435,10 @@ valid data
``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