-
Notifications
You must be signed in to change notification settings - Fork 0
/
ioa_code.sty
executable file
·153 lines (125 loc) · 3.87 KB
/
ioa_code.sty
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
%
% Input/Output Automata macros for
% algorithmicx (algpseudocode) package
% creation: July, 22th
%
%\floatname{algorithm}{I/O Automaton}
\newcommand{\partsize}{\footnotesize}
\newcommand{\size}{\footnotesize}
\newcommand{\smallsize}{\footnotesize}
%\algrenewcommand{\algorithmiccomment}[1]{\textsf{\size {\bf //} #1}}
\algrenewcommand{\algorithmiccomment}[1]{\textit{\scriptsize \hfill \color{gray}{$\rhd$ #1}\;\;\;}}
\algnewcommand{\algorithmicto}{\textbf{to}}
\algrenewcommand{\algorithmicindent}{1em}
\algblockdefx[IOASmallPart]{SmallPart}{EndSmallPart}%
[2]{{\bf \smallsize{#1:}}#2}{\bf Ending}
\algblockdefx[IOAPart]{Part}{EndPart}%
[2]{{\bf \partsize{#1:}}#2}{\bf Ending}
\algblockdefx[Precond]{Prec}{EndPrec}%
{\textbf{Precondition:}}{\bf Ending}
\algblockdefx[Effect]{Eff}{EndEff}%
{\textbf{Effect:}}{\bf Ending}
\algblockdefx[InputAction]{Input}{EndInput}%
[2]{\textbf{\size Input #1}%
\Eff#2\EndEff}{\bf Ending}
\algblockdefx[OutputAction]{Output}{EndOutput}%
[3]{\textbf{\size Output #1}%
\Prec#2\EndPrec%
\Eff#3\EndEff}{\bf Ending}
\algblockdefx[InternalAction]{Internal}{EndInternal}%
[3]{\textbf{\size Internal #1}%
\Prec#2\EndPrec%
\Eff#3\EndEff}{\bf Ending}
\algblockdefx[TimedAction]{Timed}{EndTimed}%
[3]{\textbf{\size #1}%
\Prec#2\EndPrec%
\Eff#3\EndEff}{\bf Ending}
\algblockdefx[AlgRepeat]{Repeat}{EndRepeat}%
{\textbf{Repeat:}~}{\bf Ending}
\algblockdefx[AlgUntil]{Until}{EndUntil}%
{\textbf{Until}~}{\bf Ending}
\algblockdefx[AlgWUntil]{WUntil}{EndWUntil}%
[1]{{\textbf{wait until}~}#1}{\bf Ending}
\algblockdefx[AlgReturn]{Return}{EndReturn}%
{\textbf{return}~}{\bf Ending}
\algblockdefx[SIf]{SmallIf}{EndSmallIf}%
[2]{{\textbf{if}~}(#1)~\textbf{then}~#2}{\bf Ending}
\algblockdefx[SIf]{SmallWhile}{EndSmallWhile}%
[2]{{\textbf{while}~}(#1)~\textbf{do}~#2}{\bf Ending}
\algblockdefx[SElse]{SmallElse}{EndSmallElse}%
[2]{{\textbf{else}~}#1}{\bf Ending}
\algblockdefx[Atom]{Atom}{EndAtom}%
[1]{{\textbf{atomic \{}~}#1}{\bf \}}
%\algblockdefx[InputAction]{Input}{EndInput}%
% [2]{\textbf{Input #1}%
% \State\textbf{Effect:}#2}{\bf Ending}
%\algblockdefx[OutputAction]{Output}{EndOutput}%
% [3]{\textbf{Output #1}%
% \State\textbf{Precondition:}#2%
% \State\textbf{Effect:}#3}{\bf Ending}
%\algblockdefx[InternalAction]{Internal}{EndInternal}%
% [3]{\textbf{Internal #1}%
% \State\textbf{Precondition:}#2%
% \State\textbf{Effect:}\State#3}{\bf Ending}
% redefining command output
%\algrenewtext{For}{\footnotesize{for}}
%\algrenewtext{If}{\footnotesize{if}}
%\algrenewtext{State}
% omitting block closing
\algnotext{EndPart}
\algnotext{EndSmallPart}
\algnotext{EndPrec}
\algnotext{EndEff}
\algnotext{EndIf}
\algnotext{EndFor}
\algnotext{EndInput}
\algnotext{EndOutput}
\algnotext{EndInternal}
\algnotext{EndTimed}
\algnotext{EndWhile}
\algnotext{EndRepeat}
\algnotext{EndUntil}
\algnotext{EndWUntil}
\algnotext{EndReturn}
\algnotext{EndSmallIf}
\algnotext{EndSmallWhile}
\algnotext{EndSmallElse}
%\newcommand{\ef}[2]{
%\begin{tabbing}
%XX\= XX\=XX\=XX\=XX\=XX\= \kill
%\protect #1\\
%Effect: \+ \\
% #2 \-
%\end{tabbing}}
%
%\newcommand{\prcef}[3]{\begin{tabbing}
%XX\= XX\=XX\=XX\=XX\= \kill
%\protect #1\\
%Precondition: \+ \\
% #2 \- \\
%Effect: \+ \\
% #3 \-
%\end{tabbing}}
%
%
%\newcommand{\two}[4]{
%\parbox{\columnwidth}{%
%\parbox[t]{#1\columnwidth}{#3}%
%\parbox[t]{#2\columnwidth}{#4}%
%}}
%
%\newcommand{\three}[6]{
%\parbox{\columnwidth}{%
%\parbox[t]{#1\columnwidth}{#4}%
%\parbox[t]{#2\columnwidth}{#5}%
%\parbox[t]{#3\columnwidth}{#6}%
%}}
%\newcommand{\TT}{\hspace*{2em}}
%\newcommand{\TTT}{\hspace*{3em}}
%\newcommand{\NT}{\hspace*{-1em}}
%%\newcommand{\Item}{\vspace*{-1.5\smallskipamount}\item}
%%\newcommand{\Item}{\vspace*{-2.5\smallskipamount}\item}
%\newcommand{\Item}{\item}
%%\setlength{\leftmargini}{1.5em}
%%\setlength{\leftmarginii}{1.6em}