summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/storecmd
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2011-10-28 23:43:16 +0000
committerKarl Berry <karl@freefriends.org>2011-10-28 23:43:16 +0000
commit428705d44379becd889634d0b8a21d5f6eda12b9 (patch)
tree445fb0af83f7b4ccac24ccb63a1be89ce3497543 /Master/texmf-dist/tex/latex/storecmd
parent7d9eca7c4eba55a60bd83933de4a4d5c9808e018 (diff)
storecmd 0.0.2 (27oct11)
git-svn-id: svn://tug.org/texlive/trunk@24431 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/storecmd')
-rw-r--r--Master/texmf-dist/tex/latex/storecmd/storecmd.sty65
1 files changed, 40 insertions, 25 deletions
diff --git a/Master/texmf-dist/tex/latex/storecmd/storecmd.sty b/Master/texmf-dist/tex/latex/storecmd/storecmd.sty
index 79a2d78562b..08a81919d0d 100644
--- a/Master/texmf-dist/tex/latex/storecmd/storecmd.sty
+++ b/Master/texmf-dist/tex/latex/storecmd/storecmd.sty
@@ -29,6 +29,8 @@ $Id: storecmd.sty,v 0.0.1 2011/10/15 09:00:00 Ahmed Musa Exp $
\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
@@ -42,7 +44,8 @@ $Id: storecmd.sty,v 0.0.1 2011/10/15 09:00:00 Ahmed Musa Exp $
\xdef#2{\csliststack{#1\@space}#2\expandcsonce\LTS@tempa}%
}%
}
-\newvariables{if}[stcmd@]{storefile,storecmd,cmdescap,global,protected}
+\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}%
@@ -50,21 +53,15 @@ $Id: storecmd.sty,v 0.0.1 2011/10/15 09:00:00 Ahmed Musa Exp $
\@gtempa\expandafter{\@gtempa}}%
\xifstrcmpTF\@gtempa{x}\LTS@emergencystop\relax
}
-\XDeclareSwitchOption{storerenew}[true](stcmd@){%
- \ifdefswitchTF{stcmd@storerenew}{%
- \stcmd@info{'storerenew' set true\on@line}%
- }{}%
-}
-\XDeclareSwitchOption{overwrite}[true](stcmd@){%
- \ifdefswitchTF{stcmd@overwrite}{%
- \stcmd@info{'overwrite' set true\on@line}%
- }{}%
-}
-\XDeclareSwitchOption{neversave}[true](stcmd@){%
- \ifdefswitchTF{stcmd@neversave}{%
- \stcmd@info{'neversave' set true\on@line}%
- }{}%
+
+\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}%
@@ -115,22 +112,35 @@ $Id: storecmd.sty,v 0.0.1 2011/10/15 09:00:00 Ahmed Musa Exp $
}
\XDeclareOption*{\stcmd@warn{Unknown option '\CurrentOption' ignored}}
\XExecuteOptions{%
- neversave=false,storerenew=false,overwrite=false,verbose=true
+ verbose=true,neversave=false,storerenew=false,overwrite=false,
+ showsource=false
}
\XProcessOptions*\relax
+\robust@def*\longcmd{\stcmd@longtrue}
\robust@def*\globalcmd{\stcmd@globaltrue}
\robust@def*\protectedcmd{\stcmd@protectedtrue}
-\robust@def*\stcmd@global@protected{%
+\robust@def*\stcmd@cmdprefixes@a{%
+ \ifstcmd@global\global\fi
+ \ifstcmd@long\long\fi
+ \ifstcmd@protected\protected\fi
+}
+\robust@def*\stcmd@cmdprefixes@b{%
\ifstcmd@global
\stcmd@globalfalse
- \let\stcmd@tempa\global
+ \let\stcmd@global\global
+ \else
+ \let\stcmd@global\@empty
+ \fi
+ \ifstcmd@long
+ \stcmd@longfalse
+ \let\stcmd@long\long
\else
- \let\stcmd@tempa\@empty
+ \let\stcmd@long\@empty
\fi
\ifstcmd@protected
\stcmd@protectedfalse\protected
\fi
- \stcmd@tempa
+ \stcmd@global\stcmd@long
}
\robust@def*\defsavecmd{\cpt@starorlong\stcmd@defsavecmd}
\robust@def*\newsavecmd{\cpt@starorlong\stcmd@newsavecmd}
@@ -139,7 +149,13 @@ $Id: storecmd.sty,v 0.0.1 2011/10/15 09:00:00 Ahmed Musa Exp $
\if\stcmd@neversave\else
\begingroup
\escapechar=92
- \xdef\@gtempa{\expandafter\@gobble\string#1}%
+ \xdef\@gtempa{%
+ \expandafter\@gobble\string#1%
+ \if\stcmd@showsource
+ \@space(\ifx\@currname\@empty
+ \jobname.tex\else\@currname.\@currext\fi)%
+ \fi
+ }%
\endgroup
\ifstcmd@storefile
\immediate\write\stcmd@outputcheck{\@gtempa}%
@@ -164,7 +180,7 @@ $Id: storecmd.sty,v 0.0.1 2011/10/15 09:00:00 Ahmed Musa Exp $
\fi
}%
\stcmd@savecmd{#1}%
- \stcmd@global@protected\l@ngrel@x\def#1%
+ \stcmd@cmdprefixes@b\l@ngrel@x\def#1%
}
\robust@def*\stcmd@newsavecmd#1{%
\stcmd@savecmd{#1}%
@@ -200,8 +216,7 @@ $Id: storecmd.sty,v 0.0.1 2011/10/15 09:00:00 Ahmed Musa Exp $
\robust@def\stcmd@xargdef@b#1#2#3(#4)#5{%
\def\stcmd@tempd{#4}%
\ifcsdefinable#1{%
- \ifstcmd@global\global\fi
- \ifstcmd@protected\protected\fi
+ \stcmd@cmdprefixes@a
\expandafter\def\expandafter#1\expandafter{%
\expandafter\@protected@testopt\expandafter#1%
\csname\string#1\endcsname{#3}%
@@ -220,7 +235,7 @@ $Id: storecmd.sty,v 0.0.1 2011/10/15 09:00:00 Ahmed Musa Exp $
\robust@def\stcmd@zargdef#1#2{%
\begingroup
\def\stcmd@tempa##1#1##2##{%
- \def\stcmd@tempc{\stcmd@global@protected\l@ngrel@x}%
+ \def\stcmd@tempc{\stcmd@cmdprefixes@b\l@ngrel@x}%
\cptexpandsecond{\expandafter\endgroup\stcmd@tempc
\expandafter\def\expandafter#2\stcmd@tempb##1#1}{\elt{#1}}%
}%