diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/stex/modules/modules.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/stex/modules/modules.sty | 613 |
1 files changed, 377 insertions, 236 deletions
diff --git a/Master/texmf-dist/tex/latex/stex/modules/modules.sty b/Master/texmf-dist/tex/latex/stex/modules/modules.sty index 8ee9fda5172..25310cc8cfe 100644 --- a/Master/texmf-dist/tex/latex/stex/modules/modules.sty +++ b/Master/texmf-dist/tex/latex/stex/modules/modules.sty @@ -7,256 +7,397 @@ %% modules.dtx (with options: `package') %% \NeedsTeXFormat{LaTeX2e}[1999/12/01] -\ProvidesPackage{modules}[2012/01/28 v1.1 Semantic Markup] -\DeclareOption{showmeta}{\PassOptionsToPackage{\CurrentOption}{metakeys}} +\ProvidesPackage{modules}[2016/04/06 v1.4 Semantic Markup] +\newif\if@modules@mh@\@modules@mh@false +\DeclareOption{mh}{\@modules@mh@true} \newif\ifmod@show\mod@showfalse \DeclareOption{showmods}{\mod@showtrue} +\newif\ifaux@req\aux@reqtrue +\DeclareOption{noauxreq}{\aux@reqfalse} \newif\ifmod@qualified\mod@qualifiedfalse \DeclareOption{qualifiedimports}{\mod@qualifiedtrue} +\newif\if@mmt\@mmtfalse +\DeclareOption{mmt}{\@mmttrue} +\DeclareOption*{\PassOptionsToPackage{\CurrentOption}{sref}} \ProcessOptions \RequirePackage{sref} +\if@modules@mh@\RequirePackage{modules-mh}\fi +\if@mmt\RequirePackage{mmt}\fi \RequirePackage{xspace} -\RequirePackage{xcomment} -\addmetakey{module}{cd} -\addmetakey{module}{title} +\RequirePackage{mdframed} +\RequirePackage{pathsuris} +\addmetakey{module}{cd}% no longer used +\addmetakey{module}{load}% ignored +\addmetakey*{module}{title} +\addmetakey*{module}{creators} +\addmetakey*{module}{contributors} +\addmetakey*{module}{srccite} \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}}} -\newcounter{module}[section] -\newcommand\module@heading{\stepcounter{module}% -\noindent{\textbf{Module} \thesection.\themodule [\mod@id]}% -\sref@label@id{Module \thesection.\themodule [\mod@id]}% -\ifx\module@title\@empty :\quad\else\quad(\module@title)\hfill\\\fi} -\newcommand\module@footer{\noindent{\textbf{EndModule} \thesection.\themodule}} -\newenvironment{module}[1][]% -{\metasetkeys{module}{#1}\ifmod@show\module@heading\fi} -{\ifmod@show\module@footer\fi} -\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}} -\newenvironment{importmodulevia}[2][]{\gdef\@@doit{\importmodule[#1]{#2}}% -\ifmod@show\par\noindent importing module #2 via \@@doit\fi} -{\aftergroup\@@doit\ifmod@show end import\fi} -\newcommand\vassign[2]{\ifmod@show\ensuremath{#1\mapsto #2}, \fi} -\newcommand\tassign[3][]{\ifmod@show #2\ensuremath{\mapsto} #3, \fi} -\newcommand\ttassign[3][]{\ifmod@show #1\ensuremath{\mapsto} ``#2'', \fi} -\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}} -\newif\if@symdeflocal -\define@key{symdef}{local}[true]{\@symdeflocaltrue} -\define@key{symdef}{name}{} -\define@key{symdef}{assocarg}{} -\define@key{symdef}{bvars}{} -\define@key{symdef}{bvar}{} -\define@key{symdef}{bindargs}{} -\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% -{\@ifnextchar[{\csname modules@#2\endcsname}{\csname modules@#2\endcsname[]}}% -\expandafter\def\csname modules@#2\endcsname[##1]% -{\csname modules@#2@pres@##1\endcsname}% -\expandafter\@mod@nc\csname mod@symref@#2\expandafter\endcsname\expandafter% -{\expandafter\mod@termref\expandafter{\mod@id}{#2}{##1}}% -\if@symdeflocal\else% + \edef\this@module{% + \expandafter\noexpand\csname module@defs@#1\endcsname% + }% + \csgdef{module@defs@#1}{}% + \ifmod@qualified% + \edef\this@qualified@module{% + \expandafter\noexpand\csname module@defs@#1\endcsname% + }% + \csgdef{module@defs@qualified@#1}{}% + \fi% + \def\mod@id{#1}% +}% +\newcounter{module}[section]% +\newrobustcmd\module@heading{% + \stepcounter{module}% + \ifmod@show% + \noindent{\textbf{Module} \thesection.\themodule [\mod@id]}% + \sref@label@id{Module \thesection.\themodule [\mod@id]}% + \ifx\module@title\@empty :\quad\else\quad(\module@title)\hfill\\\fi% + \fi% +}% mod@show +\newenvironment{module}[1][]{% + \begin{@module}[#1]% + \ifcsundef{mod@id}{}{% only define if components are! + \ifcsundef{mod@path}{}{\csxdef{module@\mod@id @path}{\mod@path}}% + \ifcsundef{mod@ext}{}{\csxdef{module@\mod@id @ext}{\mod@ext}}% + }% + \if@mmt\if@importing\else\mmtheory{\mod@id}{????}\fi\fi% + \module@heading% make the headings + \ignorespaces}{% + \if@mmt\if@importing\else\mmtheoryend\fi\fi% + \end{@module}% + \ignorespacesafterend% +}% +\ifmod@show\surroundwithmdframed{module}\fi% +\newenvironment{@module}[1][]{\metasetkeys{module}{#1}}{}% +\def\activate@defs#1{% + \ifcsundef{module@#1@activated}{\csname module@defs@#1\endcsname}{}% + \@namedef{module@#1@activated}{true}% +}% +\def\export@defs#1{% \@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% -{\@ifnextchar[{\csname modules@#2\endcsname}{\csname modules@#2\endcsname[]}}}% -\expandafter\g@addto@macro\this@module% -{\expandafter\def\csname modules@#2\endcsname[##1]% -{\csname modules@#2@pres@##1\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} -\define@key{DefMathOp}{name}{\def\defmathop@name{#1}} -\newcommand\DefMathOp[2][]{% -\setkeys{DefMathOp}{#1}% -\symdef[#1]{\defmathop@name}{#2}} -\def\symvariant#1{\@ifnextchar[{\@symvariant{#1}}{\@symvariant{#1}[0]}} +\expandafter\expandafter\expandafter\g@addto@macro% + \expandafter\this@module\expandafter{\activate@defs{#1}}% +}% +}% +\newif\if@importing\@importingfalse +\newcommand\update@used@modules[1]{% + \ifx\used@modules\@empty% + \edef\used@modules{#1}% + \else% + \edef\used@modules{\used@modules,#1}% + \fi} +\gdef\used@modules{} +\srefaddidkey{importmodule} +\addmetakey{importmodule}{load} +\addmetakey[sms]{importmodule}{ext} +\addmetakey[false]{importmodule}{conservative}[true] +\newcommand\importmodule[2][]{% + \metasetkeys{importmodule}{#1}% + \update@used@modules{#2}% + \@importmodule[\importmodule@load]{#2}{\importmodule@ext}{export}% + \ignorespacesandpars% +}% +\newcommand\@importmodule[4][]{% + {\@importingtrue% to shut up macros while in the group opened here + \edef\@load{#1}% + \ifx\@load\@empty% + \relax% + \else% + \ifcsundef{module@#2@path}{% + \requiremodules{#1}{#3}% + }{% + \edef\@path{\csname module@#2@path\endcsname}% + \IfStrEq\@load\@path{% if the known path is the same as the requested one + \relax% do nothing, it has already been loaded, else signal an error + }{% + \PackageError{modules} + {{Module Name Clash\MessageBreak + A module with name #2 was already loaded under the path "\@path"\MessageBreak + The imported path "\@load" is probably a different module with the\MessageBreak + same name; this is dangerous -- not importing}% + {Check whether the Module name is correct}}% + }% + }% + \fi}% + \activate@defs{#2}% activate the module + \edef\@export{#4}\def\@@export{export}%prepare comparison + \ifx\@export\@@export\export@defs{#2}\fi% export the module + \if@importing\else\if@mmt\mmtinclude{#1?#2}\fi\fi% +}% +\newcommand\usemodule[2][]{% + \metasetkeys{importmodule}{#1}% + \update@used@modules{#2}% + \@importmodule[\importmodule@load]{#2}{\importmodule@ext}{noexport}% + \ignorespacesandpars% +}% +\newcommand\withusedmodules[2]{{\@for\@I:=#1\do{\activate@defs\@I}{#2}}}% +\newrobustcmd\importOMDocmodule[3][]{\importmodule[#1]{#3}}% +\let\metalanguage=\importmodule% +\let\mod@newcommand=\providerobustcmd% +\srefaddidkey{conceptdef}% +\addmetakey*{conceptdef}{title}% +\addmetakey{conceptdef}{subject}% +\addmetakey*{conceptdef}{display}% +\def\conceptdef@type{Symbol}% +\newrobustcmd\conceptdef[2][]{% + \metasetkeys{conceptdef}{#1}% + \ifx\conceptdef@display\st@flow\else{\stDMemph{\conceptdef@type} #2:}\fi% + \ifx\conceptdef@title\@empty~\else~(\stDMemph{\conceptdef@title})\par\fi% +}% +\newif\if@symdeflocal% +\srefaddidkey{symdef}% +\define@key{symdef}{local}[true]{\@symdeflocaltrue}% +\define@key{symdef}{primary}[true]{}% +\define@key{symdef}{assocarg}{}% +\define@key{symdef}{bvars}{}% +\define@key{symdef}{bargs}{}% +\addmetakey{symdef}{name}% +\addmetakey*{symdef}{title}% +\addmetakey*{symdef}{description}% +\addmetakey{symdef}{subject}% +\addmetakey*{symdef}{display}% +\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\ignorespacesandpars{% + \begingroup + \catcode13=10 + \@ifnextchar\relax + {\endgroup}% + {\endgroup}% +} +\def\ignorespacesandparsafterend#1\ignorespaces\fi{#1\fi\ignorespacesandpars} +\def\ignorespacesandpars{ + \ifhmode\unskip\fi% + \@ifnextchar\par% + {\expandafter\ignorespacesandpars\@gobble}% + {}% +} +\def\@@symdef[#1]#2[#3]#4{% + \@symdeflocalfalse% + \metasetkeys{symdef}{#1}% + \if@mmt\if@importing\else% +\ifx\symdef@name\@empty\mmtconstdec{#2}\else\mmtconstdec{\symdef@name}\fi% +\fi\fi% + \expandafter\mod@newcommand\csname modules@#2@pres@\endcsname[#3]{#4}% + \expandafter\mod@newcommand\csname #2\endcsname[1][]% + {\csname modules@#2@pres@##1\endcsname}% + \expandafter\@mod@nc\csname mod@symref@#2\expandafter\endcsname\expandafter% + {\expandafter\mod@termref\expandafter{\mod@id}{#2}{##1}}% + \if@symdeflocal% + \else% + \ifcsundef{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\mod@newcommand\csname #2\endcsname[1][]% + {\csname modules@#2@pres@##1\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#2@qualified\endcsname{\csname modules@#2@pres@qualified\endcsname}}% + \fi% + }% mod@qualified + \fi% symdeflocal + \ifmod@show% + \ifx\symdef@display\st@flow\else{\noindent\stDMemph{\symdef@type} #2:}\fi% + \ifx\symdef@title\@empty~\else~(\stDMemph{\symdef@title})\par\fi% + \fi% + \ignorespacesandpars% +}% mod@show +\def\symdef@type{Symbol}% +\def\symvariant#1{% + \@ifnextchar[{\@symvariant{#1}}{\@symvariant{#1}[0]}% + }% \def\@symvariant#1[#2]#3#4{% -\expandafter\mod@newcommand\csname modules@#1@pres@#3\endcsname[#2]{#4}% -\@ifundefined{mod@id}{}{% -\expandafter\g@addto@macro\this@module% -{\expandafter\mod@newcommand\csname modules@#1@pres@#3\endcsname[#2]{#4}}}}% -\def\resymdef{\@ifnextchar[{\@resymdef}{\@resymdef[]}} -\def\@resymdef[#1]#2{\@ifnextchar[{\@@resymdef[#1]{#2}}{\@@resymdef[#1]{#2}[0]}} -\def\@@resymdef[#1]#2[#3]#4{\PackageError{modules} - {The \protect\resymdef macro is deprecated,\MessageBreak - use the \protect\symvariant instead!}} -\let\abbrdef\symdef -\def\mod@path{} -\def\mod@true{true} -\addmetakey[false]{termdef}{local} -\addmetakey{termdef}{name} -\newcommand{\termdef}[3][]{\metasetkeys{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}} + \expandafter\mod@newcommand\csname modules@#1@pres@#3\endcsname[#2]{#4}% + \ifcsundef{mod@id}{}{% + \expandafter\g@addto@macro\this@module% + {\expandafter\mod@newcommand\csname modules@#1@pres@#3\endcsname[#2]{#4}}% + }% +\ignorespacesandpars}% +\def\resymdef{% + \@ifnextchar[{\@resymdef}{\@resymdef[]}% +}% +\def\@resymdef[#1]#2{% + \@ifnextchar[{\@@resymdef[#1]{#2}}{\@@resymdef[#1]{#2}[0]}% +}% +\def\@@resymdef[#1]#2[#3]#4{% + \PackageError{modules}% + {The \protect\resymdef macro is deprecated}{use the \protect\symvariant instead!}% +}% +\let\abbrdef\symdef% +\define@key{DefMathOp}{name}{% + \def\defmathop@name{#1}% +}% +\newrobustcmd\DefMathOp[2][]{% + \setkeys{DefMathOp}{#1}% + \symdef[#1]{\defmathop@name}{#2}% +}% +\newcommand\assdef[2][]{#2} +\def\vardef{\@ifnextchar[{\@vardef}{\@vardef[]}}% +\def\@vardef[#1]#2{% + \@ifnextchar[{\@@vardef[#1]{#2}}{\@@vardef[#1]{#2}[0]}} +\def\@@vardef[#1]#2[#3]#4{% + \def\@test{#1}% + \ifx\@test\@empty% + \@@symdef[local]{#2}[#3]{#4}% + \else% + \symdef[local,#1]{#2}[#3]{#4}% + \fi% + \ignorespacesandpars}% +\addmetakey{symtest}{name}% +\addmetakey{symtest}{variant}% +\newrobustcmd\symtest[3][]{% + \if@importing% + \else% + \metasetkeys{symtest}{#1}% + \par\noindent \textbf{Symbol}~% + \ifx\symtest@name\@empty\texttt{#2}\else\texttt{\symtest@name}\fi% + \ifx\symtest@variant\@empty\else\ (variant \texttt{\symtest@variant})\fi% + \ with semantic macro % + \texttt{\textbackslash #2\ifx\symtest@variant\@empty\else[\symtest@variant]\fi}% + : used e.g. in \ensuremath{#3}% + \fi% + \ignorespacesandpars% +}% +\addmetakey{abbrtest}{name}% +\newrobustcmd\abbrtest[3][]{% + \if@importing% + \else% + \metasetkeys{abbrtest}{#1}% + \par\noindent \textbf{Abbreviation}~% + \ifx\abbrtest@name\@empty\texttt{#2}\else\texttt{\abbrtest@name}\fi% + : used e.g. in \ensuremath{#3}% + \fi% + \ignorespacesandpars}% +\def\mod@true{true}% +\addmetakey[false]{termdef}{local}% +\addmetakey{termdef}{name}% +\newrobustcmd\termdef[3][]{% + \metasetkeys{termdef}{#1}% + \expandafter\mod@newcommand\csname#2\endcsname[0]{#3\xspace}% + \ifx\termdef@local\mod@true% + \else% + \ifcsundef{mod@id}{}{% + \expandafter\g@addto@macro\this@module% + {\expandafter\mod@newcommand\csname#2\endcsname[0]{#3\xspace}}% + }% + \fi% +}% +\def\@capitalize#1{\uppercase{#1}}% +\newrobustcmd\capitalize[1]{\expandafter\@capitalize #1}% +\def\mod@termref#1#2#3{% + \def\@test{#3}% + \@ifundefined{module@defs@#1}{% + \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@showfalse% save state and ensure silence while reading sms -\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 -\let\inputref=\input -\def\requirepackage#1#2{\makeatletter\input{#1.sty}\makeatother} -\srefaddidkey{view} -\addmetakey*{view}{title} -\define@key{view}{load}{\requiremodules{#1}} -\newcounter{view}[section] -\newcommand\view@heading[2]{\stepcounter{view}% -{\textbf{View} \thesection.\theview: from #1 to #2}% -\sref@label@id{View \thesection.\theview}% -\ifx\view@title\@empty :\quad\else\quad(\view@title)\hfill\\\fi} -\ifmod@show\newsavebox{\viewbox} -\newenvironment{view}[3][]{\metasetkeys{view}{#1}\sref@target\stepcounter{view} -\begin{lrbox}{\viewbox}\begin{minipage}{.9\textwidth} -\importmodule{#1}\importmodule{#2}\gdef\view@@heading{\view@heading{#2}{#3}}} -{\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%ifmod@show + \@ifundefined{module@#1@path}% local reference + {\sref@hlink@ifh{\@label}{\ifx\@test\@empty #2\else #3\fi}}% + {\def\@uri{\csname module@#1@path\endcsname.pdf\#\@label}% + \sref@href@ifh{\@uri}{\ifx\@test\@empty #2\else #3\fi}}% +}% +\def\CurrentDir{}% +\newrobustcmd{\@rinput}[2]{% + \@cpath{\CurrentDir#1}% + \StrCut[\value{RealAddrNum}]{/\@CanPath}{/}\@TempPath\@Rubbish% + \StrCut[1]{\@TempPath/}{/}\@Rubbish\@DirPath% + \edef\CurrentDir{\@DirPath}% + \input{\@CanPath.#2}% + \def\CurrentDir{}% +}% +\newrobustcmd\requiremodules[2]{% + \mod@showfalse% + \@importingtrue% save state and ensure silence while reading sms + \edef\mod@path{#1}% + \edef\mod@ext{#2}% set up path/ext + \input{#1.#2}% +}% +\newrobustcmd\@requiremodules[2]{% + \if@tempswa\requiremodules{#1}{#2}\fi% +}% +\newrobustcmd\inputref[2][]{% + \def\@Slash{/} + \edef\@load{#2}% + \StrChar{\@load}{1}[\@testchar] + \ifx\@testchar\@Slash% + \edef\mod@path{#2}% + \edef\mod@ext{tex}% + \input{#2}% + \else% + \@rinput{#2}{tex}% + \fi% +}% +\def\requirepackage#1#2{\makeatletter\input{#1.sty}\makeatother}% +\newrobustcmd\sinput[1]{% + \PackageError{modules}% + {The \protect\sinput macro is deprecated}{use the \protect\input instead!}% +}% +\newrobustcmd\sinputref[1]{% + \PackageError{modules}% + {The \protect\sinputref macro is deprecated}{use the \protect\inputref instead!}% +}% \define@key{module}{uses}{% -\@for\module@tmp:=#1\do{\activate@defs\module@tmp\export@defs\module@tmp}} + \@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}} + \@for\module@tmp:=#1\do{\activate@defs{qualified@\module@tmp}\export@defs\module@tmp}% +}% +\def\coolurion{\PackageWarning{modules}{coolurion is obsolete, please remove}}% +\def\coolurioff{\PackageWarning{modules}{coolurioff is obsolete, please remove}}% +\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{} +\newrobustcmd\reqmodules[2]{% + \ifinlist{#1}{\@register}{}{\listadd\@register{#1}\input{#1.#2}}% +}% +\newcounter{@pl} +\DeclareListParser*{\forpathlist}{/} +\def\file@name#1{% + \setcounter{@pl}{0}% + \forpathlist{\stepcounter{@pl}\listadd\@pathlist}{#1} + \def\do##1{% + \ifnumequal{\value{@pl}}{1}{##1}{\addtocounter{@pl}{-1}} + }% + \dolistloop{\@pathlist}% +}% +\def\file@path#1{% + \setcounter{@pl}{0}% + \forpathlist{\stepcounter{@pl}\listadd\@pathlist}{#1}% + \def\do##1{% + \ifnumequal{\value{@pl}}{1}{}{% + \addtocounter{@pl}{-1}% + \ifnumequal{\value{@pl}}{1}{##1}{##1/}% + }% + }% + \dolistloop{\@pathlist}% +}% +\def\@NEWcurrentprefix{} +\def\NEWrequiremodules#1{% + \def\@pref{\file@path{#1}}% + \ifx\@pref\@empty% + \else% + \xdef\@NEWcurrentprefix{\@NEWcurrentprefix/\@pref}% + \fi% + \edef\@input@me{\@NEWcurrentprefix/\file@name{#1}}% + \message{requiring \@input@me}\reqmodule{\@input@me}% +}% \endinput %% %% End of file `modules.sty'. |