diff options
author | Karl Berry <karl@freefriends.org> | 2009-11-26 19:31:48 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2009-11-26 19:31:48 +0000 |
commit | de7b76c392abe4463c6a765f01b58096a8ebd040 (patch) | |
tree | 3b2fbc1421f3037068addd66954095a24d042963 /Master | |
parent | cee29d1652d5add426ac3aae626f1700ed9e7458 (diff) |
perltex 2.0 (24nov09)
git-svn-id: svn://tug.org/texlive/trunk@16180 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r-- | Master/texmf-dist/doc/latex/perltex/perltex.pdf | bin | 333020 -> 333605 bytes | |||
-rwxr-xr-x | Master/texmf-dist/scripts/perltex/perltex.pl (renamed from Master/texmf-dist/scripts/perltex/perltex) | 10 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/perltex/perltex.dtx | 23 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/perltex/perltex.sty | 2 | ||||
-rw-r--r-- | Master/texmf/doc/man/man1/perltex.1 | 280 | ||||
-rwxr-xr-x | Master/tlpkg/libexec/ctan2tds | 3 | ||||
-rw-r--r-- | Master/tlpkg/tlpsrc/perltex.tlpsrc | 2 |
7 files changed, 316 insertions, 4 deletions
diff --git a/Master/texmf-dist/doc/latex/perltex/perltex.pdf b/Master/texmf-dist/doc/latex/perltex/perltex.pdf Binary files differindex 1af4c31e085..19db36b997c 100644 --- a/Master/texmf-dist/doc/latex/perltex/perltex.pdf +++ b/Master/texmf-dist/doc/latex/perltex/perltex.pdf diff --git a/Master/texmf-dist/scripts/perltex/perltex b/Master/texmf-dist/scripts/perltex/perltex.pl index 47f8cfc27ec..64309cc1926 100755 --- a/Master/texmf-dist/scripts/perltex/perltex +++ b/Master/texmf-dist/scripts/perltex/perltex.pl @@ -39,6 +39,7 @@ use Pod::Usage; use File::Basename; use Fcntl; use POSIX; +use Cwd qw(abs_path); use IO::Handle; use warnings; use strict; @@ -104,6 +105,13 @@ $latexcmdline[$firstcmd] = '\plmac@doneflag', $doneflag, '\plmac@pipe', $pipe, $latexcmdline[$firstcmd]; +$toperl = abs_path $toperl; +$fromperl = abs_path $fromperl; +$toflag = abs_path $toflag; +$fromflag = abs_path $fromflag; +$doneflag = abs_path $doneflag; +$logfile = abs_path $logfile; +$pipe = abs_path $pipe; $SIG{"ALRM"} = sub { undef $latexpid; exit 0; @@ -133,6 +141,7 @@ sub awaitexists ($) } delete_files($toperl, $fromperl, $toflag, $fromflag, $doneflag, $pipe); open (LOGFILE, ">$logfile") || die "open(\"$logfile\"): $!\n"; +autoflush LOGFILE 1; if (defined $styfile) { open (STYFILE, ">$styfile") || die "open(\"$styfile\"): $!\n"; } @@ -211,6 +220,7 @@ while (1) { if ($@) { my $msg = $@; $msg =~ s/at \(eval \d+\) line \d+\W+//; + $msg =~ s/\n/\\MessageBreak\n/g; $msg =~ s/\s+/ /; $result = "\\PackageError{perltex}{$msg}"; my @helpstring; diff --git a/Master/texmf-dist/source/latex/perltex/perltex.dtx b/Master/texmf-dist/source/latex/perltex/perltex.dtx index ea9bee773ea..4513a50f8d3 100644 --- a/Master/texmf-dist/source/latex/perltex/perltex.dtx +++ b/Master/texmf-dist/source/latex/perltex/perltex.dtx @@ -22,7 +22,7 @@ %<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01] %<package>\ProvidesPackage{perltex} %<*package> - [2009/09/13 v1.9 LaTeX macros for use with PerlTeX] + [2009/11/24 v2.0 LaTeX macros for use with PerlTeX] %</package> % %<*driver> @@ -62,7 +62,7 @@ %</driver> % \fi % -% \CheckSum{597} +% \CheckSum{601} % % \CharacterTable % {Upper-case \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 @@ -2192,6 +2192,7 @@ use Pod::Usage; use File::Basename; use Fcntl; use POSIX; +use Cwd qw(abs_path); use IO::Handle; use warnings; use strict; @@ -2429,6 +2430,19 @@ $latexcmdline[$firstcmd] = % % \subsubsection{Increasing \PerlTeX's robustness} % +% \changes{v2.0}{2009/11/24}{Refer to each communication file using +% its absolute path. This makes \perltex\ robust to user code +% that changes the current directory} +% \begin{macrocode} +$toperl = abs_path $toperl; +$fromperl = abs_path $fromperl; +$toflag = abs_path $toflag; +$fromflag = abs_path $fromflag; +$doneflag = abs_path $doneflag; +$logfile = abs_path $logfile; +$pipe = abs_path $pipe; +% \end{macrocode} +% % \changes{v1.9}{2009/09/13}{Introduced handlers for \textsc{sigalrm} % and \textsc{sigpipe} to make \perltex\ more robust to \texttt{latex} % exiting at an inopportune time} @@ -2516,6 +2530,7 @@ sub awaitexists ($) % \begin{macrocode} delete_files($toperl, $fromperl, $toflag, $fromflag, $doneflag, $pipe); open (LOGFILE, ">$logfile") || die "open(\"$logfile\"): $!\n"; +autoflush LOGFILE 1; if (defined $styfile) { open (STYFILE, ">$styfile") || die "open(\"$styfile\"): $!\n"; } @@ -2729,6 +2744,9 @@ while (1) { % \LaTeX\ code or as a |\PackageError|---we store it in % |@macroexpansions| in preparation for writing it to \noperlmac\ % (when \perltex\ is run with \texttt{--makesty}). +% \changes{v2.0}{2009/11/21}{Substituted +% \texttt{\string\string\string\MessageBreak} for newline when +% reporting error messages produced by user code} % \begin{macrocode} undef $_; my $result; @@ -2746,6 +2764,7 @@ while (1) { if ($@) { my $msg = $@; $msg =~ s/at \(eval \d+\) line \d+\W+//; + $msg =~ s/\n/\\MessageBreak\n/g; $msg =~ s/\s+/ /; $result = "\\PackageError{perltex}{$msg}"; my @helpstring; diff --git a/Master/texmf-dist/tex/latex/perltex/perltex.sty b/Master/texmf-dist/tex/latex/perltex/perltex.sty index 174b855a30f..05c6b23cda3 100644 --- a/Master/texmf-dist/tex/latex/perltex/perltex.sty +++ b/Master/texmf-dist/tex/latex/perltex/perltex.sty @@ -22,7 +22,7 @@ %% \NeedsTeXFormat{LaTeX2e}[1999/12/01] \ProvidesPackage{perltex} - [2009/09/13 v1.9 LaTeX macros for use with PerlTeX] + [2009/11/24 v2.0 LaTeX macros for use with PerlTeX] \newif\ifplmac@required \plmac@requiredtrue \DeclareOption{optional}{\plmac@requiredfalse} \ProcessOptions\relax \newif\ifperl diff --git a/Master/texmf/doc/man/man1/perltex.1 b/Master/texmf/doc/man/man1/perltex.1 new file mode 100644 index 00000000000..80e40a34ad9 --- /dev/null +++ b/Master/texmf/doc/man/man1/perltex.1 @@ -0,0 +1,280 @@ +.\" Automatically generated by Pod::Man 2.1801 (Pod::Simple 3.05) +.\" +.\" Standard preamble: +.\" ======================================================================== +.de Sp \" Vertical space (when we can't use .PP) +.if t .sp .5v +.if n .sp +.. +.de Vb \" Begin verbatim text +.ft CW +.nf +.ne \\$1 +.. +.de Ve \" End verbatim text +.ft R +.fi +.. +.\" Set up some character translations and predefined strings. \*(-- will +.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left +.\" double quote, and \*(R" will give a right double quote. \*(C+ will +.\" give a nicer C++. Capital omega is used to do unbreakable dashes and +.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, +.\" nothing in troff, for use with C<>. +.tr \(*W- +.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' +.ie n \{\ +. ds -- \(*W- +. ds PI pi +. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch +. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch +. ds L" "" +. ds R" "" +. ds C` "" +. ds C' "" +'br\} +.el\{\ +. ds -- \|\(em\| +. ds PI \(*p +. ds L" `` +. ds R" '' +'br\} +.\" +.\" Escape single quotes in literal strings from groff's Unicode transform. +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" +.\" If the F register is turned on, we'll generate index entries on stderr for +.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index +.\" entries marked with X<> in POD. Of course, you'll have to process the +.\" output yourself in some meaningful fashion. +.ie \nF \{\ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" +.. +. nr % 0 +. rr F +.\} +.el \{\ +. de IX +.. +.\} +.\" +.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). +.\" Fear. Run. Save yourself. No user-serviceable parts. +. \" fudge factors for nroff and troff +.if n \{\ +. ds #H 0 +. ds #V .8m +. ds #F .3m +. ds #[ \f1 +. ds #] \fP +.\} +.if t \{\ +. ds #H ((1u-(\\\\n(.fu%2u))*.13m) +. ds #V .6m +. ds #F 0 +. ds #[ \& +. ds #] \& +.\} +. \" simple accents for nroff and troff +.if n \{\ +. ds ' \& +. ds ` \& +. ds ^ \& +. ds , \& +. ds ~ ~ +. ds / +.\} +.if t \{\ +. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" +. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' +. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' +. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' +. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' +. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' +.\} +. \" troff and (daisy-wheel) nroff accents +.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' +.ds 8 \h'\*(#H'\(*b\h'-\*(#H' +.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] +.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' +.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' +.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] +.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] +.ds ae a\h'-(\w'a'u*4/10)'e +.ds Ae A\h'-(\w'A'u*4/10)'E +. \" corrections for vroff +.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' +.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' +. \" for low resolution devices (crt and lpr) +.if \n(.H>23 .if \n(.V>19 \ +\{\ +. ds : e +. ds 8 ss +. ds o a +. ds d- d\h'-1'\(ga +. ds D- D\h'-1'\(hy +. ds th \o'bp' +. ds Th \o'LP' +. ds ae ae +. ds Ae AE +.\} +.rm #[ #] #H #V #F C +.\" ======================================================================== +.\" +.IX Title "PERLTEX 1" +.TH PERLTEX 1 "2009-11-24" "v2.0" "User Contributed Perl Documentation" +.\" For nroff, turn off justification. Always turn off hyphenation; it makes +.\" way too many mistakes in technical documents. +.if n .ad l +.nh +.SH "NAME" +perltex \- enable LaTeX macros to be defined in terms of Perl code +.SH "SYNOPSIS" +.IX Header "SYNOPSIS" +perltex +[\fB\-\-help\fR] +[\fB\-\-latex\fR=\fIprogram\fR] +[\fB\-\-\fR[\fBno\fR]\fBsafe\fR] +[\fB\-\-permit\fR=\fIfeature\fR] +[\fB\-\-makesty\fR] +[\fIlatex options\fR] +.SH "DESCRIPTION" +.IX Header "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. +.PP +Clearly, Perl's programmability could complement LaTeX's typesetting +strengths. \fBperltex\fR is the tool that enables a symbiosis between +the two systems. All a user needs to do is compile a LaTeX document +using \fBperltex\fR instead of \fBlatex\fR. (\fBperltex\fR is actually a +wrapper for \fBlatex\fR, so no \fBlatex\fR functionality is lost.) If the +document includes a \f(CW\*(C`\eusepackage{perltex}\*(C'\fR in its preamble, then +\&\f(CW\*(C`\eperlnewcommand\*(C'\fR and \f(CW\*(C`\eperlrenewcommand\*(C'\fR macros will be made +available. These behave just like LaTeX's \f(CW\*(C`\enewcommand\*(C'\fR and +\&\f(CW\*(C`\erenewcommand\*(C'\fR except that the macro body contains Perl code instead +of LaTeX code. +.SH "OPTIONS" +.IX Header "OPTIONS" +\&\fBperltex\fR accepts the following command-line options: +.IP "\fB\-\-help\fR" 4 +.IX Item "--help" +Display basic usage information. +.IP "\fB\-\-latex\fR=\fIprogram\fR" 4 +.IX Item "--latex=program" +Specify a program to use instead of \fBlatex\fR. For example, +\&\f(CW\*(C`\-\-latex=pdflatex\*(C'\fR would typeset the given document using +\&\fBpdflatex\fR instead of ordinary \fBlatex\fR. +.IP "\fB\-\-\fR[\fBno\fR]\fBsafe\fR" 4 +.IX Item "--[no]safe" +Enable or disable sandboxing. With the default of \fB\-\-safe\fR, +\&\fBperltex\fR executes the code from a \f(CW\*(C`\eperlnewcommand\*(C'\fR or +\&\f(CW\*(C`\eperlrenewcommand\*(C'\fR macro within a protected environment that +prohibits ``unsafe'' operations such as accessing files or executing +external programs. Specifying \fB\-\-nosafe\fR gives the LaTeX document +\&\fIcarte blanche\fR to execute any arbitrary Perl code, including that +which can harm the user's files. See Safe for more information. +.IP "\fB\-\-permit\fR=\fIfeature\fR" 4 +.IX Item "--permit=feature" +Permit particular Perl operations to be performed. The \fB\-\-permit\fR +option, which can be specified more than once on the command line, +enables finer-grained control over the \fBperltex\fR sandbox. See +Opcode for more information. +.IP "\fB\-\-makesty\fR" 4 +.IX Item "--makesty" +Generate a LaTeX style file called \fInoperltex.sty\fR. Replacing the +document's \f(CW\*(C`\eusepackage{perltex}\*(C'\fR line with \f(CW\*(C`\eusepackage{noperltex}\*(C'\fR +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 \fInoperltex.sty\fR is specific to +the document that produced it. Any changes to the document's PerlTeX +macro definitions or macro invocations necessitates rerunning +\&\fBperltex\fR with the \fB\-\-makesty\fR option. +.PP +These options are then followed by whatever options are normally +passed to \fBlatex\fR (or whatever program was specified with +\&\f(CW\*(C`\-\-latex\*(C'\fR), including, for instance, the name of the \fI.tex\fR file to +compile. +.SH "EXAMPLES" +.IX Header "EXAMPLES" +In its simplest form, \fBperltex\fR is run just like \fBlatex\fR: +.PP +.Vb 1 +\& perltex myfile.tex +.Ve +.PP +To use \fBpdflatex\fR instead of regular \fBlatex\fR, use the \fB\-\-latex\fR +option: +.PP +.Vb 1 +\& perltex \-\-latex=pdflatex myfile.tex +.Ve +.PP +If LaTeX gives a ``\f(CW\*(C`trapped by operation mask\*(C'\fR'' error and you trust +the \fI.tex\fR file you're trying to compile not to execute malicious +Perl code (e.g., because you wrote it yourself), you can disable +\&\fBperltex\fR's safety mechansisms with \fB\-\-nosafe\fR: +.PP +.Vb 1 +\& perltex \-\-nosafe myfile.tex +.Ve +.PP +The following command gives documents only \fBperltex\fR's default +permissions (\f(CW\*(C`:browse\*(C'\fR) plus the ability to open files and invoke the +\&\f(CW\*(C`time\*(C'\fR command: +.PP +.Vb 2 +\& perltex \-\-permit=:browse \-\-permit=:filesys_open +\& \-\-permit=time myfile.tex +.Ve +.SH "ENVIRONMENT" +.IX Header "ENVIRONMENT" +\&\fBperltex\fR honors the following environment variables: +.IP "\s-1PERLTEX\s0" 4 +.IX Item "PERLTEX" +Specify the filename of the LaTeX compiler. The LaTeX compiler +defaults to ``\f(CW\*(C`latex\*(C'\fR''. The \f(CW\*(C`PERLTEX\*(C'\fR environment variable +overrides this default, and the \fB\-\-latex\fR command-line option (see +\&\*(L"\s-1OPTIONS\s0\*(R") overrides that. +.SH "FILES" +.IX Header "FILES" +While compiling \fIjobname.tex\fR, \fBperltex\fR makes use of the following +files: +.IP "\fIjobname.lgpl\fR" 4 +.IX Item "jobname.lgpl" +log file written by Perl; helpful for debugging Perl macros +.IP "\fIjobname.topl\fR" 4 +.IX Item "jobname.topl" +information sent from LaTeX to Perl +.IP "\fIjobname.frpl\fR" 4 +.IX Item "jobname.frpl" +information sent from Perl to LaTeX +.IP "\fIjobname.tfpl\fR" 4 +.IX Item "jobname.tfpl" +``flag'' file whose existence indicates that \fIjobname.topl\fR contains +valid data +.IP "\fIjobname.ffpl\fR" 4 +.IX Item "jobname.ffpl" +``flag'' file whose existence indicates that \fIjobname.frpl\fR contains +valid data +.IP "\fIjobname.dfpl\fR" 4 +.IX Item "jobname.dfpl" +``flag'' file whose existence indicates that \fIjobname.ffpl\fR has been +deleted +.IP "\fInoperltex\-#.tex\fR" 4 +.IX Item "noperltex-#.tex" +file generated by \fInoperltex.sty\fR for each PerlTeX macro invocation +.SH "NOTES" +.IX Header "NOTES" +\&\fBperltex\fR's sandbox defaults to what Opcode calls ``\f(CW\*(C`:browse\*(C'\fR''. +.SH "SEE ALSO" +.IX Header "SEE ALSO" +\&\fIlatex\fR\|(1), \fIpdflatex\fR\|(1), \fIperl\fR\|(1), \fISafe\fR\|(3pm), \fIOpcode\fR\|(3pm) +.SH "AUTHOR" +.IX Header "AUTHOR" +Scott Pakin, \fIscott+pt@pakin.org\fR diff --git a/Master/tlpkg/libexec/ctan2tds b/Master/tlpkg/libexec/ctan2tds index 7302f18d27b..9396f024ea3 100755 --- a/Master/tlpkg/libexec/ctan2tds +++ b/Master/tlpkg/libexec/ctan2tds @@ -1491,10 +1491,11 @@ $standardxmt='\.xmt'; 'latex2e-help-texinfo' => '\.info', ); -# packages which have man pages to install. We assume section 1. +# packages which have man pages to install. %specialmans = ( 'epstopdf' => 'epstopdf.1', 'findhyph' => 'findhyph.1', + 'perltex' => 'perltex.1', 'pkfix-helper' => 'pkfix-helper.1', 'purifyeps' => 'purifyeps.1', 'texdiff' => 'texdiff.1', diff --git a/Master/tlpkg/tlpsrc/perltex.tlpsrc b/Master/tlpkg/tlpsrc/perltex.tlpsrc index 14a7b30f833..2df83a3f87e 100644 --- a/Master/tlpkg/tlpsrc/perltex.tlpsrc +++ b/Master/tlpkg/tlpsrc/perltex.tlpsrc @@ -1 +1,3 @@ binpattern f bin/${ARCH}/perltex +docpattern +f texmf/doc/man/man1/perltex.* + |