From 4a0af717b48598c71c7c19e9dc189c20db4dc311 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Thu, 20 Dec 2012 00:31:22 +0000 Subject: context-algorithmic (19dec12) git-svn-id: svn://tug.org/texlive/trunk@28580 c570f23f-e606-0410-a88d-b1316a301751 --- .../context/third/algorithmic/t-algorithmic.mkii | 160 +++++++++++ .../context/third/algorithmic/t-algorithmic.mkiv | 312 +++++++++++++++++++++ .../context/third/algorithmic/t-algorithmic.tex | 120 -------- 3 files changed, 472 insertions(+), 120 deletions(-) create mode 100644 Master/texmf-dist/tex/context/third/algorithmic/t-algorithmic.mkii create mode 100644 Master/texmf-dist/tex/context/third/algorithmic/t-algorithmic.mkiv delete mode 100644 Master/texmf-dist/tex/context/third/algorithmic/t-algorithmic.tex (limited to 'Master') diff --git a/Master/texmf-dist/tex/context/third/algorithmic/t-algorithmic.mkii b/Master/texmf-dist/tex/context/third/algorithmic/t-algorithmic.mkii new file mode 100644 index 00000000000..95cd7a26401 --- /dev/null +++ b/Master/texmf-dist/tex/context/third/algorithmic/t-algorithmic.mkii @@ -0,0 +1,160 @@ +%D \module +%D [ file=t-algorithmic, +%D version=2012.06.22, +%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=GNU General Public License] + +%C Copyright (C) 2010 Wolfgang Schuster +%C +%C This program is free software: you can redistribute it and/or modify +%C it under the terms of the GNU General Public License as published by +%C the Free Software Foundation, either version 3 of the License, or +%C any later version. +%C +%C This program is distributed in the hope that it will be useful, +%C but WITHOUT ANY WARRANTY; without even the implied warranty of +%C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +%C GNU General Public License for more details. +%C +%C You should have received a copy of the GNU General Public License +%C along with this program. If not, see . + +\writestatus{loading}{Context User Module / Algorithms} + +\unprotect + +\def\????algorithmic{@@@@algorithmic} + +\def\algorithmicparameter#1% + {\csname\ifcsname\????algorithmic#1\endcsname\????algorithmic#1\else\s!empty\fi\endcsname} + +\def\startalgorithmic + {\bgroup + \dosingleempty\dostartalgorithmic} + +\def\dostartalgorithmic[#1]% + {\iffirstargument + \setupalgorithmic[#1]% + \fi + \the\everyalgorithmic + \doifsomething{\algorithmicparameter\c!spacebefore}{\blank[\algorithmicparameter\c!spacebefore]}% + \algorithmicparameter\c!before + \setupwhitespace[\v!none]% + \doadaptleftskip{\algorithmicparameter\c!margin}% + \doif{\algorithmicparameter\c!numbering}\v!yes + {\setuplinenumbering + [\c!start=\algorithmicparameter\c!start, + \c!stop=\algorithmicparameter\c!stop, + \c!step=\algorithmicparameter\c!step]% + \startlinenumbering}} + +\def\stopalgorithmic + {\par + \doif{\algorithmicparameter\c!numbering}\v!yes\stoplinenumbering + \algorithmicparameter\c!after + \doifsomething{\algorithmicparameter\c!spaceafter}{\blank[\algorithmicparameter\c!spaceafter]}% + \egroup} + +\def\setupalgorithmic + {\dodoubleargument\getparameters[\????algorithmic]} + +% Commands + +\newtoks\everyalgorithmic + +\def\startsubalgorithmic + {\par\doadaptleftskip{\algorithmicparameter\c!width}} + +\def\stopsubalgorithmic + {\par\doadaptleftskip{-\algorithmicparameter\c!width}} + +\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} + +\appendtoks + \let\STATE \algorithmic!state + \let\IF \algorithmic!if + \let\ELSE \algorithmic!else + \let\ELSIF \algorithmic!elsif + \let\ENDIF \algorithmic!endif + \let\FOR \algorithmic!for + \let\FORALL \algorithmic!forall + \let\ENDFOR \algorithmic!endfor + \let\WHILE \algorithmic!while + \let\ENDWHILE\algorithmic!endwhile + \let\REPEAT \algorithmic!repeat + \let\UNTIL \algorithmic!until + \let\LOOP \algorithmic!loop + \let\ENDLOOP \algorithmic!endloop + \let\REQUIRE \algorithmic!require + \let\ENSURE \algorithmic!ensure + \let\RETURN \algorithmic!return + \let\TRUE \algorithmic!true + \let\FALSE \algorithmic!false + \let\PRINT \algorithmic!print + \let\COMMENT \algorithmic!comment +\to \everyalgorithmic + +% 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!spacebefore=\v!line, + \c!spaceafter=\v!line] + +\protect \endinput diff --git a/Master/texmf-dist/tex/context/third/algorithmic/t-algorithmic.mkiv b/Master/texmf-dist/tex/context/third/algorithmic/t-algorithmic.mkiv new file mode 100644 index 00000000000..6a985e5ac4e --- /dev/null +++ b/Master/texmf-dist/tex/context/third/algorithmic/t-algorithmic.mkiv @@ -0,0 +1,312 @@ +%D \module +%D [ file=t-algorithmic, +%D version=2012.12.18, +%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=GNU General Public License] + +%C Copyright (C) 2010 Wolfgang Schuster +%C +%C This program is free software: you can redistribute it and/or modify +%C it under the terms of the GNU General Public License as published by +%C the Free Software Foundation, either version 3 of the License, or +%C any later version. +%C +%C This program is distributed in the hope that it will be useful, +%C but WITHOUT ANY WARRANTY; without even the implied warranty of +%C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +%C GNU General Public License for more details. +%C +%C You should have received a copy of the GNU General Public License +%C along with this program. If not, see . + +% begin info +% +% title : algorithmic +% comment : context port of the algorithmic package for latex +% status : final +% +% end info + +\writestatus{loading}{Context User Module / Algorithms} + +\unprotect + +\startinterface all + \setinterfaceconstant {labelstyle} {labelstyle} + \setinterfaceconstant {labelcolor} {labelcolor} +\stopinterface + +\startinterface all + \setinterfacevariable {algorithmic} {algorithmic} +\stopinterface + +\installnamespace {algorithmic} +\installcommandhandler \????algorithmic {algorithmic} \????algorithmic + +\appendtoks + \setuevalue{\e!start\currentalgorithmic}{\algorithmic_start[\currentalgorithmic]}% + \setuevalue{\e!stop \currentalgorithmic}{\algorithmic_stop }% +\to \everydefinealgorithmic + +\appendtoks + \definelinenumbering[\currentalgorithmic]% +\to \everydefinealgorithmic + +\appendtoks + \setuplinenumbering + [\currentalgorithmic] + [\c!conversion=\algorithmicparameter\c!conversion, + \c!start=\algorithmicparameter\c!start, + \c!step=\algorithmicparameter\c!step, + \c!method=\algorithmicparameter\c!method, + \c!continue=\algorithmicparameter\c!continue, + \c!location=\algorithmicparameter\c!location, + \c!style=\algorithmicparameter\c!numberstyle, + \c!color=\algorithmicparameter\c!numbercolor, + \c!width=\algorithmicparameter\c!numberwidth, + \c!align=\algorithmicparameter\c!align]% +\to \everysetupalgorithmic + +\unexpanded\def\algorithmic_start[#1]% + {\begingroup + \edef\currentalgorithmic{#1}% + \dosingleempty\algorithmic_start_indeed} + +\def\algorithmic_start_indeed[#1]% + {\iffirstargument + \setupcurrentalgorithmic[#1]% + \fi + \the\t_algorithmic_commands + \usealgorithmicstyleandcolor\c!style\c!color + \doifsomething{\algorithmicparameter\c!spacebefore}{\blank[\algorithmicparameter\c!spacebefore]}% + \algorithmicparameter\c!before + \setupwhitespace[\v!none]% + \doadaptleftskip{\algorithmicparameter\c!margin}% + \doif{\algorithmicparameter\c!numbering}\v!yes\startlinenumbering} + +\unexpanded\def\algorithmic_stop + {\par + \doif{\algorithmicparameter\c!numbering}\v!yes\stoplinenumbering + \algorithmicparameter\c!after + \doifsomething{\algorithmicparameter\c!spaceafter}{\blank[\algorithmicparameter\c!spaceafter]}% + \endgroup} + +% Commands + +\def\algorithmic_begsub + {\par\doadaptleftskip{\algorithmicparameter\c!width}} + +\def\algorithmic_endsub + {\par\doadaptleftskip{-\algorithmicparameter\c!width}} + +\def\algorithmic_label#1% + {\begingroup + \usealgorithmicstyleandcolor\c!labelstyle\c!labelcolor + \algorithmictext{#1}% + \endgroup} + +\starttexdefinition algorithmic_state + \par +\stoptexdefinition + +\starttexdefinition algorithmic_if #1 + \par + \algorithmic_label{if} #1 \algorithmic_label{then} + \algorithmic_begsub +\stoptexdefinition + +\starttexdefinition algorithmic_else + \algorithmic_endsub + \algorithmic_label{else} + \algorithmic_begsub +\stoptexdefinition + +\starttexdefinition algorithmic_elsif #1 + \algorithmic_endsub + \algorithmic_label{elsif} #1 \algorithmic_label{then} + \algorithmic_begsub +\stoptexdefinition + +\starttexdefinition algorithmic_endif + \algorithmic_endsub + \algorithmic_label{endif} +\stoptexdefinition + +\starttexdefinition algorithmic_for #1 + \par + \algorithmic_label{for} #1 \algorithmic_label{do} + \algorithmic_begsub +\stoptexdefinition + +\starttexdefinition algorithmic_forall #1 + \par + \algorithmic_label{forall} #1 \algorithmic_label{do} + \algorithmic_begsub +\stoptexdefinition + +\starttexdefinition algorithmic_endfor + \algorithmic_endsub + \algorithmic_label{endfor} +\stoptexdefinition + +\starttexdefinition algorithmic_while #1 + \par + \algorithmic_label{while} #1 \algorithmic_label{do} + \algorithmic_begsub +\stoptexdefinition + +\starttexdefinition algorithmic_endwhile + \algorithmic_endsub + \algorithmic_label{endwhile} +\stoptexdefinition + +\starttexdefinition algorithmic_repeat + \par + \algorithmic_label{repeat} + \algorithmic_begsub +\stoptexdefinition + +\starttexdefinition algorithmic_until #1 + \algorithmic_endsub + \algorithmic_label{until} #1 +\stoptexdefinition + +\starttexdefinition algorithmic_loop + \par + \algorithmic_label{loop} + \algorithmic_begsub +\stoptexdefinition + +\starttexdefinition algorithmic_endloop + \algorithmic_endsub + \algorithmic_label{endloop} +\stoptexdefinition + +\starttexdefinition algorithmic_require + \par + \algorithmic_label{require} + \space +\stoptexdefinition + +\starttexdefinition algorithmic_ensure + \par + \algorithmic_label{ensure} + \space +\stoptexdefinition + +\starttexdefinition algorithmic_return + \par + \algorithmic_label{return} + \space +\stoptexdefinition + +\starttexdefinition algorithmic_true + \algorithmic_label{true} +\stoptexdefinition + +\starttexdefinition algorithmic_false + \algorithmic_label{false} +\stoptexdefinition + +\starttexdefinition algorithmic_print + \par + \algorithmic_label{print} + \space +\stoptexdefinition + +\starttexdefinition algorithmic_comment #1 + \textbraceleft + #1 + \textbraceright +\stoptexdefinition + +% The commands in the environment are all uppercase, the connection +% between them and their defintion happens here. + +\newtoks\t_algorithmic_commands + +\def\algorithmic_define + {\dodoubleargument\algorithmic_define_indeed} + +\def\algorithmic_define_indeed[#1][#2]% + {\appendtoks\letvalue{#1}#2\to\t_algorithmic_commands} + +\algorithmic_define [STATE] [\algorithmic_state ] +\algorithmic_define [IF] [\algorithmic_if ] +\algorithmic_define [ELSE] [\algorithmic_else ] +\algorithmic_define [ELSIF] [\algorithmic_elsif ] +\algorithmic_define [ENDIF] [\algorithmic_endif ] +\algorithmic_define [FOR] [\algorithmic_for ] +\algorithmic_define [FORALL] [\algorithmic_forall ] +\algorithmic_define [ENDFOR] [\algorithmic_endfor ] +\algorithmic_define [WHILE] [\algorithmic_while ] +\algorithmic_define [ENDWHILE] [\algorithmic_endwhile] +\algorithmic_define [REPEAT] [\algorithmic_repeat ] +\algorithmic_define [UNTIL] [\algorithmic_until ] +\algorithmic_define [LOOP] [\algorithmic_loop ] +\algorithmic_define [ENDLOOP] [\algorithmic_endloop ] +\algorithmic_define [REQUIRE] [\algorithmic_require ] +\algorithmic_define [ENSURE] [\algorithmic_ensure ] +\algorithmic_define [RETURN] [\algorithmic_return ] +\algorithmic_define [TRUE] [\algorithmic_true ] +\algorithmic_define [FALSE] [\algorithmic_false ] +\algorithmic_define [PRINT] [\algorithmic_print ] +\algorithmic_define [COMMENT] [\algorithmic_comment ] + +% Labels + +\definelabelclass[algorithmic] + +\setupalgorithmictext[\s!en][require=Require:] +\setupalgorithmictext[\s!en][ensure=Ensure:] +\setupalgorithmictext[\s!en][end=end] +\setupalgorithmictext[\s!en][if=if] +\setupalgorithmictext[\s!en][then=then] +\setupalgorithmictext[\s!en][else=else] +\setupalgorithmictext[\s!en][elsif=else if] +\setupalgorithmictext[\s!en][endif=end if] +\setupalgorithmictext[\s!en][for=for] +\setupalgorithmictext[\s!en][forall=for all] +\setupalgorithmictext[\s!en][do=do] +\setupalgorithmictext[\s!en][endfor=end for] +\setupalgorithmictext[\s!en][while=while] +\setupalgorithmictext[\s!en][endwhile=end while] +\setupalgorithmictext[\s!en][loop=loop] +\setupalgorithmictext[\s!en][endloop=end loop] +\setupalgorithmictext[\s!en][repeat=repeat] +\setupalgorithmictext[\s!en][until=until] +\setupalgorithmictext[\s!en][print=print] +\setupalgorithmictext[\s!en][return=return] +\setupalgorithmictext[\s!en][true=true] +\setupalgorithmictext[\s!en][false=false] + +% Default values + +\definealgorithmic[\v!algorithmic] + +\setupalgorithmic + [ \c!numbering=\v!no, % linenumbering + \c!conversion=\v!numbers, % linenumbering + \c!start=1, % linenumbering + \c!step=1, % linenumbering + \c!method=\v!first, % linenumbering + \c!continue=\v!no, % linenumbering + \c!location=\v!left, % linenumbering + \c!numberstyle=, % linenumbering + \c!numbercolor=, % linenumbering + \c!numberwidth=2em, % linenumbering + \c!align=\v!auto, % linenumbering + \c!width=1em, + \c!margin=1em, + \c!labelstyle=\v!bold, + \c!before=, + \c!after=, + \c!spacebefore=\v!line, + \c!spaceafter=\v!line] + +\protect \endinput diff --git a/Master/texmf-dist/tex/context/third/algorithmic/t-algorithmic.tex b/Master/texmf-dist/tex/context/third/algorithmic/t-algorithmic.tex deleted file mode 100644 index 91d23fa4dbe..00000000000 --- a/Master/texmf-dist/tex/context/third/algorithmic/t-algorithmic.tex +++ /dev/null @@ -1,120 +0,0 @@ -%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