16
 #®    %++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++%
%                                                                          %
% This is file 'storecmd.sty', version 0.0.1, October 2011.                %
%                                                                          %
% This package and accompanying files may be distributed and/or            %
% modified under the conditions of the LaTeX Project Public License,       %
% either version 1.3 of this license or 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.                                             %
%                                                                          %
% The LPPL maintenance status of this software is 'author-maintained'.     %
%                                                                          %
% This software is provided 'as it is', without warranty of any kind,      %
% either expressed or implied, including, but not limited to, the          %
% implied warranties of merchantability and fitness for a particular       %
% purpose.                                                                 %
%                                                                          %
% Copyright (c) 2011 Ahmed Musa (amusa22@gmail.com).                       %
%                                                                          %
%++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++%

\@ifpackageloaded{catoptions}{}{\RequirePackage{catoptions}[2011/08/07]}
\UseNormalCatcodes
\StyleFilePurpose{Store command name at definition time}
\StyleFileRCSInfo
$Id: storecmd.sty,v 0.0.1 2011/10/15 09:00:00 Ahmed Musa Exp $
\ProvidesPackage{storecmd}[\StyleFileInfo]
\NeedsTeXFormat{LaTeX2e}[2005/12/01]
\SetStyleFileMessages[stcmd@]{info}{warn}{err}
\RequirePackage{ltxtools}[2011/09/10]
\robust@def*\stcmd@verbosewarn#1{\ifstcmd@verbose\stcmd@warn{#1}\fi}
\robust@def*\stcmd@verboseinfo#1{\ifstcmd@verbose\stcmd@info{#1}\fi}
\providecommand*\ifsentinelTF[1]{%
  \edef\reserved@a{\unexpanded{#1}}%
  \ifx\reserved@a\currsentinel\expandafter\@firstoftwo
    \else\expandafter\@secondoftwo\fi
}
\robust@def*\stcmd@merge{\LTS@testopt\stcmd@m@rge,}
\robust@def*\stcmd@m@rge[#1]#2#3{%
  \trim@@spaces{#3}\LTS@tempa
  \ifdefTF#2{}{\def#2{}}%
  \xifinsetTF{#1\@space\LTS@tempa#1}{#1\@space#2#1}{}{%
    \xdef#2{\csliststack{#1\@space}#2\expandcsonce\LTS@tempa}%
  }%
}
\newvariables{if}[stcmd@]{storefile,storecmd,cmdescap,global,long,
  protected,verbose}
\robust@def*\stcmd@typeintocontinue{%
  \message{^^JType x or X to quit, or <RETURN> to proceed^^J}%
  {\endlinechar-1\global\read-1 to\@gtempa}%
  \lowercase\expandafter{\expandafter\def\expandafter
    \@gtempa\expandafter{\@gtempa}}%
  \xifstrcmpTF\@gtempa{x}\LTS@emergencystop\relax
}

\docommalist{storerenew,overwrite,neversave,showsource}{%
  \XDeclareSwitchOption{#1}[true](stcmd@){%
    \ifdefswitchTF{stcmd@#1}{%
      \stcmd@verboseinfo{'#1' set true\on@line}%
    }{}%
  }%
}

\XDeclareSwitchOption{verbose}[true](stcmd@){%
  \ifdefswitchTF{stcmd@verbose}{%
    \stcmd@info{'verbose' set true\on@line}%
  }{}%
}
\XDeclareCommandOption{storefile}[cmdnamesfile](stcmd@){%
  \ifblankTF{#1}{%
    \stcmd@err{No storage file name}\@ehc
    \stcmd@storefilefalse
  }{%
    \if\stcmd@overwrite\else
      \IfFileExists\stcmd@storefile{%
        \message{^^J! File '\stcmd@storefile' already exists:}%
        \stcmd@typeintocontinue
      }{}%
    \fi
    \stcmd@storefiletrue
    \NewWrites[stcmd@]{outputcheck}%
    \immediate\openout\stcmd@outputcheck=\stcmd@storefile\@space
    \immediate\write\stcmd@outputcheck{\relax}%
    \LTS@AfterEndDocument{\immediate\closeout\stcmd@outputcheck}%
  }%
}
\XDeclareCommandOption{storecmd}[cmdnamesmacro](stcmd@){%
  \def\stcmd@tempa##1{%
    \message{^^J! Command '##1\stcmd@storecmd' already exists:}%
    \stcmd@typeintocontinue
  }%
  \ifblankTF{#1}{%
    \