texlive[72180] Master/texmf-dist: verifycommand (3sep24)
commits+karl at tug.org
commits+karl at tug.org
Tue Sep 3 22:31:11 CEST 2024
Revision: 72180
https://tug.org/svn/texlive?view=revision&revision=72180
Author: karl
Date: 2024-09-03 22:31:10 +0200 (Tue, 03 Sep 2024)
Log Message:
-----------
verifycommand (3sep24)
Modified Paths:
--------------
trunk/Master/texmf-dist/doc/latex/verifycommand/README.txt
trunk/Master/texmf-dist/doc/latex/verifycommand/verifycommand.pdf
trunk/Master/texmf-dist/source/latex/verifycommand/verifycommand.dtx
trunk/Master/texmf-dist/tex/latex/verifycommand/verifycommand.sty
Modified: trunk/Master/texmf-dist/doc/latex/verifycommand/README.txt
===================================================================
--- trunk/Master/texmf-dist/doc/latex/verifycommand/README.txt 2024-09-02 23:41:56 UTC (rev 72179)
+++ trunk/Master/texmf-dist/doc/latex/verifycommand/README.txt 2024-09-03 20:31:10 UTC (rev 72180)
@@ -1,5 +1,5 @@
-LaTeX verifycommand package v1.00 README.txt
+LaTeX verifycommand package v1.10 README.txt
Files included are:
Modified: trunk/Master/texmf-dist/doc/latex/verifycommand/verifycommand.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/source/latex/verifycommand/verifycommand.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/verifycommand/verifycommand.dtx 2024-09-02 23:41:56 UTC (rev 72179)
+++ trunk/Master/texmf-dist/source/latex/verifycommand/verifycommand.dtx 2024-09-03 20:31:10 UTC (rev 72180)
@@ -17,7 +17,7 @@
% \iffalse
%<package>\NeedsTeXFormat{LaTeX2e}
%<package>\ProvidesPackage{verifycommand}
-%<package> [2024/01/11 v1.00 Verify definitions have not changed.]
+%<package> [2024/09/03 v1.10 Verify definitions have not changed.]
%
%<*driver>
\documentclass{ltxdoc}
@@ -77,9 +77,9 @@
\usepackage{microtype}
+\usepackage{nowidow}
-
\usepackage[svgnames]{xcolor}
\definecolor{myurlcolor}{rgb}{0,0,.7}
\definecolor{mylinkcolor}{rgb}{.7,0,0}
@@ -233,6 +233,7 @@
\usepackage{\mypackagename}
+%\usepackage[disable]{\mypackagename}
@@ -301,6 +302,7 @@
%
% \changes{v1.00}{2024/01/11}{\ 2024/01/11 Initial version.}
+% \changes{v1.10}{2024/09/03}{\ 2024/09/03}
% \GetFileInfo{\mypackagename.sty}
@@ -353,11 +355,17 @@
%
% To improve reliability,
% the \pkg{verifycommand} package provides a way to verify that
-% macros or environments have not changed.
-% This allows a package author to check before patching a definition.
+% macros or environments have not changed since the patches were
+% last designed.
+% This may be checked before applying the patch.
% If a definition is not as expected, a warning is issued.
% At the end of the compile, a list of all changed definitions is displayed.
%
+% Conditionals are provided, allowing multiple versions of a definition
+% to be tested and patched, warning if no known version is found.
+% Conditionals also allow the package to verify that several macros
+% are unchanged before taking a single common action.
+%
% \vfill
%
% \footnotesize
@@ -448,12 +456,51 @@
% expected values.
%
%
-% \clearpage
+% \section{Warnings}
%
+% \changes{v1.10}{2024/09/03}{Docs: Added Warnings section.}
+%
+% The document \textit{\LaTeX\ for authors} (\cmds{texdoc usrguide}
+% recommends the use of \LaTeX\ hooks where possible (\cmds{texdoc lthooks}).
+%
+% Commands created with \cs{NewDocumentCommand} and related may
+% \watchout[kernel changes]
+% change their definitions when the inner workings of
+% \cs{NewDocumentCommand} are optimized.
+% When this occurs, any checksums for these commands will
+% change, even though the associated patches probably will continue to work.
+% If you use \pkg{verifycommand} for these commands, expect the
+% checksums to need updates at some point in the future.
+%
+% Use \cs{NewCommandCopy} and \cs{NewEnvironmentCopy} to copy commands
+% for reuse. These work with all kinds of commmand definitions.
+% See \cmds{texdoc usrguide} for details.
+%
+% Use \cs{ShowCommand} or \cs{ShowEnvironment} to see an existing definition,
+% which again works with all forms of commands.
+%
+%
% \section{How to use \pkg{verifycommand}}
%
+%
% \subsection{The user interface}
%
+% \changes{v1.10}{2024/06/25}{Docs: Added conditional tests.}
+%
+% In the following, \oarg{yourpackagename} is the package doing the
+% testing and patching,
+% and \oarg{theirpackagename} is the package which defines
+% the original macro.
+% Using these optional package names make it easier to find where
+% to make changes if needed.
+%
+% If there is only one optional argument,
+% \watchout[optional arguments]
+% it is used as \oarg{yourpackagename},
+% to identify where to find the \cs{VerifyCommand} checksum entry.
+% The second optional argument identifies what is being patched,
+% in case it has been changed.
+%
% \needspace{2\baselineskip}
% \DescribeMacro{\VerifyCommand} \oarg{yourpackagename} \oarg{theirpackagename}
% \marg{\cs{macroname}} \marg{\MDfive\ checksum}
@@ -464,15 +511,56 @@
% \fqquad \marg{begin \MDfive\ checksum} \marg{end \MDfive\ checksum}
%
% Use one of these macros just before patching a macro or environment,
-% as seen below.
+% as seen below. A test is performed to see if the definition
+% is as expected before applying a patch.
%
% Note that there is one checksum for \cs{VerifyCommand}, but there
-% are two checksums for \cs{VerifyEnvironment}: once for the begin section
+% are two checksums for an environment: once for the begin section
% and one for the end section.
%
-% If there is only one optional argument, it is used as your package name.
+% It may be necessary to test for each of several possible versions of
+% a definition, then patch accordingly. The following test and apply a
+% true or false clause, without issuing a warning.
%
+% \needspace{2\baselineskip}
+% \DescribeMacro{\IfVerifyCommand} \oarg{yourpackagename} \oarg{theirpackagename}
+% \marg{\cs{macroname}} \\
+% \fqquad \marg{\MDfive\ checksum} \\
+% \fqquad \marg{true} \marg{false}
%
+% \needspace{3\baselineskip}
+% \DescribeMacro{\IfVerifyEnvironmentBegin} \oarg{yourpackagename} \oarg{theirpackagename}
+% \marg{\env{envname}} \\
+% \fqquad \marg{begin \MDfive\ checksum} \\
+% \fqquad \marg{true} \marg{false}
+%
+% \needspace{3\baselineskip}
+% \DescribeMacro{\IfVerifyEnvironmentEnd} \oarg{yourpackagename} \oarg{theirpackagename}
+% \marg{\env{envname}} \\
+% \fqquad \marg{end \MDfive\ checksum} \\
+% \fqquad \marg{true} \marg{false}
+%
+% Tests may be done as a group, either to try several versions of the same
+% definition, or to verify several definitions and act if any of them fail:
+%
+% \DescribeMacro{\TestVerifyCommands} Starts a group of tests.
+%
+% \DescribeMacro{\IfVerifyCommandPassed} \marg{true} \marg{false}
+% \quad Act if any of a group passed.
+% May be used to try to patch multiple versions of a command.
+%
+% \DescribeMacro{\IfVerifyCommandFailed} \marg{true} \marg{false}
+% \quad Act if any of a group failed.
+% May be used to verify several definitions are unchanged.
+%
+% A warning may be also issued:
+%
+% \DescribeMacro{\VERCMDWarning} \marg{yourpackage} \marg{theirpackage} \marg{defn name}
+% \quad Used to issue a warning that the macro has changed.
+%
+% See \cref{sec:conditionals} for examples of conditional tests.
+%
+%
% \subsection{Placing the macros}
%
% When first using \pkg{verifycommand}, use empty checksums, placing
@@ -483,70 +571,86 @@
%
% \begin{sourceverb}
% \VerifyCommand{\LaTeX}{}
-% <patch \LaTeX here>
+% (patch \LaTeX here)
%
% \VerifyCommand[mypackage]{\textcolor}{}
-% <patch \textcolor here>
+% (patch \textcolor here)
%
% \VerifyCommand[mypackage][graphics]{\rotatebox}{}
-% <patch \rotatebox here>
+% (patch \rotatebox here)
%
% \VerifyEnvironment{tabbing}{}{}
-% <patch tabbing here>
+% (patch tabbing here)
% \end{sourceverb}
%
%
% \subsection{Finding the checksums of the current definitions}
+% \changes{v1.10}{2024/06/25}{Docs: ``Finding checksums'' reorganized.}
%
-% In the above examples, testing \cs{LaTeX} would print a warning showing
-% the correct \MDfive\ checksum.
-% Testing \cs{textcolor} would do the same, but as a \cs{PackageWarning} from \pkg{mypackage}.
-% Testing \cs{rotatebox} would also mention the package being tested, \pkg{graphics}.
-% Testing \env{tabbing} issues a separate warning for the begin and end sections.
-%
-%
+% The warnings are issued and the correct checksums are given.
+% The type of warning depends on the usage:
+% \begin{itemize}
+% \item Verifying \cs{LaTeX} would print a warning showing
+% the correct \MDfive\ checksum.
% \begin{sourceverb}
-% Warning: Something may fail. A definition has changed:
+% Warning: A definition has changed:
% \LaTeX
-% FAAAC6146C9A80F46A1F029B67923851
+% (FAAAC6146C9A80F46A1F029B67923851)
% on input line 464.
-
-% Package mypackage Warning: Something may fail. A definition has changed:
+% \end{sourceverb}
+% \item Verifying \cs{textcolor} would do the same,
+% but as a \cs{PackageWarning} from \pkg{mypackage},
+% which is the package doing the testing.
+% \begin{sourceverb}
+% Package mypackage Warning: A definition has changed:
% (mypackage) \textcolor
-% (mypackage) E1E2B5A908AA1BCDDF6BEA038596A381
+% (mypackage) (E1E2B5A908AA1BCDDF6BEA038596A381)
% (mypackage) on input line 465.
-
-% Package mypackage Warning: Something may fail. A definition has changed:
+% \end{sourceverb}
+% \item Verifying \cs{rotatebox} would also issue a warning from \pkg{mypackage},
+% but also mention the package being tested, \pkg{graphics}.
+% \begin{sourceverb}
+% Package mypackage Warning: A definition has changed:
% (mypackage) graphics: \rotatebox
-% (mypackage) 2472999B02C97AC847128AF24C55D150
+% (mypackage) (2472999B02C97AC847128AF24C55D150)
% (mypackage) on input line 466.
-%
-% Warning: Something may fail. A definition has changed:
+% \end{sourceverb}
+% \item Verifying \env{tabbing} issues a separate warning
+% for the begin and end sections.
+% \begin{sourceverb}
+% Warning: A definition has changed:
% tabbing
-% 1AD73B4527AD30969CF3219F2FB1306B
+% (1AD73B4527AD30969CF3219F2FB1306B)
% on input line 518.
%
-% Warning: Something may fail. A definition has changed:
+% Warning: A definition has changed:
% (end)tabbing
-% E8326AC43EE0A6E922A20F2A798BD177
+% (E8326AC43EE0A6E922A20F2A798BD177)
% on input line 518.
% \end{sourceverb}
+% \end{itemize}
%
-% And at the end of the compile, a summary is given:
%
+% At the end of the compile, a summary is given:
+%
% \begin{sourceverb}
% --------------------------------
-% WARNING: Something may fail.
-% Definition changed: \LaTeX
-% Definition changed: FAAAC6146C9A80F46A1F029B67923851
-% Definition changed: \textcolor
-% Definition changed: E1E2B5A908AA1BCDDF6BEA038596A381
-% Definition changed: graphics: \rotatebox
-% Definition changed: 2472999B02C97AC847128AF24C55D150
-% Definition changed: tabbing
-% Definition changed: 1AD73B4527AD30969CF3219F2FB1306B
-% Definition changed: (end)tabbing
-% Definition changed: E8326AC43EE0A6E922A20F2A798BD177
+% Package verifycommand Warning: Definitions have changed.
+% Patches for the following macros may need to be updated.
+% See the previous warnings for line numbers.
+%
+% Syntax: Patching pkg -> Defining pkg: Macro (checksum)
+% -----
+% (verifycommand) \LaTeX
+% (FAAAC6146C9A80F46A1F029B67923851)
+% (verifycommand) mypackage -> \textcolor
+% (E1E2B5A908AA1BCDDF6BEA038596A381)
+% (verifycommand) mypackage -> graphics: \rotatebox
+% (2472999B02C97AC847128AF24C55D150)
+% (verifycommand) tabbing
+% (1AD73B4527AD30969CF3219F2FB1306B)
+% (verifycommand) (end)tabbing
+% (E8326AC43EE0A6E922A20F2A798BD177)
% --------------------------------
% \end{sourceverb}
%
@@ -558,24 +662,24 @@
%
% \begin{sourceverb}
% \VerifyCommand{\LaTeX}{FAAAC6146C9A80F46A1F029B67923851}
-% <patch \LaTeX here>
+% (patch \LaTeX here)
%
% \VerifyCommand[mypackage]{\textcolor}
% {E1E2B5A908AA1BCDDF6BEA038596A381}
-% <patch \textcolor here>
+% (patch \textcolor here)
%
% \VerifyCommand[mypackage][graphics]{\rotatebox}
% {2472999B02C97AC847128AF24C55D150}
-% <patch \rotatebox here>
+% (patch \rotatebox here)
%
% \VerifyEnvironment{tabbing}
% {1AD73B4527AD30969CF3219F2FB1306B}% beginning code
% {E8326AC43EE0A6E922A20F2A798BD177}% endind code
-% <patch tabbing here>
+% (patch tabbing here)
% \end{sourceverb}
%
%
-% \subsection{When a definition is changed}
+% \subsection{When a definition has changed}
%
% When something being verified changes at a later time, the resulting
% warning will let the user know that the patches may not work
@@ -584,14 +688,97 @@
% this warning will be issued before the patch is even attempted.
%
% When testing many packages in bulk, a utility such as \cmds{grep}
-% can report the changed definitions.
-% Search the log file for ``Definition changed:''.
+% can report which macros have changed.
+% Search the log file for ``\texttt{(verifycommand)}''.
%
%
+% \subsection{Testing for changed macros}
+% \label{sec:conditionals}
+%
+% \changes{v1.10}{2024/06/25}{Docs: Added conditional tests.}
+%
+% To test to see if a macro or environment has changed, use
+% \cs{IfVerifyCommand}, \cs{IfVerifyEnvironmentBegin},
+% or \cs{IfVerifyEnvironmentEnd}.
+%
+% Example:
+% \begin{sourceverb}
+% \IfVerifyCommand[mypackage][LaTeX kernel]{\LaTeX}{123}{True}{False}
+% \end{sourceverb}
+% Result: \IfVerifyCommand[mypackage][LaTeX kernel]{\LaTeX}{}{True}{False}
+%
+% Example:
+% \begin{sourceverb}
+% \IfVerifyCommand[mypackage][LaTeX kernel]{\LaTeX}
+% {FAAAC6146C9A80F46A1F029B67923851}
+% {True}{False}
+% \end{sourceverb}
+% Result:
+% \IfVerifyCommand[mypackage][LaTeX kernel]{\LaTeX}
+% {FAAAC6146C9A80F46A1F029B67923851}
+% {True}{False}
+% (Assuming \cs{LaTeX} has not actually changed since
+% this manual was generated.)
+%
+% Example:
+% \begin{sourceverb}
+% \IfVerifyEnvironmentEnd[mypackage][LaTeX kernel]{tabbing}
+% {E8326AC43EE0A6E922A20F2A798BD177}
+% {True}{False}
+% \end{sourceverb}
+% Result:
+% \IfVerifyEnvironmentEnd[mypackage][LaTeX kernel]{tabbing}
+% {E8326AC43EE0A6E922A20F2A798BD177}
+% {True}{False}
+%
+% If the \pkg{verifycommand} package is disabled, these tests
+% will always return true.
+%
+% These tests do not issue warnings if the test fails, so they may
+% be used to test against several possible definitions, chosing the
+% appropriate patch depending on which match is found.
+%
+% To try to patch multiple versions of the same command,
+% and issue a warning if no match is found:
+%
+% \begin{sourceverb}
+% \TestVerifyCommands
+%
+% \IfVerifyCommand[mypackage][theirpackage]{\theirmacro}
+% {12312312312312312321312312312312}
+% {(Patch an older version of the macro.)}
+%
+% \IfVerifyCommand[mypackage][theirpackage]{\theirmacro}
+% {45645645645645645645645645645645}
+% {(Patch a newer version of the macro.)}
+%
+% \IfVerifyCommandPassed
+% {}% One of the patches worked.
+% {\VERCMDWarning{mypackage}{theirpackage}{\theirmacro}}
+% \end{sourceverb}
+%
+% To verify several commands have not changed:
+%
+% \begin{sourceverb}
+% \TestVerifyCommands
+%
+% \VerifyCommand[mypackage][theirpackage]{\firstmacro}
+% {78978978978978978978978978978978}
+% \VerifyCommand[mypackage][theirpackage]{\secondmacro}
+% {27272727272727272727277272727272}
+% \VerifyCommand[mypackage][theirpackage]{\thirdmacro}
+% {84838483848384838483848384838483}
+%
+% \IfVerifyCommandFailed
+% {Something is not correct. (Warnings have been issued above.)}
+% {}% All are fine.
+% \end{sourceverb}
+%
+%
% \subsection{Disabling the package}
%
% \pkg{verifycommand} relies on knowing the internal structure of
-% various kinds of definitions. It is possible that these may change some day,
+% various kinds of definitions. It is possible that these may change,
% causing endless warnings for that kind of definition.
% Should that happen, it will be necessary to disable the \pkg{verifycommand}
% package until it can be updated.
@@ -601,15 +788,22 @@
% \usepackage[disable]{verifycommand}
% \end{sourceverb}
%
+% Package warnings will stop,
+% and the conditional tests will always return true.
%
+% If the package is disabled, the boolean \bool{VERCMDenable}
+% will be |false|. This may be used to help decide which patches
+% to apply as a default.
%
+%
% ^^A To trigger the checksums to be copied into the exmaples:
+% \typeout{(verifycommand): The following warnings that definitions have changed}
+% \typeout{are expected, and are for demonstration purposes:}
% \VerifyCommand{\LaTeX}{}
% \VerifyCommand[mypackage]{\textcolor}{}
% \VerifyCommand[mypackage][graphics]{\rotatebox}{}
% \VerifyEnvironment{tabbing}{}{}
%
-%
% \clearpage
%
% ^^A \StopEventually{\PrintChanges\PrintIndex}
@@ -638,8 +832,8 @@
% \PrintChanges
% \phantomsection
% \label{sec:changesend}
+% \clearpage
%
-%
% ^^A The instructions for the Index of Objects:
% \IndexPrologue{
% \clearpage
@@ -719,7 +913,7 @@
%
% \typeout{--------------------------------}
% \typeout{The following warning that}
-% \typeout{something may fail is an}
+% \typeout{definitions have changed is an}
% \typeout{example of the output of this}
% \typeout{package, and is not evidence of}
% \typeout{a problem with the verifycommand}
@@ -747,16 +941,16 @@
%
% Package option to disable all functions.
%
-% \DescribeBoolean{VERCMD at enable} Is the package enabled?
+% \DescribeBoolean{VERCMDenable} Is the package enabled?
% \begin{macrocode}
-\newbool{VERCMD at enable}
-\booltrue{VERCMD at enable}
+\newbool{VERCMDenable}
+\booltrue{VERCMDenable}
% \end{macrocode}
%
% \DescribeOption{disable} Turn off all functions.
% \begin{macrocode}
\DeclareOption{disable}{%
- \boolfalse{VERCMD at enable}%
+ \boolfalse{VERCMDenable}%
\typeout{----}%
\typeout{Package verifycommand: Turned off by option 'disable'.}%
\typeout{----}%
@@ -788,6 +982,8 @@
%
% The \MDfive\ hash is used for \env{lateximage} filenames for \SVG\ math.
%
+% The default definition if no MD5 function is found.
+% This will be changed below if an MD5 function is available.
% \begin{macrocode}
\newcommand{\VERCMD at mdfivesum}[1]{%
\PackageError{verifycommand}
@@ -855,27 +1051,78 @@
% \end{macrocode}
% \end{macro}
+% \DescribeBoolean{VERCMD at this@ltxcmd} True if this command is
+% defined by \cs{NewDocumentCommand} or related.
+% \begin{macrocode}
+\newbool{VERCMD at this@ltxcmd}
+\boolfalse{VERCMD at this@ltxcmd}
+% \end{macrocode}
+% \DescribeBoolean{VERCMD at failed@ltxcmd} True if any command that failed
+% was defined by \cs{NewDocumentCommand} or related.
+% \begin{macrocode}
+\newbool{VERCMD at failed@ltxcmd}
+\boolfalse{VERCMD at failed@ltxcmd}
+% \end{macrocode}
+
+
% \begin{macro}{\VERCMD at addchanged} \marg{\MDfive sum} \marg{text} \qquad Add to the list of changed definitions.
+% \changes{v1.10}{2024/08/25}{Revised summary message.}
+% \changes{v1.10}{2024/08/28}{Added `\texttt{*}' if \cs{NewDocumentCommand} or related is used.}
% \begin{macrocode}
\newcommand*{\VERCMD at addchanged}[2]{%
+% \end{macrocode}
+% Newline control for pretty print.
+% \begin{macrocode}
\ifdefempty{\VERCMD at whatchanged}%
{}%
{\apptocmd{\VERCMD at whatchanged}{^^J}{}{}}%
- \apptocmd{\VERCMD at whatchanged}{Definition changed: #2^^J}{}{}%
- \apptocmd{\VERCMD at whatchanged}{Definition changed: \space\space\space#1}{}{}%
+% \end{macrocode}
+% ID the message as from \pkg{verifycommand}, add the text,
+% add the checksum.
+% \begin{macrocode}
+ \apptocmd{\VERCMD at whatchanged}{%
+ (verifycommand)\space\space#2^^J%
+ \space\space\space\space\space\space\space\space\space\space%
+ \space\space\space\space\space\space\space\space\space(#1)%
+ }{}{}%
+% \end{macrocode}
+% Optionally add a |*| after the checksum if the command was
+% defined with \cs{NewCommand} or related.
+% \begin{macrocode}
+ \ifbool{VERCMD at this@ltxcmd}{%
+ \apptocmd{\VERCMD at whatchanged}{ *}{}{}%
+ \booltrue{VERCMD at failed@ltxcmd}%
+ }{}%
+ \boolfalse{VERCMD at this@ltxcmd}%
}
% \end{macrocode}
% \end{macro}
% When the compile is finished, print the accumulated list of changed definitions.
+% \changes{v1.10}{2024/08/25}{Revised summary message.}
+% ^^A *date
% \begin{macrocode}
-\AfterEndDocument{
+\AtEndDocument{
\ifdefempty{\VERCMD at whatchanged}{}{%
\typeout{--------------------------------}%
- \typeout{WARNING: Something may fail.}%
- \typeout{\VERCMD at whatchanged}%
- \typeout{--------------------------------}%
+ \typeout{Package verifycommand Warning: Definitions have changed.}%
+ \typeout{Patches for the following macros may need to be updated.}%
+ \typeout{See the previous warnings for line numbers.}%
+ \typeout{}%
+ \typeout{Syntax:\space\space Patching pkg -> Defining pkg: Macro (checksum)}%
+ \typeout{-----}%
+ \typeout{\VERCMD at whatchanged}
+ \typeout{-----}%
+ \typeout{Look for updates to these packages.}
+%
+ \ifbool{VERCMD at failed@ltxcmd}{
+ \typeout{Any of the above marked with a * may be due to changes in LaTeX internals,}
+ \typeout{the most recently known of which was 2023/12/01.}
+ \typeout{If so, look for updates for the LaTeX sytem as well.}
+ }{}
+%
+ \typeout{--------------------------------}
}
}
% \end{macrocode}
@@ -895,29 +1142,33 @@
% \end{macro}
-% \begin{macro}{\VERCMD at Warning} \marg{yourpackage} \marg{theirpackage} \marg{defn name}
+% \begin{macro}{\VERCMDWarning} \marg{yourpackage} \marg{theirpackage} \marg{defn name}
%
% If no package names, print a general warning.
% If package names are given, print a \cs{PackageWarning}.
+% Either way, also add to the summary report.
+% \changes{v1.10}{2024/08/25}{Revised warning message.}
% \begin{macrocode}
-\newcommand*{\VERCMD at Warning}[3]{%
+\newcommand*{\VERCMDWarning}[3]{%
\ifblank{#1}%
{%
\VERCMD at ProgWarning{%
- Something may fail. A definition has changed:\MessageBreak
+ A definition has changed:\MessageBreak
\ifblank{#2}{}{#2: }\string#3\MessageBreak
- \VERCMD at temp\MessageBreak
- }
- \expandafter\VERCMD at addchanged\expandafter{\VERCMD at temp}{\string#3}%
+ (\VERCMD at temp)\MessageBreak
+ }%
+ \expandafter\VERCMD at addchanged%
+ \expandafter{\VERCMD at temp}{\string#3}%
}%
{%
\PackageWarning{#1}{%
- Something may fail. A definition has changed:\MessageBreak%
+ A definition has changed:\MessageBreak%
\ifblank{#2}{}{#2: }%
\string#3\MessageBreak%
- \VERCMD at temp\MessageBreak%
+ (\VERCMD at temp)\MessageBreak%
}%
- \expandafter\VERCMD at addchanged\expandafter{\VERCMD at temp}{\ifblank{#2}{}{#2: }\string#3}%
+ \expandafter\VERCMD at addchanged%
+ \expandafter{\VERCMD at temp}{#1 -> \ifblank{#2}{}{#2: }\string#3}%
}%
}
% \end{macrocode}
@@ -929,19 +1180,78 @@
% \end{macrocode}
%
%
+%
% \subsection{User interface}
%
-% \begin{macro}{\VerifyCommand} \oarg{yourpackage} \oarg{theirpackage}
+%
+% \DescribeBoolean{VERCMD at passed} True if any test passed.
+% \changes{v1.10}{2024/08/28}{Added test groups.}
+% \begin{macrocode}
+\newbool{VERCMD at passed}
+% \end{macrocode}
+%
+% \DescribeBoolean{VERCMD at failed} True if any test failed.
+% \changes{v1.10}{2024/08/28}{Added test groups.}
+% \begin{macrocode}
+\newbool{VERCMD at failed}
+% \end{macrocode}
+%
+% \begin{macro}{\TestVerifyCommands}
+% Starts a new set of \cs{VerifyCommand} tests,
+% after which the booleans will tell if any passed and if any failed.
+% \changes{v1.10}{2024/08/28}{Added test groups.}
+% \begin{macrocode}
+\newcommand*{\TestVerifyCommands}
+{
+ \boolfalse{VERCMD at passed}
+ \boolfalse{VERCMD at failed}
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\IfVerifyCommandPassed} \marg{true} \marg{false}
+% If any of the \cs{VerifyCommand} tests passed, do the |true| clause.
+% If none of them passed, do the |false| clause.
+% \changes{v1.10}{2024/08/28}{Added test groups.}
+% \begin{macrocode}
+\newcommand*{\IfVerifyCommandPassed}
+ {%
+ \ifbool{VERCMD at passed}%
+ {\let\VERCMD at tempa\@firstoftwo}%
+ {\let\VERCMD at tempa\@secondoftwo}%
+ \VERCMD at tempa%
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\IfVerifyCommandFailed} \marg{true} \marg{false}
+% If any of the \cs{VerifyCommand} tests failed, do the |true| clause.
+% If none of them failed, do the |false| clause.
+% \changes{v1.10}{2024/08/28}{Added test groups.}
+% \begin{macrocode}
+\newcommand*{\IfVerifyCommandFailed}
+ {%
+ \ifbool{VERCMD at failed}%
+ {\let\VERCMD at tempa\@firstoftwo}%
+ {\let\VERCMD at tempa\@secondoftwo}%
+ \VERCMD at tempa%
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\IfVerifyCommand} \oarg{yourpackage} \oarg{theirpackage}
% \marg{\cs{commandname}} \marg{\MDfive\ checksum}
+% \marg{true} \marg{false}
+% \changes{v1.10}{2024/06/25}{Added conditional tests.}
%
% Test for various kinds of definitions, and convert them to \MDfive\ checksums.
% \begin{macrocode}
-\NewDocumentCommand{\VerifyCommand}{O{} O{} m m}{%
+\NewDocumentCommand{\IfVerifyCommand}{O{} O{} m m}{%
% \end{macrocode}
%
% Only if the package is enabled:
% \begin{macrocode}
- \ifbool{VERCMD at enable}{%
+ \ifbool{VERCMDenable}{%
% \end{macrocode}
%
% Default to an un-detected definition type:
@@ -949,11 +1259,18 @@
\edef\VERCMD at temp{Unknown~definition}%
% \end{macrocode}
%
-% For \cs{NewDocumentCommand}, the macro name is ``|\name code|'' with a space in the middle.
+% Will become true if found \cs{NewDocumentCommand} or related.
% \begin{macrocode}
+ \boolfalse{VERCMD at this@ltxcmd}
+% \end{macrocode}
+%
+% For \cs{NewDocumentCommand}, the macro name is ``|\name code|''
+% with a space in the middle.
+% \begin{macrocode}
% % NewDocumentCommand:
\ifcsdef{\cs_to_str:N #3~code}%
{%
+ \booltrue{VERCMD at this@ltxcmd}%
\expandafter\VERCMD at mdfive%
\csname \cs_to_str:N #3~code\endcsname%
}%
@@ -972,7 +1289,8 @@
{%
% \end{macrocode}
%
-% For \cs{DeclareRobustCommand}, the macro name is ``|\name |'' with a trailing space.
+% For \cs{DeclareRobustCommand}, the macro name is ``|\name |''
+% with a trailing space.
% \begin{macrocode}
% % DeclareRobustCommand:
\ifcsdef{\cs_to_str:N #3~}%
@@ -983,19 +1301,24 @@
{%
% \end{macrocode}
%
-% For \cs{newcommand} with an option, the macro name is ``|\\name|'', with two backslashes.
+% For \cs{newcommand} with an option, the macro name is ``|\\name|'',
+% with two backslashes.
% \begin{macrocode}
% % newcommand w/ option:
\ifcsdef{\VERCMD at backslash\cs_to_str:N #3}%
{%
\expandafter\VERCMD at mdfive%
- \csname \VERCMD at backslash\cs_to_str:N #3\endcsname%
+ \csname %
+ \VERCMD at backslash%
+ \cs_to_str:N #3%
+ \endcsname%
}%
% \end{macrocode}
%
% For \cs{newcommand}, the macro name is ``|\name|''.
%
-% If none match, the default unknown definition warning is show in place of the checksum.
+% If none match, the default unknown definition warning is shown
+% in place of the checksum.
% \begin{macrocode}
{%
% % newcommand:
@@ -1008,33 +1331,65 @@
}%
% \end{macrocode}
%
-% If the checksum does not match the expected value, issue a warning.
+% If the checksum matches the expected value, do the following
+% |true| clause, else do the following |false| clause.
+% Also track the true and false tests for \cs{IfVerifyCommandPassed}
+% and \cs{IfVerifyCommandFailed}.
+% \changes{v1.10}{2024/08/28}{Added test groups.}
% \begin{macrocode}
\ifdefstring{\VERCMD at temp}{#4}%
- {}%
{%
- \VERCMD at Warning{#1}{#2}{#3}%
+ \booltrue{VERCMD at passed}%
+ \let\VERCMD at tempa\@firstoftwo%
}%
+ {%
+ \booltrue{VERCMD at failed}%
+ \let\VERCMD at tempa\@secondoftwo%
+ }%
}% if package enabled
- {}% if package not enabled
+ {\let\VERCMD at tempa\@firstoftwo}% if package not enabled
+ \VERCMD at tempa%
}
% \end{macrocode}
% \end{macro}
%
%
-% \begin{macro}{\VerifyEnvironment} \oarg{yourpackage} \oarg{theirpackage}
-% \marg{\cs{commandname}}
-% \marg{begin \MDfive\ checksum}
-% \marg{end \MDfive\ checksum}
+% \begin{macro}{\VerifyCommand} \oarg{yourpackage} \oarg{theirpackage}
+% \marg{\cs{commandname}} \marg{\MDfive\ checksum}
%
-% Test both the begin and end section of the environment.
+% Test for various kinds of definitions, and convert them to \MDfive\ checksums.
% \begin{macrocode}
-\NewDocumentCommand{\VerifyEnvironment}{O{} O{} m m m}{%
+\NewDocumentCommand{\VerifyCommand}{O{} O{} m m}{%
+ \ifblank{#1}{% #1 blank
+ \IfVerifyCommand{#3}{#4}{}{\VERCMDWarning{}{}{#3}}%
+ }% #1 blank
+ {% #1 given
+ \ifblank{#2}{% #2 blank
+ \IfVerifyCommand[#1]{#3}{#4}{}{\VERCMDWarning{#1}{}{#3}}%
+ }% #2 blank
+ {% #2 given
+ \IfVerifyCommand[#1][#2]{#3}{#4}{}{\VERCMDWarning{#1}{#2}{#3}}%
+ }% #2 given
+ }% #1 given
+}
% \end{macrocode}
+% \end{macro}
%
+%
+% \begin{macro}{\IfVerifyEnvironmentBegin}
+% \oarg{yourpackage} \oarg{theirpackage}
+% \marg{\cs{commandname}}
+% \marg{begin \MDfive\ checksum}
+% \changes{v1.10}{2024/06/25}{Added conditional tests.}
+%
+% Test the begin section of the environment.
+% \begin{macrocode}
+\NewDocumentCommand{\IfVerifyEnvironmentBegin}{O{} O{} m m}{%
+% \end{macrocode}
+%
% Only if the package is enabled:
% \begin{macrocode}
- \ifbool{VERCMD at enable}{%
+ \ifbool{VERCMDenable}{%
% \end{macrocode}
%
% Default to an un-detected definition type:
@@ -1042,11 +1397,17 @@
\edef\VERCMD at temp{Unknown~definition}%
% \end{macrocode}
%
+% Will become true if found \cs{NewDocumentCommand} or related.
+% \begin{macrocode}
+ \boolfalse{VERCMD at this@ltxcmd}
+% \end{macrocode}
+%
% For \cs{NewDocumentEnvironment}, the macro name is ``|\environment name code|'' with internal spaces.
% \begin{macrocode}
% % NewDocumentEnvironment:
\ifcsdef{environment~#3~code}%
{%
+ \booltrue{VERCMD at this@ltxcmd}%
\expandafter\VERCMD at mdfive%
\csname environment~#3~code\endcsname%
}%
@@ -1075,20 +1436,55 @@
}%
% \end{macrocode}
%
-% If the checksum does not match the expected value, issue a warning.
+% Do the first or second next argument depending on a match:
+% \changes{v1.10}{2024/08/28}{Added test groups.}
% \begin{macrocode}
\ifdefstring{\VERCMD at temp}{#4}%
- {}%
{%
- \VERCMD at Warning{#1}{#2}{#3}%
+ \booltrue{VERCMD at passed}%
+ \let\VERCMD at tempa\@firstoftwo%
}%
+ {%
+ \booltrue{VERCMD at failed}%
+ \let\VERCMD at tempa\@secondoftwo%
+ }%
% \end{macrocode}
%
-% Reset the default to an un-detected definition type:
% \begin{macrocode}
+ }% if package enabled
+ {\let\VERCMD at tempa\@firstoftwo}% if package not enabled
+ \VERCMD at tempa%
+}
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\IfVerifyEnvironmentEnd}
+% \oarg{yourpackage} \oarg{theirpackage}
+% \marg{\cs{commandname}}
+% \marg{end \MDfive\ checksum}
+% \changes{v1.10}{2024/06/25}{Added conditional tests.}
+%
+% Test the end section of the environment.
+% \begin{macrocode}
+\NewDocumentCommand{\IfVerifyEnvironmentEnd}{O{} O{} m m}{%
+% \end{macrocode}
+%
+% Only if the package is enabled:
+% \begin{macrocode}
+ \ifbool{VERCMDenable}{%
+% \end{macrocode}
+%
+% Default to an un-detected definition type:
+% \begin{macrocode}
\edef\VERCMD at temp{Unknown~definition}%
% \end{macrocode}
%
+% Will become true if found \cs{NewDocumentCommand} or related.
+% \begin{macrocode}
+ \boolfalse{VERCMD at this@ltxcmd}
+% \end{macrocode}
+%
% For \cs{NewDocumentEnvironment}, the ending macro name
% is ``|\environment name end aux |'', with spaces and a trailing space.
% \begin{macrocode}
@@ -1095,6 +1491,7 @@
% % end DocumentEnvironment:
\ifcsdef{environment~#3~end~aux~}%
{%
+ \booltrue{VERCMD at this@ltxcmd}%
\expandafter\VERCMD at mdfive
\csname environment~#3~end~aux~\endcsname%
}%
@@ -1113,25 +1510,135 @@
}%
% \end{macrocode}
%
-% If the checksum does not match the expected value, issue a warning.
+% Do the first or second next argument depending on a match:
+% \changes{v1.10}{2024/08/28}{Added test groups.}
% \begin{macrocode}
- \ifdefstring{\VERCMD at temp}{#5}%
- {}%
+ \ifdefstring{\VERCMD at temp}{#4}%
{%
- \VERCMD at Warning{#1}{#2}{(end)#3}%
+ \booltrue{VERCMD at passed}%
+ \let\VERCMD at tempa\@firstoftwo%
}%
+ {%
+ \booltrue{VERCMD at failed}%
+ \let\VERCMD at tempa\@secondoftwo%
+ }%
}% if package enabled
- {}% if package not enabled
+ {\let\VERCMD at tempa\@firstoftwo}% if package not enabled
+ \VERCMD at tempa%
}
% \end{macrocode}
% \end{macro}
%
+%
+% \begin{macro}{\VerifyEnvironment} \oarg{yourpackage} \oarg{theirpackage}
+% \marg{\cs{commandname}}
+% \marg{begin \MDfive\ checksum}
+% \marg{end \MDfive\ checksum}
+%
+% Test both the begin and end section of the environment.
% \begin{macrocode}
+\NewDocumentCommand{\VerifyEnvironment}{O{} O{} m m m}{%
+% begin:
+ \ifblank{#1}{% #1 blank
+ \IfVerifyEnvironmentBegin{#3}{#4}%
+ {}%
+ {\VERCMDWarning{}{}{#3}}%
+ }% #1 blank
+ {% #1 given
+ \ifblank{#2}{% #2 blank
+ \IfVerifyEnvironmentBegin[#1]{#3}{#4}%
+ {}%
+ {\VERCMDWarning{#1}{}{#3}}%
+ }% #2 blank
+ {% #2 given
+ \IfVerifyEnvironmentBegin[#1][#2]{#3}{#4}%
+ {}%
+ {\VERCMDWarning{#1}{#2}{#3}}%
+ }% #2 given
+ }% #1 given
+% end:
+ \ifblank{#1}{% #1 blank
+ \IfVerifyEnvironmentEnd{#3}{#5}%
+ {}%
+ {\VERCMDWarning{}{}{(end)#3}}%
+ }% #1 blank
+ {% #1 given
+ \ifblank{#2}{% #2 blank
+ \IfVerifyEnvironmentEnd[#1]{#3}{#5}%
+ {}%
+ {\VERCMDWarning{#1}{}{(end)#3}}%
+ }% #2 blank
+ {% #2 given
+ \IfVerifyEnvironmentEnd[#1][#2]{#3}{#5}%
+ {}%
+ {\VERCMDWarning{#1}{#2}{(end)#3}}%
+ }% #2 given
+ }% #1 given
+}
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macrocode}
\ExplSyntaxOff
% \end{macrocode}
%
%
+% \subsection{Verify infrastructure}
%
+% \changes{v1.10}{2024/08/28}{Tests low-level \cs{NewDocumentCommand} code.}
+%
+% The low-level infrastructure for \cs{NewDocumentCommand} and related
+% may change on occasion, causing a change in the resulting code and
+% a verification error for such code.
+% The following is done while generating the documentation
+% for the \pkg{verifycommand} package,
+% and verifies the definitions of the underlying
+% infrastructure and issues a warning if any has changed.
+%
+% In the source for the following, \filenm{ltxcmd.dtx} uses |@@| which is
+% replaced by |__cmd|.
+%
+% (Testing silently occurs here, without adding text to the documentation.)
+%
+% \ExplSyntaxOn
+%
+% \TestVerifyCommands
+%
+% ^^A *checksums
+% \VerifyCommand[verifycommand][LaTeX kernel]{\__cmd_declare_cmd_code:Nnn}
+% {0911983C176452DDE1F471783F875529}
+%
+% \VerifyCommand[verifycommand][LaTeX kernel]{\__cmd_declare_cmd_optimized:Nnn}
+% {CC1FE1C2D4782317D9E9EB391AD7FFE4}
+%
+% \VerifyCommand[verifycommand][LaTeX kernel]{\__cmd_declare_cmd_code_aux:Nnn}
+% {6675F7AC09F310F6AB963DAA0860BD37}
+%
+% \VerifyCommand[verifycommand][LaTeX kernel]{\__cmd_declare_cmd_code_expandable:Nnn}
+% {8EDCF2A369B6F9CE43280D9118F01383}
+
+% \VerifyCommand[verifycommand][LaTeX kernel]{\__cmd_declare_env_internal:nnnn}
+% {7F026120EACC68911B492D09A4B0F537}
+%
+% \ExplSyntaxOff
+%
+% \IfVerifyCommandFailed
+% {
+% \AfterEndDocument{
+% \PackageWarningNoLine{verifycommand}{%
+% The internals for LaTeX \string\NewCommand\MessageBreak%
+% and related have changed.\MessageBreak%
+% Update the checksums in verifycommand.dtx\MessageBreak
+% at `*checksums', and research when the\MessageBreak
+% internals changed and update the date\MessageBreak
+% in verifycommand.dtx at `*date'%
+% }%
+% }
+% }
+% {}
+%
+%
% \clearpage
%
% \section{\pkg{verifycommand} package maintenance}
Modified: trunk/Master/texmf-dist/tex/latex/verifycommand/verifycommand.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/verifycommand/verifycommand.sty 2024-09-02 23:41:56 UTC (rev 72179)
+++ trunk/Master/texmf-dist/tex/latex/verifycommand/verifycommand.sty 2024-09-03 20:31:10 UTC (rev 72180)
@@ -18,18 +18,16 @@
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{verifycommand}
- [2024/01/11 v1.00 Verify definitions have not changed.]
+ [2024/09/03 v1.10 Verify definitions have not changed.]
-
-
\RequirePackage{etoolbox}
\RequirePackage{iftex}
-\newbool{VERCMD at enable}
-\booltrue{VERCMD at enable}
+\newbool{VERCMDenable}
+\booltrue{VERCMDenable}
\DeclareOption{disable}{%
- \boolfalse{VERCMD at enable}%
+ \boolfalse{VERCMDenable}%
\typeout{----}%
\typeout{Package verifycommand: Turned off by option 'disable'.}%
\typeout{----}%
@@ -68,20 +66,46 @@
}
\newcommand*{\VERCMD at whatchanged}{}
+\newbool{VERCMD at this@ltxcmd}
+\boolfalse{VERCMD at this@ltxcmd}
+
+\newbool{VERCMD at failed@ltxcmd}
+\boolfalse{VERCMD at failed@ltxcmd}
+
\newcommand*{\VERCMD at addchanged}[2]{%
\ifdefempty{\VERCMD at whatchanged}%
{}%
{\apptocmd{\VERCMD at whatchanged}{^^J}{}{}}%
- \apptocmd{\VERCMD at whatchanged}{Definition changed: #2^^J}{}{}%
- \apptocmd{\VERCMD at whatchanged}{Definition changed: \space\space\space#1}{}{}%
+ \apptocmd{\VERCMD at whatchanged}{%
+ (verifycommand)\space\space#2^^J%
+ \space\space\space\space\space\space\space\space\space\space%
+ \space\space\space\space\space\space\space\space\space(#1)%
+ }{}{}%
+ \ifbool{VERCMD at this@ltxcmd}{%
+ \apptocmd{\VERCMD at whatchanged}{ *}{}{}%
+ \booltrue{VERCMD at failed@ltxcmd}%
+ }{}%
+ \boolfalse{VERCMD at this@ltxcmd}%
}
-\AfterEndDocument{
+\AtEndDocument{
\ifdefempty{\VERCMD at whatchanged}{}{%
\typeout{--------------------------------}%
- \typeout{WARNING: Something may fail.}%
- \typeout{\VERCMD at whatchanged}%
- \typeout{--------------------------------}%
+ \typeout{Package verifycommand Warning: Definitions have changed.}%
+ \typeout{Patches for the following macros may need to be updated.}%
+ \typeout{See the previous warnings for line numbers.}%
+ \typeout{}%
+ \typeout{Syntax:\space\space Patching pkg -> Defining pkg: Macro (checksum)}%
+ \typeout{-----}%
+ \typeout{\VERCMD at whatchanged}
+ \typeout{-----}%
+ \typeout{Look for updates to these packages.}
+ \ifbool{VERCMD at failed@ltxcmd}{
+ \typeout{Any of the above marked with a * may be due to changes in LaTeX internals,}
+ \typeout{the most recently known of which was 2023/12/01.}
+ \typeout{If so, look for updates for the LaTeX sytem as well.}
+ }{}
+ \typeout{--------------------------------}
}
}
@@ -93,32 +117,57 @@
}%
}
-\newcommand*{\VERCMD at Warning}[3]{%
+\newcommand*{\VERCMDWarning}[3]{%
\ifblank{#1}%
{%
\VERCMD at ProgWarning{%
- Something may fail. A definition has changed:\MessageBreak
+ A definition has changed:\MessageBreak
\ifblank{#2}{}{#2: }\string#3\MessageBreak
- \VERCMD at temp\MessageBreak
- }
- \expandafter\VERCMD at addchanged\expandafter{\VERCMD at temp}{\string#3}%
+ (\VERCMD at temp)\MessageBreak
+ }%
+ \expandafter\VERCMD at addchanged%
+ \expandafter{\VERCMD at temp}{\string#3}%
}%
{%
\PackageWarning{#1}{%
- Something may fail. A definition has changed:\MessageBreak%
+ A definition has changed:\MessageBreak%
\ifblank{#2}{}{#2: }%
\string#3\MessageBreak%
- \VERCMD at temp\MessageBreak%
+ (\VERCMD at temp)\MessageBreak%
}%
- \expandafter\VERCMD at addchanged\expandafter{\VERCMD at temp}{\ifblank{#2}{}{#2: }\string#3}%
+ \expandafter\VERCMD at addchanged%
+ \expandafter{\VERCMD at temp}{#1 -> \ifblank{#2}{}{#2: }\string#3}%
}%
}
\ExplSyntaxOn
-\NewDocumentCommand{\VerifyCommand}{O{} O{} m m}{%
- \ifbool{VERCMD at enable}{%
+\newbool{VERCMD at passed}
+\newbool{VERCMD at failed}
+\newcommand*{\TestVerifyCommands}
+{
+ \boolfalse{VERCMD at passed}
+ \boolfalse{VERCMD at failed}
+}
+\newcommand*{\IfVerifyCommandPassed}
+ {%
+ \ifbool{VERCMD at passed}%
+ {\let\VERCMD at tempa\@firstoftwo}%
+ {\let\VERCMD at tempa\@secondoftwo}%
+ \VERCMD at tempa%
+ }
+\newcommand*{\IfVerifyCommandFailed}
+ {%
+ \ifbool{VERCMD at failed}%
+ {\let\VERCMD at tempa\@firstoftwo}%
+ {\let\VERCMD at tempa\@secondoftwo}%
+ \VERCMD at tempa%
+ }
+\NewDocumentCommand{\IfVerifyCommand}{O{} O{} m m}{%
+ \ifbool{VERCMDenable}{%
\edef\VERCMD at temp{Unknown~definition}%
+ \boolfalse{VERCMD at this@ltxcmd}
\ifcsdef{\cs_to_str:N #3~code}%
{%
+ \booltrue{VERCMD at this@ltxcmd}%
\expandafter\VERCMD at mdfive%
\csname \cs_to_str:N #3~code\endcsname%
}%
@@ -138,7 +187,10 @@
\ifcsdef{\VERCMD at backslash\cs_to_str:N #3}%
{%
\expandafter\VERCMD at mdfive%
- \csname \VERCMD at backslash\cs_to_str:N #3\endcsname%
+ \csname %
+ \VERCMD at backslash%
+ \cs_to_str:N #3%
+ \endcsname%
}%
{%
\ifdef{#3}%
@@ -149,18 +201,38 @@
}%
}%
\ifdefstring{\VERCMD at temp}{#4}%
- {}%
{%
- \VERCMD at Warning{#1}{#2}{#3}%
+ \booltrue{VERCMD at passed}%
+ \let\VERCMD at tempa\@firstoftwo%
}%
+ {%
+ \booltrue{VERCMD at failed}%
+ \let\VERCMD at tempa\@secondoftwo%
+ }%
}% if package enabled
- {}% if package not enabled
+ {\let\VERCMD at tempa\@firstoftwo}% if package not enabled
+ \VERCMD at tempa%
}
-\NewDocumentCommand{\VerifyEnvironment}{O{} O{} m m m}{%
- \ifbool{VERCMD at enable}{%
+\NewDocumentCommand{\VerifyCommand}{O{} O{} m m}{%
+ \ifblank{#1}{% #1 blank
+ \IfVerifyCommand{#3}{#4}{}{\VERCMDWarning{}{}{#3}}%
+ }% #1 blank
+ {% #1 given
+ \ifblank{#2}{% #2 blank
+ \IfVerifyCommand[#1]{#3}{#4}{}{\VERCMDWarning{#1}{}{#3}}%
+ }% #2 blank
+ {% #2 given
+ \IfVerifyCommand[#1][#2]{#3}{#4}{}{\VERCMDWarning{#1}{#2}{#3}}%
+ }% #2 given
+ }% #1 given
+}
+\NewDocumentCommand{\IfVerifyEnvironmentBegin}{O{} O{} m m}{%
+ \ifbool{VERCMDenable}{%
\edef\VERCMD at temp{Unknown~definition}%
+ \boolfalse{VERCMD at this@ltxcmd}
\ifcsdef{environment~#3~code}%
{%
+ \booltrue{VERCMD at this@ltxcmd}%
\expandafter\VERCMD at mdfive%
\csname environment~#3~code\endcsname%
}%
@@ -177,13 +249,25 @@
}%
}%
\ifdefstring{\VERCMD at temp}{#4}%
- {}%
{%
- \VERCMD at Warning{#1}{#2}{#3}%
+ \booltrue{VERCMD at passed}%
+ \let\VERCMD at tempa\@firstoftwo%
}%
+ {%
+ \booltrue{VERCMD at failed}%
+ \let\VERCMD at tempa\@secondoftwo%
+ }%
+ }% if package enabled
+ {\let\VERCMD at tempa\@firstoftwo}% if package not enabled
+ \VERCMD at tempa%
+}
+\NewDocumentCommand{\IfVerifyEnvironmentEnd}{O{} O{} m m}{%
+ \ifbool{VERCMDenable}{%
\edef\VERCMD at temp{Unknown~definition}%
+ \boolfalse{VERCMD at this@ltxcmd}
\ifcsdef{environment~#3~end~aux~}%
{%
+ \booltrue{VERCMD at this@ltxcmd}%
\expandafter\VERCMD at mdfive
\csname environment~#3~end~aux~\endcsname%
}%
@@ -195,15 +279,57 @@
}%
{}%
}%
- \ifdefstring{\VERCMD at temp}{#5}%
- {}%
+ \ifdefstring{\VERCMD at temp}{#4}%
{%
- \VERCMD at Warning{#1}{#2}{(end)#3}%
+ \booltrue{VERCMD at passed}%
+ \let\VERCMD at tempa\@firstoftwo%
}%
+ {%
+ \booltrue{VERCMD at failed}%
+ \let\VERCMD at tempa\@secondoftwo%
+ }%
}% if package enabled
- {}% if package not enabled
+ {\let\VERCMD at tempa\@firstoftwo}% if package not enabled
+ \VERCMD at tempa%
}
+\NewDocumentCommand{\VerifyEnvironment}{O{} O{} m m m}{%
+ \ifblank{#1}{% #1 blank
+ \IfVerifyEnvironmentBegin{#3}{#4}%
+ {}%
+ {\VERCMDWarning{}{}{#3}}%
+ }% #1 blank
+ {% #1 given
+ \ifblank{#2}{% #2 blank
+ \IfVerifyEnvironmentBegin[#1]{#3}{#4}%
+ {}%
+ {\VERCMDWarning{#1}{}{#3}}%
+ }% #2 blank
+ {% #2 given
+ \IfVerifyEnvironmentBegin[#1][#2]{#3}{#4}%
+ {}%
+ {\VERCMDWarning{#1}{#2}{#3}}%
+ }% #2 given
+ }% #1 given
+ \ifblank{#1}{% #1 blank
+ \IfVerifyEnvironmentEnd{#3}{#5}%
+ {}%
+ {\VERCMDWarning{}{}{(end)#3}}%
+ }% #1 blank
+ {% #1 given
+ \ifblank{#2}{% #2 blank
+ \IfVerifyEnvironmentEnd[#1]{#3}{#5}%
+ {}%
+ {\VERCMDWarning{#1}{}{(end)#3}}%
+ }% #2 blank
+ {% #2 given
+ \IfVerifyEnvironmentEnd[#1][#2]{#3}{#5}%
+ {}%
+ {\VERCMDWarning{#1}{#2}{(end)#3}}%
+ }% #2 given
+ }% #1 given
+}
\ExplSyntaxOff
+
\endinput
%%
%% End of file `verifycommand.sty'.
More information about the tex-live-commits
mailing list.