diff options
Diffstat (limited to 'Master/texmf-dist/source/latex/oberdiek/pdftexcmds.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/oberdiek/pdftexcmds.dtx | 154 |
1 files changed, 149 insertions, 5 deletions
diff --git a/Master/texmf-dist/source/latex/oberdiek/pdftexcmds.dtx b/Master/texmf-dist/source/latex/oberdiek/pdftexcmds.dtx index 4d1c09c4b5d..257aa30d8e5 100644 --- a/Master/texmf-dist/source/latex/oberdiek/pdftexcmds.dtx +++ b/Master/texmf-dist/source/latex/oberdiek/pdftexcmds.dtx @@ -17,6 +17,7 @@ % This work consists of the main source file pdftexcmds.dtx % and the derived files % pdftexcmds.sty, pdftexcmds.pdf, pdftexcmds.ins, pdftexcmds.drv, +% pdftexcmds-test1.tex, pdftexcmds-test2.tex, % oberdiek.pdftexcmds.lua, pdftexcmds.lua. % % Distribution: @@ -54,6 +55,8 @@ % TDS:scripts/oberdiek/oberdiek.pdftexcmds.lua % TDS:scripts/oberdiek/pdftexcmds.lua % TDS:doc/latex/oberdiek/pdftexcmds.pdf +% TDS:doc/latex/oberdiek/test/pdftexcmds-test1.tex +% TDS:doc/latex/oberdiek/test/pdftexcmds-test2.tex % TDS:source/latex/oberdiek/pdftexcmds.dtx % %<*ignore> @@ -69,7 +72,7 @@ \input docstrip.tex \Msg{************************************************************************} \Msg{* Installation} -\Msg{* Package: pdftexcmds 2009/09/22 v0.5 LuaTeX support for pdfTeX utility functions (HO)} +\Msg{* Package: pdftexcmds 2009/09/23 v0.6 LuaTeX support for pdfTeX utility functions (HO)} \Msg{************************************************************************} \keepsilent @@ -97,6 +100,7 @@ This Current Maintainer of this work is Heiko Oberdiek. This work consists of the main source file pdftexcmds.dtx and the derived files pdftexcmds.sty, pdftexcmds.pdf, pdftexcmds.ins, pdftexcmds.drv, + pdftexcmds-test1.tex, pdftexcmds-test2.tex, oberdiek.pdftexcmds.lua, pdftexcmds.lua. \endpreamble @@ -107,6 +111,9 @@ and the derived files \file{pdftexcmds.drv}{\from{pdftexcmds.dtx}{driver}}% \usedir{tex/generic/oberdiek}% \file{pdftexcmds.sty}{\from{pdftexcmds.dtx}{package}}% + \usedir{doc/latex/oberdiek/test}% + \file{pdftexcmds-test1.tex}{\from{pdftexcmds.dtx}{test1}}% + \file{pdftexcmds-test2.tex}{\from{pdftexcmds.dtx}{test2}}% } \def\MetaPrefix{-- } \def\defaultpostamble{% @@ -147,7 +154,7 @@ and the derived files %<*driver> \NeedsTeXFormat{LaTeX2e} \ProvidesFile{pdftexcmds.drv}% - [2009/09/22 v0.5 LuaTeX support for pdfTeX utility functions (HO)]% + [2009/09/23 v0.6 LuaTeX support for pdfTeX utility functions (HO)]% \documentclass{ltxdoc} \usepackage{holtxdoc}[2008/08/11] \usepackage{paralist} @@ -157,7 +164,7 @@ and the derived files %</driver> % \fi % -% \CheckSum{752} +% \CheckSum{928} % % \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 @@ -178,7 +185,7 @@ and the derived files % \GetFileInfo{pdftexcmds.drv} % % \title{The \xpackage{pdftexcmds} package} -% \date{2009/09/22 v0.5} +% \date{2009/09/23 v0.6} % \author{Heiko Oberdiek\\\xemail{oberdiek@uni-freiburg.de}} % % \maketitle @@ -338,6 +345,28 @@ and the derived files % it \cs{ifprimitive}. It is a switch that checks if the command % \csi{cmd} has it's primitive meaning. % +% \subsubsection{Additional macro: \cs{pdf@isprimitive}} +% +% \begin{declcs}{pdf@isprimitive} \csi{cmd1} \csi{cmd2} \M{true} \M{false} +% \end{declcs} +% If \csi{cmd1} has the primitive meaning given by the primitive name +% of \csi{cmd2}, then the argument \meta{true} is executed, otherwise +% \meta{false}. The macro \cs{pdf@isprimitive} is expandable. +% Internally it checks the result of \cs{meaning} and is therefore +% available for all \TeX\ variants, even the original \TeX. +% Example with \LaTeX: +%\begin{quote} +%\begin{verbatim} +%\makeatletter +%\pdf@isprimitive{@@input}{input}{% +% \typeout{\string\@@input\space is original\string\input}% +%}{% +% \typeout{Oops, \string\@@input\space is not the % +% original\string\input}% +%} +%\end{verbatim} +%\end{quote} +% % \subsubsection{Experimental} % % \begin{declcs}{pdf@unescapehexnative} \M{string}\\ @@ -435,7 +464,7 @@ and the derived files \fi \expandafter\x\csname ver@pdftexcmds.sty\endcsname \ProvidesPackage{pdftexcmds}% - [2009/09/22 v0.5 LuaTeX support for pdfTeX utility functions (HO)] + [2009/09/23 v0.6 LuaTeX support for pdfTeX utility functions (HO)] % \end{macrocode} % % \subsection{Catcodes} @@ -498,9 +527,11 @@ and the derived files \expandafter\ifx\csname RequirePackage\endcsname\relax \input infwarerr.sty\relax \input ifluatex.sty\relax + \input ltxcmds.sty\relax \else \RequirePackage{infwarerr}[2007/09/09]% \RequirePackage{ifluatex}[2009/04/10]% + \RequirePackage{ltxcmds}% \fi % \end{macrocode} % @@ -601,6 +632,7 @@ and the derived files \pdftexcmds@directlua{% if tex.enableprimitives then tex.enableprimitives('pdf@', {'primitive', 'ifprimitive'}) + tex.enableprimitives('', {'luaescapestring'}) end }% \endgroup % @@ -721,9 +753,60 @@ and the derived files \pdftexcmds@temp{strcmp}% % \end{macrocode} % +% \subsection{\cs{pdf@isprimitive}} +% % \begin{macrocode} +\def\pdf@isprimitive{% + \begingroup\expandafter\expandafter\expandafter\endgroup + \expandafter\ifx\csname pdf@strcmp\endcsname\relax + \long\def\pdf@isprimitive##1{% + \expandafter\pdftexcmds@isprimitive\expandafter{\meaning##1}% + }% + \long\def\pdftexcmds@isprimitive##1##2{% + \expandafter\pdftexcmds@@isprimitive\expandafter{\string##2}{##1}% + }% + \def\pdftexcmds@@isprimitive##1##2{% + \ifnum0\pdftexcmds@equal##1\delimiter##2\delimiter=1 % + \expandafter\ltx@firstoftwo + \else + \expandafter\ltx@secondoftwo + \fi + }% + \def\pdftexcmds@equal##1##2\delimiter##3##4\delimiter{% + \ifx##1##3% + \ifx\relax##2##4\relax + 1% + \else + \ifx\relax##2\relax + \else + \ifx\relax##4\relax + \else + \pdftexcmds@equalcont{##2}{##4}% + \fi + \fi + \fi + \fi + }% + \def\pdftexcmds@equalcont##1{% + \def\pdftexcmds@equalcont####1####2##1##1##1##1{% + ##1##1##1##1% + \pdftexcmds@equal####1\delimiter####2\delimiter + }% + }% + \expandafter\pdftexcmds@equalcont\csname fi\endcsname + \else + \long\def\pdf@isprimitive##1##2{% + \ifnum\pdf@strcmp{\meaning##1}{\string##2}=0 % + \expandafter\ltx@firstoftwo + \else + \expandafter\ltx@secondoftwo + \fi + }% + \fi +} \ifluatex \else + \pdf@isprimitive \pdftexcmds@AtEnd \expandafter\endinput \fi @@ -773,6 +856,9 @@ and the derived files }% % \end{macrocode} % \end{macro} +% \begin{macrocode} +\pdf@isprimitive +% \end{macrocode} % \begin{macro}{\pdf@escapehex} % \begin{macrocode} \long\def\pdf@escapehex#1{% @@ -1355,6 +1441,58 @@ end %</test1> % \end{macrocode} % +% \subsection{Test for \cs{pdf@isprimitive}} +% +% \begin{macrocode} +%<*test2> +\catcode`\{=1 % +\catcode`\}=2 % +\catcode`\#=6 % +\catcode`\@=11 % +\input pdftexcmds.sty\relax +\def\msg#1{% + \begingroup + \escapechar=92 % + \immediate\write16{#1}% + \endgroup +} +\long\def\test#1#2#3#4{% + \begingroup + #4% + \def\str{% + Test \string\pdf@isprimitive + {\string #1}{\string #2}{...}: % + }% + \pdf@isprimitive{#1}{#2}{% + \ifx#3Y% + \msg{\str true ==> OK.}% + \else + \errmessage{\str false ==> FAILED}% + \fi + }{% + \ifx#3Y% + \errmessage{\str true ==> FAILED}% + \else + \msg{\str false ==> OK.}% + \fi + }% + \endgroup +} +\test\relax\relax Y{} +\test\foobar\relax Y{\let\foobar\relax} +\test\foobar\relax N{} +\test\hbox\hbox Y{} +\test\foobar@hbox\hbox Y{\let\foobar@hbox\hbox} +\test\if\if Y{} +\test\if\ifx N{} +\test\ifx\if N{} +\test\par\par Y{} +\test\hbox\par N{} +\test\par\hbox N{} +\csname @@end\endcsname\end +%</test2> +% \end{macrocode} +% % \section{Installation} % % \subsection{Download} @@ -1418,6 +1556,8 @@ end % oberdiek.pdftexcmds.lua & scripts/oberdiek/oberdiek.pdftexcmds.lua\\ % pdftexcmds.lua & scripts/oberdiek/pdftexcmds.lua\\ % pdftexcmds.pdf & doc/latex/oberdiek/pdftexcmds.pdf\\ +% test/pdftexcmds-test1.tex & doc/latex/oberdiek/test/pdftexcmds-test1.tex\\ +% test/pdftexcmds-test2.tex & doc/latex/oberdiek/test/pdftexcmds-test2.tex\\ % pdftexcmds.dtx & source/latex/oberdiek/pdftexcmds.dtx\\ % \end{tabular}^^A % }^^A @@ -1564,6 +1704,10 @@ end % \cs{pdf@shellescape}, \cs{pdf@strcmp}, \cs{pdf@primitive}, % \cs{pdf@ifprimitive}. % \end{Version} +% \begin{Version}{2009/09/23 v0.6} +% \item +% Macro \cs{pdf@isprimitive} added. +% \end{Version} % \end{History} % % \PrintIndex |