diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/dialogl/menus.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/dialogl/menus.sty | 261 |
1 files changed, 261 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/dialogl/menus.sty b/Master/texmf-dist/tex/latex/dialogl/menus.sty new file mode 100644 index 00000000000..393d786e1e0 --- /dev/null +++ b/Master/texmf-dist/tex/latex/dialogl/menus.sty @@ -0,0 +1,261 @@ +%% +%% This is file `menus.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% menus.dtx (with options: `2e') +%% This is a generated file. +%% +%% Copyright 1994 Michael John Downes +%% Copyright 2013 TeX Users Group. +%% +%% It may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1 +%% 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 2003/12/01 or later. +%% +%% This file has the LPPL maintenance status "unmaintained". +%% +%% The list of all files belonging to the distribution is given in the file +%% `manifest.txt'. +%% +%% The list of derived (unpacked) files belonging to the distribution +%% and covered by LPPL is defined by the unpacking scripts (with +%% extension .ins) which are part of the distribution. +%%% ==================================================================== +%%% @LaTeX-style-file{ +%%% filename = "menus.dtx", +%%% version = "1.99a", +%%% date = "2013/01/24", +%%% author = "Michael Downes", +%%% copyright = "This file is part of the dialogl package, released +%%% under the LPPL; see dialogl.ins for details." +%%% keywords = "TeX, menus", +%%% supported = "no", +%%% abstract = "This file provides functions for writing +%%% messages and menus on screen, and reading user responses. It +%%% can be used with LaTeX as a documentstyle option, or in +%%% other forms of TeX by a standard \input statement.", +%%% } +%%% ==================================================================== +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{menus}[1994/11/08 v0.9x] +\RequirePackage{dialog} +\localcatcodes{\@{11}% + \~{13}\"{12}\#{6}\^{7}\`{12}\${3}\:{12}} +\storexmesj\menuprefix{ +====================================================================== +} +\let\menusuffix=\menuprefix +\storemesj\inmenuA{ +} +\storemesj\inmenuB{ +} +\storemesj\menuline{ } +\def\menutopline{} +\def\menubotline{} +\storemesj\endmenuline{ +}% +\def\menunumber#1{[#1] } +\def\menuprompt{\promptmesj{Your choice? }} +\newtoks\menufirstpart +\newtoks\menuchoices +\newtoks\menulastpart +\def\fmenu#1#2#{\mesjsetup + \catcode`\#=6 % for parameters + \toks@{\fxmenub{\gdef}{\begingroup}{}#1{#2}}% + \def\@tempa##1##{% + \def\@tempa####1####{% + \def\@tempa{\the\toks@}% + \afterassignment\@tempa \menulastpart}% + \afterassignment\@tempa \menuchoices}% + \afterassignment\@tempa \menufirstpart +} +\begingroup % localize \lccode change +\lccode`\~=`\^^M +\lowercase{% +\long\gdef\stripM#1$~#2#3\stripM#4{% + \ifx$#2% + \stripMa#1\stripMa#4% + \else + \stripMb#2#3\stripMb#4% + \fi +} +}% end lowercase +\lowercase{% +\long\gdef\stripMa $#1\stripMa#2{% + \stripMb#1$~$$\stripMb#2} +}% end lowercase +\lowercase{% +\long\gdef\stripMb#1~$#2#3\stripMb#4{% + \ifx$#2% + \stripMc#1\stripMc#4% + \else + \stripMd#1\stripMd#4% + \fi +} +}% end lowercase +\long\gdef\stripMc#1$#2\stripMc#3{% + \stripMd#1\stripMd#3} +\long\gdef\stripMd#1\stripMd#2{#2{#1}} +\endgroup +\begingroup \lccode`\~=`\^^M +\lowercase{% +\gdef\stripcontrolMs#1{\xp@\stripM + \xp@$\the#1$~$$\stripM#1} +}% end lowercase +\lowercase{% +\gdef\addmenulines#1#2#3{% + \def ~##1~##2{% + #1\xp@{\the#1#2##1#3}% + \ifx\end##2\xp@\@gobbletwo\fi~##2}% + \edef\@tempa{\nx@~\the#1\nx@~}#1{}% + \@tempa\end} +}% end lowercase +\endgroup % restore lccode of ~ +\def\fxmenub#1#2#3#4#5{% + \stripcontrolMs\menufirstpart + \stripcontrolMs\menulastpart + \stripcontrolMs\menuchoices + \addmenulines\menuchoices\menuline\endmenuline + \actively\let\^^M\relax % needed for \xdef + \toks@{\long#1#4#5}% e.g. \xdef\foo##1##2 + \edef\@tempa{\the\menufirstpart}% + \ifx\@tempa\@empty + \let\nxa@\@gobble + \else + \addmenulines\menufirstpart + \menutopline\endmenuline + \let\nxa@\nx@ + \fi + \edef\@tempa{\the\menulastpart}% + \ifx\@tempa\@empty + \let\nxb@\@gobble + \else + \addmenulines\menulastpart + \menubotline\endmenuline + \let\nxb@\nx@ + \fi +\edef\@tempa{{#3\nx@#3#2% + \def#3\nx@#3\mesjtext{% + #3\nx@#3\menuprefix + \the\menufirstpart #3\nxa@#3\inmenuA + \the\menuchoices #3\nxb@#3\inmenuB + \the\menulastpart #3\nx@#3\menusuffix}% + #3\nx@#3\sendmesj + #3\nx@#3\menuprompt}}% + \toks2 \xp@{\@tempa}% + \edef\@tempa{\the\toks@\the\toks2 }% + \let\menutopline\relax \let\menuline\relax + \let\menubotline\relax \let\endmenuline\relax + \let\menunumber\relax + \@tempa % finally, execute the \gdef or \xdef + \endgroup % matches \mesjsetup done by \fxmenu +}% end \fxmenub +\def\fxmenu#1#2#{\xmesjsetup + \toks@{\fxmenub{\xdef}{\xmesjsetup}\nx@#1{#2}}% + \def\@tempa##1##{% + \def\@tempa####1####{% + \def\@tempa{\the\toks@}% + \afterassignment\@tempa \menulastpart}% + \afterassignment\@tempa \menuchoices}% + \afterassignment\@tempa \menufirstpart +} +\def\notyet#1{% + \errmessage{Not yet implemented: \string#1}} +\long\def\nmenu#1#2#3#4#5{\notyet\nmenu} +\long\def\nxmenu#1#2#3#4#5{\notyet\nxmenu} +\newtoks\optionstack +\let\curmenu\@empty +\let\estart\relax +\let\eend\relax +\def\pushoptions#1{% + \edef\pushtemp{\estart + \def\nx@\curmenu{\curmenu}% + \eend + \the\optionstack}% + \global\optionstack\xp@{\pushtemp}% + \edef\curmenu{\curmenu#1}% +} +\def\popoptions{% + \edef\@tempa{\the\optionstack}% + \ifx\@empty\@tempa + \errmessage{Can't pop empty stack + (\string\optionstack)}% + \else + \def\estart##1\eend##2\@nil{% + \global\optionstack{##2}% + \let\estart\relax##1}% + \the\optionstack\@nil + \fi +} +\fmesj\moptionX{Exiting . . .} +\def\repeatoption{% + \csname moption\curmenu\endcsname} +\def\moptionQ{\popoptions \repeatoption} +\fxmesj\badoptionmesj#1{% +?---I don't understand "#1".} +\def\optionexec#1{% + \if ?#1\relax \let\@tempa\moptionhelp + \else \if Q#1\relax + \ifx\curmenu\@empty \let\@tempa\moptionX + \else \let\@tempa\moptionQ \fi + \else \if X#1\relax \let\@tempa\moptionX + \else + \xp@\let\xp@\@tempa + \csname moption\curmenu#1\endcsname + \ifx\@tempa\relax + \badoptionmesj{#1}\let\@tempa\repeatoption + \else + \pushoptions{#1}% + \fi + \fi\fi\fi + \@tempa +} +\def\optionfileexec#1{\notyet\optionfileexec} +\def\xoptiontest#1{TT\fi + \begingroup \def\0{?}\def\1{Q}% + \def\2{q}\def\3{x}\def\4{X}% + \aftergroup\if\aftergroup T% + \ifx\0#1\aftergroup T% + \else\ifx\1#1\aftergroup T% + \else\ifx\2#1\aftergroup T% + \else\ifx\3#1\aftergroup T% + \else\ifx\4#1\aftergroup T% + \else \aftergroup F% + \fi\fi\fi\fi\fi + \endgroup +} +\fxmesj\menuhelpmesj{&\menuprefix% +A response of Q will usually send you back to % +the previous menu. +A response of X will get you entirely out of % +the menu system. +&\menusuffix% +Press the <Return> key ( Enter ) to continue: +} +\def\moptionhelp{% + \menuhelpmesj \readline{}\reply \repeatoption} +\def\moptionhelp{% + \menuhelpmesj \readline{}\reply \repeatoption} +\xp@\def\csname moption?\endcsname{% + \moptionhelp} +\def\specialhelp#1#2{% + \let\specialhelpreply=#1\def#1{?}\begingroup + \def\menuhelpmesj{\let#1\specialhelpreply + \promptxmesj{#2\ +Press <return> to continue:}\endgroup}% +} +\def\specialhelpreply{} +\def\lettermenu#1{% + \csname menu#1\endcsname + \readChar{Q}\reply \optionexec\reply +} +\restorecatcodes +\endinput +%% +%% End of file `menus.sty'. |