From 9e135e13f27b412c53fd5b3199a48c5e8f411123 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Wed, 17 Jun 2009 22:22:24 +0000 Subject: new context package context-algorithmic (16jun09) git-svn-id: svn://tug.org/texlive/trunk@13789 c570f23f-e606-0410-a88d-b1316a301751 --- .../context/third/algorithmic/t-algorithmic.tex | 120 +++++++++++++++++++++ 1 file changed, 120 insertions(+) create mode 100644 Master/texmf-dist/tex/context/third/algorithmic/t-algorithmic.tex (limited to 'Master/texmf-dist/tex/context/third') diff --git a/Master/texmf-dist/tex/context/third/algorithmic/t-algorithmic.tex b/Master/texmf-dist/tex/context/third/algorithmic/t-algorithmic.tex new file mode 100644 index 00000000000..91d23fa4dbe --- /dev/null +++ b/Master/texmf-dist/tex/context/third/algorithmic/t-algorithmic.tex @@ -0,0 +1,120 @@ +%D \module +%D [ file=t-algorithmic, +%D version=2009.04.21, +%D title=\CONTEXT\ User Module, +%D subtitle=Algorithms, +%D author=Wolfgang Schuster, +%D date=\currentdate, +%D copyright=Wolfgang Schuster, +%D email=schuster.wolfgang@googlemail.com, +%D license=Public Domain] + +\writestatus{loading}{Context User Module / Algorithms} + +\unprotect + +\def\????al{@@@@al} % ALgorithmic + +\def\startalgorithmic + {\bgroup + \dosingleempty\dostartalgorithmic} + +\def\dostartalgorithmic[#1]% + {\iffirstargument + \setupalgorithmic[#1]% + \fi + \def\algorithmiccommands##1% + {\uppercase{\expandafter\let\csname##1\expandafter\endcsname}\csname algorithmic!##1\endcsname}% + \processcommacommand[\algorithmic!list!commands]\algorithmiccommands + \@@@@albefore + \setupwhitespace[\v!none]% + \doadaptleftskip\@@@@almargin + \doif\@@@@alnumbering\v!line + {\setuplinenumbering + [\c!start=\@@@@alstart, + \c!stop=\@@@@alstop, + \c!step=\@@@@alstep]% + \startlinenumbering}} + +\def\stopalgorithmic + {\par + \doif\@@@@alnumbering\v!line\stoplinenumbering + \@@@@alafter + \egroup} + +\def\setupalgorithmic + {\dodoubleargument\getparameters[\????al]} + +% Commands + +\def\algorithmic!list!commands + {state,if,else,elsif,endif,for,forall,endfor,while,endwhile,repeat,% + until,loop,endloop,require,ensure,return,true,false,print,comment} + +\def\startsubalgorithmic + {\par\doadaptleftskip\@@@@alwidth} + +\def\stopsubalgorithmic + {\par\doadaptleftskip{-\@@@@alwidth}} + +\def\algorithmic!state {\par} +\def\algorithmic!if #1{\par\algorithmicif\ #1 \algorithmicthen\startsubalgorithmic} +\def\algorithmic!else {\stopsubalgorithmic\algorithmicelse\startsubalgorithmic} +\def\algorithmic!elsif #1{\stopsubalgorithmic\algorithmicelsif\ #1 \algorithmicthen\startsubalgorithmic} +\def\algorithmic!endif {\stopsubalgorithmic\algorithmicendif} +\def\algorithmic!for #1{\par\algorithmicfor\ #1 \algorithmicdo\startsubalgorithmic} +\def\algorithmic!forall#1{\par\algorithmicforall\ #1 \algorithmicdo\startsubalgorithmic} +\def\algorithmic!endfor {\stopsubalgorithmic\algorithmicendfor} +\def\algorithmic!while #1{\par\algorithmicwhile\ #1 \algorithmicdo\startsubalgorithmic} +\def\algorithmic!endwhile{\stopsubalgorithmic\algorithmicendwhile} +\def\algorithmic!repeat {\par\algorithmicrepeat\startsubalgorithmic} +\def\algorithmic!until #1{\stopsubalgorithmic\algorithmicuntil\ #1} +\def\algorithmic!loop {\par\algorithmicloop\startsubalgorithmic} +\def\algorithmic!endloop {\stopsubalgorithmic\algorithmicendloop} +\def\algorithmic!require {\par\algorithmicrequire\space} +\def\algorithmic!ensure {\par\algorithmicensure\space} +\def\algorithmic!return {\par\algorithmicreturn\space} +\def\algorithmic!true {\algorithmictrue} +\def\algorithmic!false {\algorithmicfalse} +\def\algorithmic!print {\par\algorithmicprint\space} +\def\algorithmic!comment {\algorithmiccomment} + +% I should make this multilingual + +\def\algorithmicrequire {{\bf Require:}} +\def\algorithmicensure {{\bf Ensure:}} +\def\algorithmiccomment#1{\{#1\}} +\def\algorithmicend {{\bf end}} +\def\algorithmicif {{\bf if}} +\def\algorithmicthen {{\bf then}} +\def\algorithmicelse {{\bf else}} +\def\algorithmicelsif {\algorithmicelse\ \algorithmicif} +\def\algorithmicendif {\algorithmicend\ \algorithmicif} +\def\algorithmicfor {{\bf for}} +\def\algorithmicforall {{\bf for all}} +\def\algorithmicdo {{\bf do}} +\def\algorithmicendfor {\algorithmicend\ \algorithmicfor} +\def\algorithmicwhile {{\bf while}} +\def\algorithmicendwhile {\algorithmicend\ \algorithmicwhile} +\def\algorithmicloop {{\bf loop}} +\def\algorithmicendloop {\algorithmicend\ \algorithmicloop} +\def\algorithmicrepeat {{\bf repeat}} +\def\algorithmicuntil {{\bf until}} +\def\algorithmicprint {{\bf print}} +\def\algorithmicreturn {{\bf return}} +\def\algorithmictrue {{\bf true}} +\def\algorithmicfalse {{\bf false}} + +% Default values + +\setupalgorithmic + [\c!numbering=\v!no, + \c!start=1, + \c!stop=, + \c!step=1, + \c!width=1em, + \c!margin=1em, + \c!before=\blank, + \c!after=\blank] + +\protect \endinput -- cgit v1.2.3