%
% \iffalse meta-comment
%
% Copyright 2024–2025 Brian Dunn
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
% 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.3 or later is part of all distributions of LaTeX
% version 2005/12/01 or later.
%
% \fi

%
% \iffalse
%<package>\NeedsTeXFormat{LaTeX2e}
%<package>\ProvidesPackage{verifycommand}
%<package>    [2025/03/07 v1.11 Verify definitions have not changed.]
%
%<*driver>
\documentclass{ltxdoc}

\newcommand*{\mypackagename}{verifycommand}
\newcommand{\quicksummary}{Verifies that definitions have not changed.}


% \usepackage{lmodern}
\usepackage{erewhon}
\usepackage{roboto}
% \usepackage{sourcesanspro}
\usepackage{inconsolata}
% \usepackage{libertine}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{textcomp}	% provides \degree, \textquotesingle, \textmu


\newcommand*{\TakeFourierOrnament}[1]{{%
\fontencoding{U}\fontfamily{futs}\selectfont\char#1}}

\newcommand*{\textwarning}{\TakeFourierOrnament{66}}

% copy/paste special unicode symbols:
\input{glyphtounicode}
\pdfglyphtounicode{prime}{2032}% hex
\pdfglyphtounicode{diameter}{2300}% diameter
\pdfglyphtounicode{warningsign}{26A0}% warning sign
\pdfgentounicode=1

\usepackage{newunicodechar}
\newunicodechar{ﬀ}{ff}
\newunicodechar{ﬁ}{fi}
\newunicodechar{ﬂ}{fl}
\newunicodechar{ﬃ}{ffi}
\newunicodechar{ﬄ}{ffl}
% \newunicodechar{°}{\degree}
\newunicodechar{ρ}{\ensuremath{\rho}}
\newunicodechar{⨯}{\texttimes}
\newunicodechar{⁄}{\textfractionsolidus}
% \newunicodechar{®}{\textregistered}
% \newunicodechar{©}{\textcopyright}
\newunicodechar{—}{---}
\newunicodechar{–}{--}
% \newunicodechar{”}{''}
% \newunicodechar{“}{``}
% \newunicodechar{§}{\S}
% \newunicodechar{¶}{\P}
% \newunicodechar{†}{\dag}
\newunicodechar{‡}{\ddag}
\newunicodechar{⚠}{\textwarning}

\usepackage{etoolbox}

\usepackage{metalogox}

\usepackage{microtype}

\usepackage{nowidow}


\usepackage[svgnames]{xcolor}
\definecolor{myurlcolor}{rgb}{0,0,.7}
\definecolor{mylinkcolor}{rgb}{.7,0,0}
\definecolor{codecolor}{rgb}{0,.4,.2}
\definecolor{overviewcolor}{rgb}{0,.2,.4}


%\usepackage{graphicx}
%\graphicspath{{images/}}

%\usepackage{enumitem}

\usepackage{needspace}

%\usepackage{array}
%\usepackage{booktabs}
%\usepackage{threeparttable}

%\usepackage{fancybox}% must be loaded before fancyvrb
%\usepackage{fancyvrb}


%\usepackage{caption}
%\usepackage{newfloat}

%\captionsetup{labelfont={small,bf},textfont={small,bf}}

%\captionsetup*[figure]{
%	style=default, justification=centering,
%	margin=0pt, parskip=0pt, skip=2ex,
%	labelfont={small,bf},textfont={small,bf}
%}

%\captionsetup*[table]{
%	style=default, justification=centering,
%	margin=0pt, parskip=0pt, skip=1ex,
%	labelfont={small,bf},textfont={small,bf},
%    position=top
%}

%\captionsetup*[subfigure]{
%	style=default, justification=centering,
%	margin=0pt, parskip=0pt, skip=2ex,
%	labelfont={small},textfont={small}
%}

%\captionsetup*[subtable]{
%	style=default, justification=centering,
%	margin=0pt, parskip=0pt, skip=1ex,
%	labelfont={small},textfont={small},
%    position=top
%}

%\captionsetup*[wrapfigure]{
%	style=default, justification=centering,
%	margin=0pt, parskip=0pt, skip=2ex,
%	labelfont={small,bf},textfont={small,bf}
%}

%\captionsetup*[wraptable]{
%	style=default, justification=centering,
%	margin=0pt, parskip=0pt, skip=1ex,
%	labelfont={small,bf},textfont={small,bf}
%}



%\usepackage{blindtext}



%\usepackage{tikz}
%\usetikzlibrary{positioning,fit,backgrounds,calc,shapes.geometric,shadows}

%\usepackage[framemethod=tikz]{mdframed}

%\mdfdefinestyle{boxroundshadow}{linewidth=1pt,innerleftmargin=0in,innerrightmargin=0in,%
%innertopmargin=0in,innerbottommargin=0in,%
%align=center,roundcorner=3pt,shadow=true,shadowcolor=black!50,shadowsize=4pt,%
%leftmargin=0pt,rightmargin=0pt,%
%frametitlebackgroundcolor=black!15,%
%skipabove=0ex,skipbelow=0ex,%
%frametitlerulewidth=1pt,frametitleaboveskip=5pt,%
%}

%\newmdenv[style=boxroundshadow,align=center]{mdtightframe}

%\newmdenv[style=boxroundshadow,align=center,%
%	innertopmargin=3pt,innerbottommargin=3pt,%
%	innerleftmargin=3pt,innerrightmargin=3pt]{mdlooseframe}


\usepackage[normalem]{ulem}


%\usepackage{tocdata}[2019/03/21]% v2.02 or later

\usepackage{tocloft}
\setlength{\cftsubsecnumwidth}{3em}
\setlength{\cftsubsubsecindent}{2.8em}
\setlength{\cftsubsubsecnumwidth}{4em}
\setlength{\cftbeforesubsecskip}{1ex}

% \usepackage{titletoc}



\usepackage{titleps}

\newpagestyle{pageheadfoot}{
	\headrule
	\sethead{\pkg{\mypackagename}}{}{\thepage}
% 	\renewcommand{\makefootrule}{\rule[2.5ex]{\linewidth}{.4pt}}
	\setfoot{}{}{}
}

\pagestyle{pageheadfoot}


% Indexing, logos, \Describexxxx, etc:
\usepackage{dtxdescribe}[2023/01/03]



\usepackage{splitidx}

\newindex[Index of Objects]{idx}
%\newindex[General Index]{gen}
% \newindex[Troubleshooting Index]{trb}
%\newindex[Index of Indexes]{meta}

\makeindex

\newcommand*{\gindex}[1]{\sindex[gen]{#1}\ignorespaces}

% \trouble[watchout phrase]{index entry}
\newcommand*{\trouble}[2][]{%
\ifblank{#1}{}{%
    \watchout[#1]%
}%
% \sindex[trb]{#2}%
\gindex{#2}%
\ignorespaces%
}


\newcommand*{\MDfive}{\begingroup\textup{\acro{MD5}}\endgroup}

%\setlength{\floatsep}{5ex plus 1ex minus 1ex}
%\setlength{\dblfloatsep}{5ex plus 1ex minus 1ex}


\usepackage{\mypackagename}
%\usepackage[disable]{\mypackagename}




\AtBeginDocument{
\hypersetup{%
pdfinfo={%
Title={The LaTeX \mypackagename\ package},%
Author={Brian Dunn},%
Subject={Verify LaTeX definitions are unchanged.},%
Keywords={LaTeX}%
colorlinks,%
linkcolor=mylinkcolor,%
urlcolor=myurlcolor,%
pageanchor=true,
}}

\pdfstringdefDisableCommands{
\def\quad{ }
\def\\{ }
\def\pkg#1{#1}
\def\cs#1{\textbackslash#1}
\def\env#1{#1}
\def\,{ }
\def\prog#1{#1}
\def\LuaLaTeX{LuaLaTeX}
\def\XeLaTeX{XeLaTeX}
\def\TeX{TeX}
\def\LaTeX{LaTeX}
\def\Dash{ --- }
\def\dash{ -- }
\def\element#1{#1}
\def\attribute#1{#1}
\def\MDfive{MD5}
}
}% AtBeginDocument

\AddToHook{begindocument/before}{% Before .aux file is loaded.
  \usepackage{cleveref}%                  If needed.
}




\setlength{\marginparsep}{1em}
\setlength{\marginparpush}{.7ex}
\setlength{\IndexMin}{40ex}

\setcounter{IndexColumns}{2}


\DisableCrossrefs
\CodelineIndex
\RecordChanges
\begin{document}
  \DocInput{\mypackagename.dtx}
\end{document}
%
%</driver>
% 
% \fi
%
% \iffalse
%<*package>
% \fi
%

% \changes{v1.00}{2024/01/11}{\ 2024/01/11 Initial version.}
% \changes{v1.10}{2024/09/03}{\ 2024/09/03}
% \changes{v1.11}{2025/03/07}{\ 2025/03/07}
% \changes{v1.11}{2025/03/07}{Documentation improvements.}


% \GetFileInfo{\mypackagename.sty}
%
% \DoNotIndex{\newcommand,\renewcommand,\addtocounter,\begin,\end,\begingroup,\endgroup}
% \DoNotIndex{\global,\ifbool,\ifthenelse,\isequivalentto,\let}
% \DoNotIndex{\booltrue,\boolfalse}
% \expandafter\DoNotIndex\expandafter{\detokenize{\(,\),\,,\\,\#,\$,\%,\^,\_,\~,\ ,\&,\{,\}}}
%
%
% \thispagestyle{empty}
% \begin{center}
% \vfill
% ^^A \includegraphics[width=.3\linewidth]{\mypackagename_logo.pdf}
% \vfill
% {\Huge The \LaTeX\\
% \pkg{\mypackagename}\\
%  Package}
% \bigskip
%
% \fileversion{} --- \filedate
%
% \bigskip
%
% {\small\textcopyright{} 2024--2025} Brian Dunn\\ \small \url{https://github.com/bdtc/verifycommand}
%
% \vspace{.5in}
%
% {\Large \textup{\quicksummary}}
%
%
% \vfill
%
% 
% \vfill
%
%
% \begin{abstract}
% \noindent
% For package authors who patch code from other packages.
%
% To improve reliability,
% the \pkg{verifycommand} package provides a way to verify that
% 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
% \begin{description}
% \item[License:] \
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
% 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.3 or later is part of all distributions of LaTeX
% version 2005/12/01 or later.
% \end{description}
%
% \end{abstract}
%
% \vspace*{\fill}
% \vspace*{\fill}
% \vspace*{\fill}
% \end{center}
% \clearpage
%
% \tableofcontents
% ^^A \listofdtxexamplefloats
% ^^A \listoffigures
% ^^A \listoftables
%
%
% \thispagestyle{pageheadfoot}
%
% \clearpage
%
%^^A \part{verifycommand.sty}
%
% \section{Introduction}
%
% Patching a macro or environment from another package risks
% the possibility that the other author has made an update
% and changed something unexpected,
% breaking your own package when it tries to apply the patch.
%
% The traditional way to check a definition you wish to modify
% is to copy the expected definition into your package under a new name,
% then compare to see if the current definition
% is the same as it was when your package was first created.
% For a few definitions this may work well, but as the number
% of patches goes up things get more and more unwieldy.
%
% The \pkg{verifycommand} package uses \MDfive\ checksums instead of
% copying entire definitions.
% If something has changed, a warning is issued telling the
% name of the defintion, and optionally telling the name of your
% own package and the package being modified.
% This improves code reliability, and allows package authors
% to get an early warning when an author of some other package
% has made an unexpected change.
%
% In many cases, the patch or replacement may still function correctly
% even when the original has changed in some way.
% For this reason, only a warning is issued, not an error.
%
%
% \section{How it works}
%
% \cs{VerifyCommand} and \cs{VerifyEnvironment} are used to test
% whether a definition has changed.
% Each definition is given an \MDfive\ checksum, which is compared to
% the expected checksum given as arguments of \cs{VerifyCommand}
% and \cs{VerifyEnvironment}.
% If a checksum does not match, a warning is issued,
% flagging the definition for attention.
%
% The \MDfive\ checksum is of the text of the code part of the underlying definition,
% as it would be displayed by the \cs{meaning} command.
% For environments, the end code is checked separately.
% The check detects changes in the replacement text of the definition,
% and may or may not detect changes in the number or type of parameters,
% \cs{long}, or type of robustness, depending on the type of definition.
% Some definitions may have the same checksum if they have the same
% replacement code but different argument types, for example
% a \cs{NewDocumentCommand} with two mandatory arguments vs another with one optional
% and one mandatory, if they both have the same replacement code.
%
% When something does not match, the current checksum is printed to
% the terminal, and the author may copy/paste that into the parameter of
% \cs{VerifyCommand} or \cs{VerifyEnvironment} to update the
% expected values.
%
%
% \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}
%
% \needspace{3\baselineskip}
% \DescribeMacro{\VerifyEnvironment} \oarg{yourpackagename} \oarg{theirpackagename}
%       \marg{\env{envname}} \\
%       \fqquad \marg{begin \MDfive\ checksum} \marg{end \MDfive\ checksum}
%
% Use one of these macros just before patching a macro or environment,
% 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 an environment: once for the begin section
% and one for the end section.
%
% 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
% \cs{VerifyCommand} or \cs{VerifyEnvironment} before each place
% where something gets patched.
% This is probably not required where things are entirely replaced,
% or prepended or appended.
%
% \begin{sourceverb}
% \VerifyCommand{\LaTeX}{}
% (patch \LaTeX here)
%
% \VerifyCommand[mypackage]{\textcolor}{}
% (patch \textcolor here)
%
% \VerifyCommand[mypackage][graphics]{\rotatebox}{}
% (patch \rotatebox here)
%
% \VerifyEnvironment{tabbing}{}{}
% (patch tabbing here)
% \end{sourceverb}
%
%
% \subsection{Finding the checksums of the current definitions}
% \changes{v1.10}{2024/06/25}{Docs: ``Finding checksums'' reorganized.}
%
% 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: A definition has changed:
%         \LaTeX
%         (FAAAC6146C9A80F46A1F029B67923851)
%          on input line 464.
% \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)                 on input line 465.
% \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)                 on input line 466.
% \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)
%          on input line 518.
%
% Warning: A definition has changed:
%         (end)tabbing
%         (E8326AC43EE0A6E922A20F2A798BD177)
%          on input line 518.
% \end{sourceverb}
% \end{itemize}
%
%
% At the end of the compile, a summary is given:
%
% \begin{sourceverb}
% --------------------------------
% 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}
%
%
% \subsection{Assigning the checksums}
% Copy the checksums from the warnings messages into the source.
% When this is done, there are no more \pkg{verifycommand} warnings
% unless one of these defintions changes:
%
% \begin{sourceverb}
% \VerifyCommand{\LaTeX}{FAAAC6146C9A80F46A1F029B67923851}
% (patch \LaTeX here)
%
% \VerifyCommand[mypackage]{\textcolor}
%                   {E1E2B5A908AA1BCDDF6BEA038596A381}
% (patch \textcolor here)
%
% \VerifyCommand[mypackage][graphics]{\rotatebox}
%                   {2472999B02C97AC847128AF24C55D150}
% (patch \rotatebox here)
%
% \VerifyEnvironment{tabbing}
%       {1AD73B4527AD30969CF3219F2FB1306B}%   beginning code
%       {E8326AC43EE0A6E922A20F2A798BD177}%   endind code
% (patch tabbing here)
% \end{sourceverb}
%
%
% \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
% as expected.
% Because the test is done before the patch,
% 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 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.)}% true
%       {}% false
%
% \IfVerifyCommand[mypackage][theirpackage]{\theirmacro}
%       {45645645645645645645645645645645}
%       {(Patch a newer version of the macro.)}% true
%       {}% false
%
% \IfVerifyCommandPassed
%       {}% true: One of the patches worked.
%       {\VERCMDWarning{mypackage}{theirpackage}{\theirmacro}}% false
% \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,
% 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.
% Use the \optn{disable} option to do so.
%
% \begin{sourceverb}
% \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}
%
% \makeatletter
%
% \StopEventually{
% ^^A \part{Change History and Index}
% ^^A  \part{Change History}
%
%
% \pagestyle{plain}
%
% ^^A Each index has a prologue which creates its own \part, label,
% ^^A and meta index entry.
%   \GlossaryPrologue{
%       \part{Change History}
% ^^A     \section{Chg Hist}
%       \label{sec:changehistory}
% ^^A      \sindex[meta]{Change History}
%       \markboth{{Change History}}{{Change History}}
%
% ^^A       For the most recent changes, see page \pageref{sec:changesend}.
%
%   }
%   \PrintChanges
%   \phantomsection
%   \label{sec:changesend}
%   \clearpage
%
% ^^A The instructions for the Index of Objects:
%   \IndexPrologue{
%       \clearpage
%       \expandafter\part\expandafter{\indexname}
%       \label{sec:index\indexshortcut}
% ^^A      \sindex[meta]{\indexname}
%         \markboth{Index of Objects}{Index of Objects}%
%
%       This is an index of macros, environments, booleans, counters, lengths,
%       packages, classes, options, keys, files, and various other programming objects.
%       Each is listed by itself, and also by category.
%       In some cases, they are further subdivided by [class].
%
%       Numbers written in italic refer to the page
%       where the corresponding entry is described;
%       numbers underlined refer to the
%       \ifcodeline@index
%       code line of the
%       \fi
%       definition.
% ^^A        ; numbers in roman refer to the
% ^^A         \ifcodeline@index
% ^^A         code lines
% ^^A         \else
% ^^A         pages
% ^^A         \fi
% ^^A         where the entry is used.
%   }
%
%   \printindex[idx][Index of Objects]
%
%
% ^^A The instructions for the General Index:
%   \IndexPrologue{
%       \clearpage
%       \expandafter\part\expandafter{\indexname}
%       \label{sec:index\indexshortcut}
% ^^A      \sindex[meta]{\indexname}
%
% ^^A      This is an index of instructions and concepts.
% ^^A      Look here when wondering how to do something, and
% ^^A      check the Troubleshooting Index when something goes wrong.
%       This is a general index, including how-to and troubleshooting.
%   }
%
%   \printindex[gen][General Index]
%
%
% ^^A% The instructions for the Troubleshooting Index:
% ^^A%   \IndexPrologue{
% ^^A%       \clearpage
% ^^A%       \expandafter\part\expandafter{\indexname}
% ^^A%       \label{sec:index\indexshortcut}
% ^^A%       \sindex[meta]{\indexname}
% ^^A%
% ^^A%       This index is a sorted reference of problems and solutions.
% ^^A%       In order to make it easier to locate a solution,
% ^^A%       the same issue may be addressed by more than one entry.
% ^^A%
% ^^A%       Entries with higher page numbers are often duplicates of entries with
% ^^A%       lower page numbers, as the same warning may occur within the user manual
% ^^A%       and again within the source code for a given package.
% ^^A%   }
% ^^A%
% ^^A%   \printindex[trb][Troubleshooting Index]
%
%
% ^^A The meta index does not get a meta index entry pointing  to itself:
%   \IndexPrologue{

%       \clearpage
%       \expandafter\part\expandafter{\indexname}
%       \label{sec:index\indexshortcut}
%   }
%
% ^^A   \printindex[meta][Index of Indexes]
%
%     \typeout{--------------------------------}
%     \typeout{The following warning that}
%     \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}
%     \typeout{manual or documentation.}
%     \typeout{--------------------------------}
%
% }
%
% \makeatother
%
%
%
%
% \section{Code}
% ^^A *source
%
% \subsection{Package requirements}
%    \begin{macrocode}
\RequirePackage{etoolbox}
\RequirePackage{iftex}
%    \end{macrocode}
%
%
% \subsection{Package options}
%
% Package option to disable all functions.
%
% \DescribeBoolean{VERCMDenable} Is the package enabled?
%    \begin{macrocode}
\newbool{VERCMDenable}
\booltrue{VERCMDenable}
%    \end{macrocode}
%
% \DescribeOption{disable} Turn off all functions.
%    \begin{macrocode}
\DeclareOption{disable}{%
    \boolfalse{VERCMDenable}%
    \typeout{----}%
    \typeout{Package verifycommand: Turned off by option 'disable'.}%
    \typeout{----}%
}

\ProcessOptions\relax
%    \end{macrocode}
%
%
% \subsection{Support macros}
%
% \begin{macro}{\VERCMD@backslash} The literal |\| character.
%
% This is used later because some internal definitions use double |\\| as
% part of their name.
%    \begin{macrocode}
\catcode`\&=0
&catcode`&\=12
&def&VERCMD@backslash{\}
&catcode`&\=0
\catcode`\&=4
%    \end{macrocode}
% \end{macro}
%
% 
%
%
% \subsection{\MDfive\ hashing}
%
% 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@mdfivesum}[1]{%
    \PackageError{verifycommand}
        {No MD5 macro was found}
        {%
            Verifycommand must find the macros \protect\pdfmdfivesum\space
            or \protect\mdfivesum.%
        }
}
%    \end{macrocode}
%
% The default for \pdfLaTeX, \dviLaTeX, up\LaTeX, etc:
%    \begin{macrocode}
\ifdef{\pdfmdfivesum}
    {\let\VERCMD@mdfivesum\pdfmdfivesum}
    {}
%    \end{macrocode}
%
% For \LuaLaTeX:
%    \begin{macrocode}
\ifLuaTeX
\RequirePackage{pdftexcmds}
\let\VERCMD@mdfivesum\pdf@mdfivesum
\fi
%    \end{macrocode}
%
% For \XeLaTeX:
%    \begin{macrocode}
\ifXeTeX
\@ifundefined{pdffivesum}{}
    {\let\VERCMD@mdfivesum\pdfmdfivesum}
\@ifundefined{mdfivesum}{}
    {\let\VERCMD@mdfivesum\mdfivesum}
\fi
%    \end{macrocode}

% \begin{macro}{\VERCMD@mdfive} \marg{\cs{macroname}} \qquad
%       Compute \MDfive\ checksum, store in \cs{VERCMD@temp}.
%    \begin{macrocode}
\def\VERCMD@mdfive#1{%
    \edef\VERCMD@temp{\VERCMD@mdfivesum{\meaning#1}}%
}
%    \end{macrocode}
% \end{macro}
%
%
% \subsection{Issuing warnings}
%
% ^^A %    \begin{macrocode}
% ^^A \gdef\VERCMD@ProgError#1#2{%
% ^^A     \GenericError{%
% ^^A         (\jobname)\@spaces\@spaces\@spaces\@spaces
% ^^A     }{%
% ^^A         \jobname\ Error: #1%
% ^^A     }{%
% ^^A         Something has changed and the result may fail.%
% ^^A     }{#2}%
% ^^A }
% ^^A %    \end{macrocode}
%
%
% \begin{macro}{\VERCMD@whatchanged} Accumulates a list of changed definitions.
%    \begin{macrocode}
\newcommand*{\VERCMD@whatchanged}{}
%    \end{macrocode}
% \end{macro}

% \DescribeBoolean{VERCMD@this@ltxcmd} True if this command is
% defined by \cs{NewDocumentCommand} or related.
%    \begin{macrocode}
\newbool{VERCMD@this@ltxcmd}
\boolfalse{VERCMD@this@ltxcmd}
%    \end{macrocode}

% \DescribeBoolean{VERCMD@failed@ltxcmd} True if any command that failed
% was defined by \cs{NewDocumentCommand} or related.
%    \begin{macrocode}
\newbool{VERCMD@failed@ltxcmd}
\boolfalse{VERCMD@failed@ltxcmd}
%    \end{macrocode}


% \begin{macro}{\VERCMD@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@addchanged}[2]{%
%    \end{macrocode}
% Newline control for pretty print.
%    \begin{macrocode}
    \ifdefempty{\VERCMD@whatchanged}%
        {}%
        {\apptocmd{\VERCMD@whatchanged}{^^J}{}{}}%
%    \end{macrocode}
% ID the message as from \pkg{verifycommand}, add the text,
% add the checksum.
%    \begin{macrocode}
    \apptocmd{\VERCMD@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@this@ltxcmd}{%
        \apptocmd{\VERCMD@whatchanged}{ *}{}{}%
        \booltrue{VERCMD@failed@ltxcmd}%
    }{}%
    \boolfalse{VERCMD@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}
\AtEndDocument{
    \ifdefempty{\VERCMD@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@whatchanged}
        \typeout{-----}%
        \typeout{Look for updates to these packages.}
%
        \ifbool{VERCMD@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}


% \begin{macro}{\VERCMD@ProgWarning} \marg{text} \qquad Warning without a package name.
%    \begin{macrocode}
\def\VERCMD@ProgWarning#1{%
    \GenericWarning{%
%        (\jobname)\@spaces\@spaces%
        \@spaces\@spaces
    }{%
        Warning: #1%
    }%
}
%    \end{macrocode}
% \end{macro}


% \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*{\VERCMDWarning}[3]{%
    \ifblank{#1}%
        {%
            \VERCMD@ProgWarning{%
                A definition has changed:\MessageBreak
                \ifblank{#2}{}{#2: }\string#3\MessageBreak
                (\VERCMD@temp)\MessageBreak
            }%
            \expandafter\VERCMD@addchanged%
                \expandafter{\VERCMD@temp}{\string#3}%
        }%
        {%
            \PackageWarning{#1}{%
                A definition has changed:\MessageBreak%
                \ifblank{#2}{}{#2: }%
                \string#3\MessageBreak%
                (\VERCMD@temp)\MessageBreak%
            }%
            \expandafter\VERCMD@addchanged%
                \expandafter{\VERCMD@temp}{#1 -> \ifblank{#2}{}{#2: }\string#3}%
        }%
}
%    \end{macrocode}
% \end{macro}
%
%
%    \begin{macrocode}
\ExplSyntaxOn
%    \end{macrocode}
%
%
%
% \subsection{User interface}
%
%
% \DescribeBoolean{VERCMD@passed} True if any test passed.
% \changes{v1.10}{2024/08/28}{Added test groups.}
%    \begin{macrocode}
\newbool{VERCMD@passed}
%    \end{macrocode}
%
% \DescribeBoolean{VERCMD@failed} True if any test failed.
% \changes{v1.10}{2024/08/28}{Added test groups.}
%    \begin{macrocode}
\newbool{VERCMD@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@passed}
    \boolfalse{VERCMD@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@passed}%
            {\let\VERCMD@tempa\@firstoftwo}%
            {\let\VERCMD@tempa\@secondoftwo}%
        \VERCMD@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@failed}%
            {\let\VERCMD@tempa\@firstoftwo}%
            {\let\VERCMD@tempa\@secondoftwo}%
        \VERCMD@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{\IfVerifyCommand}{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@temp{Unknown~definition}%
%    \end{macrocode}
%
% Will become true if found \cs{NewDocumentCommand} or related.
%    \begin{macrocode}
    \boolfalse{VERCMD@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@this@ltxcmd}%
            \expandafter\VERCMD@mdfive%
                \csname \cs_to_str:N #3~code\endcsname%
        }%
        {%
%    \end{macrocode}
%
% For \cs{DeclareRobustCommand} with an optional argument,
% the macro name is ``|\\name |'' with a two backslashes and a trailing space.
%    \begin{macrocode}
%            % DeclareRobustCommmand with option:
             \ifcsdef{\VERCMD@backslash\cs_to_str:N #3~}%
                {%
                    \expandafter\VERCMD@mdfive%
                        \csname \cs_to_str:N #3~code\endcsname%
                }%
                {%
%    \end{macrocode}
%
% For \cs{DeclareRobustCommand}, the macro name is ``|\name |''
%   with a trailing space.
%    \begin{macrocode}
%                    % DeclareRobustCommand:
                     \ifcsdef{\cs_to_str:N #3~}%
                        {%
                            \expandafter\VERCMD@mdfive%
                                \csname \cs_to_str:N #3~\endcsname%
                        }%
                        {%
%    \end{macrocode}
%
% For \cs{newcommand} with an option, the macro name is ``|\\name|'',
%   with two backslashes.
%    \begin{macrocode}
%                            % newcommand w/ option:
                             \ifcsdef{\VERCMD@backslash\cs_to_str:N #3}%
                                {%
                                    \expandafter\VERCMD@mdfive%
                                    \csname %
                                        \VERCMD@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 shown
%   in place of the checksum.
%    \begin{macrocode}
                                {%
%                                    % newcommand:
                                     \ifdef{#3}%
                                        {\VERCMD@mdfive#3}%
                                        {}%
                                }%
                        }%
                }%
        }%
%    \end{macrocode}
%
% 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@temp}{#4}%
        {%
            \booltrue{VERCMD@passed}%
            \let\VERCMD@tempa\@firstoftwo%
        }%
        {%
            \booltrue{VERCMD@failed}%
            \let\VERCMD@tempa\@secondoftwo%
        }%
    }% if package enabled
    {\let\VERCMD@tempa\@firstoftwo}% if package not enabled
    \VERCMD@tempa%
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\VerifyCommand} \oarg{yourpackage} \oarg{theirpackage}
%                   \marg{\cs{commandname}} \marg{\MDfive\ checksum}
%
% Test for various kinds of definitions, and convert them to \MDfive\ checksums.
%    \begin{macrocode}
\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{VERCMDenable}{%
%    \end{macrocode}
%
% Default to an un-detected definition type:
%    \begin{macrocode}
    \edef\VERCMD@temp{Unknown~definition}%
%    \end{macrocode}
%
% Will become true if found \cs{NewDocumentCommand} or related.
%    \begin{macrocode}
    \boolfalse{VERCMD@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@this@ltxcmd}%
            \expandafter\VERCMD@mdfive%
                \csname environment~#3~code\endcsname%
        }%
        {%
%    \end{macrocode}
%
% For \cs{newenvironment} with an optional argument,
% the macro name is ``|\\name|'', with two backslashes.
%    \begin{macrocode}
%            % newenvironment with option:
             \ifcsdef{\VERCMD@backslash#3}%
                {%
                    \expandafter\VERCMD@mdfive%
                        \csname \VERCMD@backslash#3\endcsname%
                }%
                {%
%    \end{macrocode}
%
% For \cs{newenvironment}, the macro name is ``|\name|''.
%    \begin{macrocode}
%                    % newenvironment:
                     \ifcsdef{#3}%
                        {\expandafter\VERCMD@mdfive\csname #3\endcsname}%
                        {}%
                }%
        }%
%    \end{macrocode}
%
% Do the first or second next argument depending on a match:
% \changes{v1.10}{2024/08/28}{Added test groups.}
%    \begin{macrocode}
    \ifdefstring{\VERCMD@temp}{#4}%
        {%
            \booltrue{VERCMD@passed}%
            \let\VERCMD@tempa\@firstoftwo%
        }%
        {%
            \booltrue{VERCMD@failed}%
            \let\VERCMD@tempa\@secondoftwo%
        }%
%    \end{macrocode}
%
%    \begin{macrocode}
    }% if package enabled
    {\let\VERCMD@tempa\@firstoftwo}% if package not enabled
    \VERCMD@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@temp{Unknown~definition}%
%    \end{macrocode}
%
% Will become true if found \cs{NewDocumentCommand} or related.
%    \begin{macrocode}
    \boolfalse{VERCMD@this@ltxcmd}
%    \end{macrocode}
%
% For \cs{NewDocumentEnvironment}, the ending macro name
% is ``|\environment name end aux |'', with spaces and a trailing space.
%    \begin{macrocode}
%    % end DocumentEnvironment:
     \ifcsdef{environment~#3~end~aux~}%
        {%
            \booltrue{VERCMD@this@ltxcmd}%
            \expandafter\VERCMD@mdfive
                \csname environment~#3~end~aux~\endcsname%
        }%
        {%
%    \end{macrocode}
%
% For \cs{newenvironment}, the ending macro name is ``|\endname|''.
%    \begin{macrocode}
%            % end newenvironment:
             \ifcsdef{end#3}%
                {%
                    \expandafter\VERCMD@mdfive%
                        \csname end#3\endcsname%
                }%
                {}%
        }%
%    \end{macrocode}
%
% Do the first or second next argument depending on a match:
% \changes{v1.10}{2024/08/28}{Added test groups.}
%    \begin{macrocode}
    \ifdefstring{\VERCMD@temp}{#4}%
        {%
            \booltrue{VERCMD@passed}%
            \let\VERCMD@tempa\@firstoftwo%
        }%
        {%
            \booltrue{VERCMD@failed}%
            \let\VERCMD@tempa\@secondoftwo%
        }%
    }% if package enabled
    {\let\VERCMD@tempa\@firstoftwo}% if package not enabled
    \VERCMD@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}
%
% To compile \filenm{verifycommand.sty} and \cs{verifycommand.pdf}
% from \filenm{verifycommand.dtx} and \filenm{verifycommand.ins}:
%
% \begin{sourceverb}
% pdflatex verifycommand.ins
% pdflatex verifycommand.dtx
% pdflatex verifycommand.dtx
% makeindex -s gglo.ist -o verifycommand.gls verifycommand.glo
% splitindex verifycommand.idx -- -s gind.ist
% pdflatex verifycommand.dtx
% pdflatex verifycommand.dtx
% \end{sourceverb}
%
%
% \iffalse
%</package>
% \fi
%
%
%
%
%
% \clearpage
% \pagestyle{plain}
%
% \renewcommand{\partname}{}
% \renewcommand{\thepart}{}
% ^^A \part{Change History and Index}
%
%
% \Finale
%
\endinput
