diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex')
-rw-r--r-- | Master/texmf-dist/tex/latex/perltex/perltex.sty | 229 |
1 files changed, 229 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/perltex/perltex.sty b/Master/texmf-dist/tex/latex/perltex/perltex.sty new file mode 100644 index 00000000000..ab61d0c9f94 --- /dev/null +++ b/Master/texmf-dist/tex/latex/perltex/perltex.sty @@ -0,0 +1,229 @@ +%% +%% This is file `perltex.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% perltex.dtx (with options: `package') +%% +%% This is a generated file. +%% +%% Copyright (C) 2004 by 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.2 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.2 or later is part of all distributions of LaTeX version +%% 1999/12/01 or later. +%% +\NeedsTeXFormat{LaTeX2e}[1999/12/01] +\ProvidesPackage{perltex} + [2004/10/07 v1.2 LaTeX macros for use with PerlTeX] +\newif\ifplmac@have@perltex +\plmac@have@perltextrue +\@ifundefined{plmac@tag}{\plmac@have@perltexfalse}{} +\@ifundefined{plmac@tofile}{\plmac@have@perltexfalse}{} +\@ifundefined{plmac@fromfile}{\plmac@have@perltexfalse}{} +\@ifundefined{plmac@toflag}{\plmac@have@perltexfalse}{} +\@ifundefined{plmac@fromflag}{\plmac@have@perltexfalse}{} +\@ifundefined{plmac@doneflag}{\plmac@have@perltexfalse}{} +\ifplmac@have@perltex +\else + \PackageError{perltex}{Document must be compiled using perltex} + {Instead of compiling your document directly with latex, you need + to\MessageBreak use the perltex script. \space perltex sets up + a variety of macros needed by\MessageBreak the perltex + package as well as a listener process needed for\MessageBreak + communication between LaTeX and Perl.} +\fi +\def\perlnewcommand{% + \let\plmac@command=\newcommand + \let\plmac@next=\relax + \@ifnextchar*{\plmac@newcommand@i}{\plmac@newcommand@i!}% +} +\def\perlrenewcommand{% + \let\plmac@next=\relax + \let\plmac@command=\renewcommand + \@ifnextchar*{\plmac@newcommand@i}{\plmac@newcommand@i!}% +} +\def\plmac@newcommand@i#1#2{% + \ifx#1*% + \def\plmac@starchar{*}% + \else + \def\plmac@starchar{}% + \fi + \def\plmac@macname{#2}% + \let\plmac@oldbody=#2\relax + \expandafter\def\expandafter\plmac@cleaned@macname\expandafter{% + \expandafter\string\plmac@macname}% + \@ifnextchar[{\plmac@newcommand@ii}{\plmac@newcommand@ii[0]}%] +} +\def\plmac@newcommand@ii[#1]{% + \def\plmac@numargs{#1}% + \@ifnextchar[{\plmac@newcommand@iii@opt} + {\plmac@newcommand@iii@no@opt}%] +} +\def\plmac@newcommand@iii@opt[#1]{% + \def\plmac@defarg{#1}% + \plmac@haveargs +} +\def\plmac@newcommand@iii@no@opt{% + \let\plmac@defarg=\relax + \plmac@haveargs +} +\newtoks\plmac@perlcode +\def\plmac@haveargs{% + \begingroup + \let\do\@makeother\dospecials + \catcode`\^^M=\active + \newlinechar`\^^M + \endlinechar=`\^^M + \catcode`\{=1 + \catcode`\}=2 + \afterassignment\plmac@havecode + \global\plmac@perlcode +} +{\catcode`\^^M=11\gdef\plmac@sep{^^M}} +\newcount\plmac@argnum +\def\plmac@havecode{% + \endgroup + \edef\plmac@define@sub{% + \noexpand\plmac@write@perl{DEF\plmac@sep + \plmac@tag\plmac@sep + \plmac@cleaned@macname\plmac@sep + \plmac@tag\plmac@sep + \the\plmac@perlcode + }% + }% + \plmac@define@sub + \edef\plmac@body{% + USE\plmac@sep + \plmac@tag\plmac@sep + \plmac@cleaned@macname + }% + \let\plmac@hash=\relax + \plmac@argnum=1% + \loop + \ifnum\plmac@numargs<\plmac@argnum + \else + \edef\plmac@body{% + \plmac@body\plmac@sep\plmac@tag\plmac@sep + \plmac@hash\plmac@hash\number\plmac@argnum}% + \advance\plmac@argnum by 1% + \repeat + \let\plmac@hash=##\relax + \expandafter\let\plmac@macname=\relax + \ifx\plmac@defarg\relax + \edef\plmac@define@command{% + \noexpand\plmac@command\plmac@starchar{\plmac@macname}% + [\plmac@numargs]{% + \noexpand\plmac@write@perl{\plmac@body}% + }% + }% + \else + \edef\plmac@define@command{% + \noexpand\plmac@command\plmac@starchar{\plmac@macname}% + [\plmac@numargs][\plmac@defarg]{% + \noexpand\plmac@write@perl{\plmac@body}% + }% + }% + \fi + \expandafter\let\plmac@macname=\plmac@oldbody + \plmac@define@command + \plmac@next +} +\def\perlnewenvironment{% + \let\plmac@command=\newcommand + \let\plmac@next=\plmac@end@environment + \@ifnextchar*{\plmac@newenvironment@i}{\plmac@newenvironment@i!}% +} +\def\perlrenewenvironment{% + \let\plmac@command=\renewcommand + \let\plmac@next=\plmac@end@environment + \@ifnextchar*{\plmac@newenvironment@i}{\plmac@newenvironment@i!}% +} +\def\plmac@newenvironment@i#1#2{% + \ifx#1*% + \def\plmac@starchar{*}% + \else + \def\plmac@starchar{}% + \fi + \def\plmac@envname{#2}% + \expandafter\def\expandafter\plmac@macname\expandafter{\csname#2\endcsname}% + \expandafter\let\expandafter\plmac@oldbody\plmac@macname\relax + \expandafter\def\expandafter\plmac@cleaned@macname\expandafter{% + \expandafter\string\plmac@macname}% + \@ifnextchar[{\plmac@newcommand@ii}{\plmac@newcommand@ii[0]}%] +} +\def\plmac@end@environment{% + \expandafter\def\expandafter\plmac@next\expandafter{\expandafter + \let\csname end\plmac@envname\endcsname=\plmac@end@macro + \let\plmac@next=\relax + }% + \def\plmac@macname{\plmac@end@macro}% + \expandafter\let\expandafter\plmac@oldbody\csname end\plmac@envname\endcsname + \expandafter\def\expandafter\plmac@cleaned@macname\expandafter{% + \expandafter\string\plmac@macname}% + \@ifnextchar[{\plmac@newcommand@ii}{\plmac@newcommand@ii[0]}%] +} +\newif\ifplmac@file@exists +\newcommand{\plmac@await@existence}[1]{% + \loop + \IfFileExists{#1}% + {\plmac@file@existstrue}% + {\plmac@file@existsfalse}% + \ifplmac@file@exists + \else + \repeat +} +\newwrite\plmac@outfile +\newcommand{\plmac@write@perl}{% + \begingroup + \let\do\@makeother\dospecials + \catcode`\^^M=\active + \newlinechar`\^^M + \endlinechar=`\^^M + \catcode`\{=1 + \catcode`\}=2 + \plmac@write@perl@i +} +\ifplmac@have@perltex + \newcommand{\plmac@write@perl@i}[1]{% + \immediate\openout\plmac@outfile=\plmac@tofile\relax + \let\protect=\noexpand + \def\begin{\noexpand\begin}% + \def\end{\noexpand\end}% + \immediate\write\plmac@outfile{#1}% + \immediate\closeout\plmac@outfile + \endgroup + \immediate\openout\plmac@outfile=\plmac@toflag\relax + \immediate\closeout\plmac@outfile + \plmac@await@existence\plmac@fromflag + \immediate\openout\plmac@outfile=\plmac@tofile\relax + \immediate\closeout\plmac@outfile + \plmac@await@existence\plmac@doneflag + \input\plmac@fromfile\relax + } +\else + \newcommand{\plmac@write@perl@i}[1]{\endgroup} + \AtBeginDocument{% + \renewcommand{\plmac@write@perl@i}[1]{% + \def\plmac@show@placeholder##1##2\@empty{% + \ifx##1D\relax + \endgroup + \else + \endgroup + \fbox{Perl\TeX}% + \fi + }% + \plmac@show@placeholder#1\@empty + }% + } +\fi +\endinput +%% +%% End of file `perltex.sty'. |