summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/stex/modules/modules.sty
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/latex/stex/modules/modules.sty')
-rw-r--r--Master/texmf-dist/tex/latex/stex/modules/modules.sty224
1 files changed, 224 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/stex/modules/modules.sty b/Master/texmf-dist/tex/latex/stex/modules/modules.sty
new file mode 100644
index 00000000000..2e11bb955ad
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/stex/modules/modules.sty
@@ -0,0 +1,224 @@
+%%
+%% This is file `modules.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% modules.dtx (with options: `package')
+%%
+\NeedsTeXFormat{LaTeX2e}[1999/12/01]
+\ProvidesPackage{modules}[2010/06/25 v1.0 Semantic Markup]
+\newif\ifmod@show\mod@showfalse
+\DeclareOption{show}{\mod@showtrue}
+\newif\ifmod@qualified\mod@qualifiedfalse
+\DeclareOption{qualifiedimports}{\mod@qualifiedtrue}
+\ProcessOptions
+\RequirePackage{sref}
+\RequirePackage{xspace}
+\RequirePackage{xcomment}
+\define@key{module}{cd}{}
+\define@key{module}{id}{%
+\edef\this@module{\expandafter\noexpand\csname module@defs@#1\endcsname}%
+\global\@namedef{module@defs@#1}{}%
+\ifmod@qualified
+\edef\this@qualified@module{\expandafter\noexpand\csname module@defs@qualified@#1\endcsname}%
+\global\@namedef{module@defs@qualified@#1}{}%
+\fi
+\def\mod@id{#1}%
+\expandafter\edef\csname #1@cd@file@base\endcsname{\mod@path}%
+\expandafter\g@addto@macro\csname module@defs@#1\expandafter\endcsname\expandafter%
+{\expandafter\def\csname #1@cd@file@base\expandafter\endcsname\expandafter{\mod@path}}}
+\newenvironment{module}[1][]{\setkeys{module}{#1}}{}
+\def\activate@defs#1{\csname module@defs@#1\endcsname}
+\def\export@defs#1{\@ifundefined{mod@id}{}%
+{\expandafter\expandafter\expandafter\g@addto@macro\expandafter%
+\this@module\expandafter{\csname module@defs@#1\endcsname}}}
+\def\coolurion{}
+\def\coolurioff{}
+\newcommand{\importmodule}[2][]{{\def\mod@path{#1}%
+\ifx\mod@path\@empty\else\requiremodules{#1}\fi}%
+\activate@defs{#2}\export@defs{#2}}
+\newcommand{\importOMDocmodule}[3][]{\importmodule[#1]{#3}}
+\let\metalanguage=\importmodule
+\def\mod@newcommand{\@star@or@long\mod@new@command}
+\def\mod@new@command#1{\@testopt{\@mod@newcommand#1}0}
+\def\@mod@newcommand#1[#2]{\kernel@ifnextchar [{\mod@xargdef#1[#2]}{\mod@argdef#1[#2]}}
+\long\def\mod@argdef#1[#2]#3{\@yargdef#1\@ne{#2}{#3}}
+\long\def\mod@xargdef#1[#2][#3]#4{\expandafter\def\expandafter#1\expandafter{%
+\expandafter\@protected@testopt\expandafter #1\csname\string#1\endcsname{#3}}%
+\expandafter\@yargdef\csname\string#1\endcsname\tw@{#2}{#4}}
+\define@key{symdef}{local}[true]{\@symdeflocaltrue}
+\define@key{symdef}{name}{}
+\define@key{symdef}{assocarg}{}
+\define@key{symdef}{bvars}{}
+\define@key{symdef}{bvar}{}
+\newif\if@symdeflocal
+\def\symdef{\@ifnextchar[{\@symdef}{\@symdef[]}}
+\def\@symdef[#1]#2{\@ifnextchar[{\@@symdef[#1]{#2}}{\@@symdef[#1]{#2}[0]}}
+\def\@mod@nc#1{\mod@newcommand{#1}[1]}
+\def\@@symdef[#1]#2[#3]#4{%
+\@symdeflocalfalse\setkeys{symdef}{#1}%
+\expandafter\mod@newcommand\csname modules@#2@pres\endcsname[#3]{#4}%
+\expandafter\def\csname#2\endcsname{\csname modules@#2@pres\endcsname}%
+\expandafter\@mod@nc\csname mod@symref@#2\expandafter\endcsname\expandafter%
+{\expandafter\mod@termref\expandafter{\mod@id}{#2}{##1}}%
+\if@symdeflocal\else%
+\@ifundefined{mod@id}{}{%
+\expandafter\g@addto@macro\this@module%
+{\expandafter\mod@newcommand\csname modules@#2@pres\endcsname[#3]{#4}}%
+\expandafter\g@addto@macro\this@module%
+{\expandafter\def\csname#2\endcsname{\csname modules@#2@pres\endcsname}}%
+\expandafter\g@addto@macro\csname module@defs@\mod@id\expandafter\endcsname\expandafter%
+{\expandafter\@mod@nc\csname mod@symref@#2\expandafter\endcsname\expandafter%
+{\expandafter\mod@termref\expandafter{\mod@id}{#2}{##1}}}%
+\ifmod@qualified%
+\expandafter\g@addto@macro\this@qualified@module%
+{\expandafter\mod@newcommand\csname modules@#2@pres@qualified\endcsname[#3]{#4}}%
+\expandafter\g@addto@macro\this@qualified@module%
+{\expandafter\def\csname#2atqualified\endcsname{\csname modules@#2@pres@qualified\endcsname}}%
+\fi%
+}\fi}
+\def\resymdef{\@ifnextchar[{\@resymdef}{\@resymdef[]}}
+\def\@resymdef[#1]#2{\@ifnextchar[{\@@resymdef[#1]{#2}}{\@@resymdef[#1]{#2}[0]}}
+\def\@@resymdef[#1]#2[#3]#4{\expandafter\renewcommand\csname modules@#2@pres\endcsname[#3]{#4}}
+\let\abbrdef\symdef
+\def\mod@path{}
+\def\mod@true{true}
+\omdaddkey[false]{termdef}{local}
+\omdaddkey{termdef}{name}
+\newcommand{\termdef}[3][]{\omdsetkeys{termdef}{#1}%
+\expandafter\mod@newcommand\csname#2\endcsname[0]{#3\xspace}
+\ifx\termdef@local\mod@true\else%
+\@ifundefined{mod@id}{}{\expandafter\g@addto@macro\this@module%
+{\expandafter\mod@newcommand\csname#2\endcsname[0]{#3\xspace}}}
+\fi}
+\def\@captitalize#1{\uppercase{#1}}
+\newcommand\capitalize[1]{\expandafter\@captitalize #1}
+\def\mod@termref#1#2#3{\def\@test{#3}
+\@ifundefined{#1@cd@file@base}
+ {\protect\G@refundefinedtrue
+ \@latex@warning{\protect\termref with unidentified cd "#1": the cd key must
+ reference an active module}
+ \def\@label{sref@#2 @target}}
+ {\def\@label{sref@#2@#1@target}}%
+\expandafter\ifx\csname #1@cd@file@base\endcsname\@empty% local reference
+\sref@hlink@ifh{\@label}{\ifx\@test\@empty #2\else #3\fi}\else%
+\def\@uri{\csname #1@cd@file@base\endcsname.pdf\#\@label}%
+\sref@href@ifh{\@uri}{\ifx\@test\@empty #2\else #3\fi}\fi}
+\def\mod@simplify#1{\expandafter\mod@simpl#1/\relax}
+\def\mod@simpl#1/#2\relax{\def\@second{#2}%
+\ifx\mod@blaaaa\@empty\edef\mod@savedprefix{}\def\mod@blaaaa{aaa}\else\fi%
+\ifx\@second\@empty\edef\mod@savedprefix{\mod@savedprefix#1}%
+\else\mod@simplhelp#1/#2\relax\fi}
+\def\mod@updir{..}
+\def\mod@simplhelp#1/#2/#3\relax{\def\@first{#1}\def\@second{#2}\def\@third{#3}%
+\ifx\@third\@empty% base case
+\ifx\@second\mod@updir\else%
+\ifx\mod@second\@empty\edef\mod@savedprefix{\mod@savedprefix#1}%
+\else\edef\mod@savedprefix{\mod@savedprefix#1/#2}%
+\fi%
+\fi%
+\else%
+\ifx\@first\mod@updir%
+\edef\mod@savedprefix{\mod@savedprefix#1/}\mod@simplhelp#2/#3\relax%
+\else%
+\ifx\@second\mod@updir\mod@simpl#3\relax%
+\else\edef\mod@savedprefix{\mod@savedprefix#1/}\mod@simplhelp#2/#3\relax%
+\fi%
+\fi%
+\fi}%
+\newcommand{\defpath}[2]{\expandafter\newcommand\csname #1\endcsname[1]{#2/##1}}
+\newif\ifmodules
+\gdef\mod@reg{}
+\def\mod@update#1{\ifx\mod@reg\@empty\xdef\mod@reg{#1}\else\xdef\mod@reg{#1@\mod@reg}\fi}
+\def\mod@check#1@#2///#3\relax{%
+\def\mod@one{#1}\def\mod@two{#2}\def\mod@three{#3}%
+\expandafter%
+\ifx\mod@three\mod@one\modulestrue%
+\else%
+\ifx\mod@two\@empty\modulesfalse\else\mod@check#2///#3\relax\fi%
+\fi}
+\def\mod@search#1{%
+\modulesfalse\expandafter\mod@check\mod@reg @///#1\relax%
+\ifmodules\else\mod@update{#1}\fi}
+\def\mod@reguse#1{\modulesfalse\expandafter\mod@check\mod@reg @///#1\relax}
+\def\mod@prefix{}
+\def\mod@updatedpre#1{%
+\edef\mod@prefix{\mod@prefix\mod@pathprefix@check#1/\relax}}
+\def\mod@pathprefix@check#1/#2\relax{%
+\ifx\\#2\\% no slash in string
+\else\mod@ReturnAfterFi{#1/\mod@pathprefix@help#2\relax}%
+\fi}
+\def\mod@pathprefix@help#1/#2\relax{%
+\ifx\\#2\\% end of recursion
+\else\mod@ReturnAfterFi{#1/\mod@pathprefix@help#2\relax}%
+\fi}
+\long\def\mod@ReturnAfterFi#1\fi{\fi#1}
+\def\mod@pathpostfix@check#1/#2\relax{% slash
+\ifx\\#2\\%no slash in string
+#1\else\mod@ReturnAfterFi{\mod@pathpostfix@help#2\relax}%
+\fi}
+\def\mod@pathpostfix@help#1/#2\relax{%
+\ifx\\#2\\%
+#1\else\mod@ReturnAfterFi{\mod@pathpostfix@help#2\relax}%
+\fi}
+\def\mod@updatedpost#1{%
+\edef\mod@savedprefix{\mod@savedprefix\mod@pathpostfix@check#1/\relax}}
+\def\mod@updatesms{\edef\mod@savedprefix{\mod@savedprefix.sms}}
+\newcommand{\requiremodules}[1]{%
+{\mod@updatedpre{#1}% add the new file to the already existing path
+\let\mod@savedprefix\mod@prefix% add the path to the new file to the prefix
+\mod@updatedpost{#1}%
+\def\mod@blaaaa{}% macro used in the simplify function (remove .. from the prefix)
+\mod@simplify{\mod@savedprefix}% remove |xxx/..| from the path (in case it exists)
+\mod@reguse{\mod@savedprefix}%
+\ifmodules\else%
+\mod@updatesms% update the file to contain the .sms extension
+\let\newreg\mod@reg% use to compare, in case the .sms file was loaded before
+\mod@search{\mod@savedprefix}% update registry
+\ifx\newreg\mod@reg\else\input{\mod@savedprefix}\fi% check if the registry was updated and load if necessary
+\fi}}
+\def\sinput#1{
+{\mod@updatedpre{#1}% add the new file to the already existing path
+\let\mod@savedprefix\mod@prefix% add the path to the new file to the prefix
+\mod@updatedpost{#1}%
+\def\mod@blaaaa{}% macro used in the simplify function (remove .. from the prefix)
+\mod@simplify{\mod@savedprefix}% remove |xxx/..| from the path (in case it exists)
+\mod@reguse{\mod@savedprefix}%
+\let\newreg\mod@reg% use to compare, in case the .sms file was loaded before
+\mod@search{\mod@savedprefix}% update registry
+\ifx\newreg\mod@reg%\message{This file has been previously introduced}
+\else\input{\mod@savedprefix}%
+\fi}}
+\let\sinputref=\sinput
+\def\requirepackage#1#2{\makeatletter\input{#1.sty}\makeatother}
+\srefaddidkey{view}
+\omdaddkey{view}{from}
+\omdaddkey{view}{to}
+\omdaddkey{view}{title}
+\ifmod@show
+\newsavebox{\viewbox}
+\newcounter{view}[section]
+\def\view@heading{{\textbf{View} \thesection.\theview}
+ \sref@label@id{View \thesection.\theproblem}
+ \@ifundefined{view@title}{:\quad}{\quad(\view@title)\hfill\\}}
+\newenvironment{view}[1][]{\omdsetkeys{view}{#1}\sref@target\stepcounter{view}
+\begin{lrbox}{\viewbox}\begin{minipage}{.9\textwidth}\importmodule{\view@to}}
+{\end{minipage}\end{lrbox}
+\setbox0=\hbox{\begin{minipage}{.9\textwidth}%
+\noindent\view@heading\rm%
+\end{minipage}}
+\smallskip\noindent\fbox{\vbox{\box0\vspace*{.2em}\usebox\viewbox}}\smallskip}
+\else\newxcomment[]{view}\fi
+\def\vassign#1#2{#1\ensuremath{\mapsto #2}}
+\define@key{module}{uses}{%
+\@for\module@tmp:=#1\do{\activate@defs\module@tmp\export@defs\module@tmp}}
+\define@key{module}{usesqualified}{%
+\@for\module@tmp:=#1\do{\activate@defs{qualified@\module@tmp}\export@defs\module@tmp}}
+\def\csymdef{\@ifnextchar[{\@csymdef}{\@csymdef[]}}
+\def\@csymdef[#1]#2{\@ifnextchar[{\@@csymdef[#1]{#2}}{\@@csymdef[#1]{#2}[0]}}
+\def\@@csymdef[#1]#2[#3]#4#5{\@@symdef[#1]{#2}[#3]{#4}}
+\def\notationdef[#1]#2#3{}
+\endinput
+%%
+%% End of file `modules.sty'.