Debian Codegraph @

texmf-dist/doc/latex/msc/msc.tex

raw
1 % file: manual.tex
2 % Copyright 2008-2013 V. Bos, T. van Deursen, P. Kordy, and S. Mauw
3 % This file is part of the MSC Macro Package.
4 %
5 \documentclass[12pt,a4paper]{article}
6 \def\pgfautoxrefs{1}
7 \usepackage[version=latest]{pgf}
8 \usepackage{xparse}
9 % \usepackage{a4wide}
10 % \usepackage{url}
11 \usepackage{moreverb}
12 \usepackage{multicol}
13 \usepackage{msc}
14 \usepackage{showexpl}
15 \usepackage{xkeyval,calc,listings,tikz,fp}
16 \usepackage{hyperref}
17 \usepackage{ifluatex}
18 \usepackage[a4paper,left=2.25cm,right=2.25cm,top=2.5cm,bottom=2.5cm,nohead]{geometry}
19 \usepackage{amsmath,amssymb}
20 \usepackage{xxcolor}
21 \usepackage{pifont}
22 \usepackage{makeidx}
23 \usepackage{compsci}
24 \usepackage{xstring}
25 % \usepackage{pgfmanual}
26 \newcommand{\PK}[1]{%
27 {\color{red}{\bf[PK]} #1}}
28
29 % we allow a ragged right
30 \setlength{\rightskip}{0pt plus 0.05\linewidth minus 0pt}
31
32 \input{manual-macros.tex}
33 % \hypersetup{hidelinks}
34 \hypersetup{%
35 colorlinks=true, % use true to enable colors below:
36 linkcolor=blue,%red,
37 filecolor=blue,%magenta,
38 urlcolor=blue,%cyan,
39 citecolor=blue,
40 pdfborder=0 0 0,
41 }
42
43 \makeindex
44 \makeatletter
45 \def\convertto#1#2{\strip@pt\dimexpr #2*65536/\number\dimexpr 1#1}%\dimexpr require etex
46 \input{pgfmanual.code}
47 \pgfkeys{
48 % list is tried to find a match.
49 /pdflinks/search key prefixes in={/msc/,/tikz/,/pgf/,/depgraph/},
50 %
51 }
52 \newcommand{\msckey}[3]{
53 \IfEndWith*{\mscget{#1}}{pt}{%
54 \IfStrEq*{#1}{label distance}{
55 \def\tmp{\convertto{ex}{\mscget{#1}}ex}
56 }{
57 \def\tmp{\convertto{cm}{\mscget{#1}}cm}
58 }
59 }{%
60 \edef\tmp{\mscget{#1}}
61 }
62
63 \begin{key}{/msc/#1=#2 (initially \tmp)}
64 #3
65 \end{key}
66 }
67 \newcommand{\mscstyle}[2]{
68 \begin{stylekey}{/msc/#1}
69 #2
70 \end{stylekey}
71 }
72
73 % The following code is taken from the doc package. It defines a global
74 % macro \bslash that produces a bslash (if present in the current font).
75 {\catcode`\|=\z@ \catcode`\\=12 |gdef|bslash{\}}
76 \makeatother
77 \title{
78 A \LaTeX{} macro package for Message Sequence Charts\\{\large User Manual}
79 }
80
81 \author{
82 \begin{tabular}{c}
83 \begin{tabular}{ccc}
84 Victor Bos & &
85 Ton van Deursen\\
86 & & \\
87 Piotr Kordy& &
88 Sjouke Mauw
89 \end{tabular}\\
90 \end{tabular}
91 }
92
93 \date{\small Version A\mscversion, last update \today\\
94 Describing \mscpack{} version \mscversion}
95
96 \begin{document}
97
98 \maketitle
99
100 \begin{abstract}
101 \noindent
102 The \mscpack{} facilitates the \LaTeX\ user to easily include
103 Message Sequence Charts in his texts. This document describes the
104 design and use of the \mscpack.
105 \end{abstract}
106
107 \tableofcontents
108 \section{New}
109 \label{new}
110 \paragraph{Version~2.00} is the result of a complete rewrite of the package.
111 The main difference is that the package is
112 now implemented in \tikzname\ instead of \verb+PSTricks+, making it
113 compatible with
114 \verb+pdfLaTex+ and \beamer.
115
116 In addition the syntax has been slightly extended. It now supports the
117 specification of all options as a comma separated list in square
118 brackets, while remaining backward compatible. All lengths are now
119 stored using \pgfname\ keys. As a result it is possible to change
120 sizes of shapes individually. Support for colors is added.
121
122 We are much indebted to Adrian Farmadin (Masaryk University, Czech
123 Republic) for initiating and contributing to this software rehaul.
124
125
126 \paragraph{Version~1.17} slightly modifies the handling of the
127 |offset| argument of the |\mess|, |\setstoptimer|, and
128 |\settimeout| commands. All commands with an |offset|
129 argument can now properly handle real numbers as
130 argument. Furthermore, the \verb+\topheaddist+,
131 \verb+\firstlevelheight+, and \verb+\instheadheight+ lengths are now
132 taken into account when computing the height of the instance and the
133 \verb+\gatesymbolradius+ length is now properly implemented.
134
135 The |\condition*| macro is now extended to dynamically
136 resize a condition symbol that spans multiple instances. The
137 |\condition*| and |\action*| macros, introduced in the
138 previous release, no longer shrink to a size smaller than their
139 non-starred counterparts. The |\condition| and
140 |\action| have crossed-out counterparts |\ncondition| and
141 |\naction| respectively.
142
143 A variation to the \verb+\stop+ command is implemented. Rather than
144 drawing a cross to denote that an instance has stopped, the
145 \verb+\stop*+ command draws an instance footer.
146
147 Finally, the \verb+\create+ command no longer requires the
148 \verb+creator+ parameter to be specified. If it is not specified, no
149 arrow is drawn from the creator to the dynamically created instance.
150
151
152 \paragraph{Version~1.16} solves a bug that was due to a change in
153 syntax of the \verb+scalebox+ macro in the \verb+PSTricks+ package.
154
155 The |\action| and |\condition| macros are extended with a
156 starred option. The starred version of the macros automatically
157 adjusts the size of the rectangle and hexagon based on the size of the
158 contents.
159
160 \paragraph{Version~1.13} has a reimplementation of message commands in MSC
161 diagrams. The affected commands are: |\create|, |\found|,
162 |\lost|, |\mess|, and |\order|. The new implementation
163 provides more control over the placement of message labels.
164
165 The command \verb+\selfmesslabelpos+ has been removed.
166
167 The bounding box bug has been partly solved. Now, a white |\fbox|
168 is drawn around every (msc, mscdoc, hmsc) diagram. This makes it
169 possible for \texttt{dvips -E} to compute the correct bounding box for
170 the diagrams. Due to the |\fbox|, each diagram is extended with
171 0.3pt on each side (left, top, right, and bottom). This bugfix fails
172 if the background is not white. The xdvi program shows the white
173 |\fbox| in black with the result that diagrams have two visible
174 frames. This seems to be a bug of xdvi.
175
176 The lines around comments (|\msccomment|, Section~\ref{comments})
177 are changed from gray into black. The reason for this is that the gray
178 lines became invisible after converting the document to HTML.
179
180 \section{Introduction}
181 \label{introduction}
182
183 The \MSC{} language is a visual language for the description of the
184 interaction between different components of a system.
185 This language is standardized by the ITU (International
186 Telecommunication Union) in Recommendation Z.120~\cite{z120}. An
187 introductory text on \MSC{} can be found
188 in~\cite{RudolphGrabowskiGraubmann96}. \MSC{}s have a
189 wide application domain, ranging from requirements specification to
190 testing and documentation.
191 An example of a Message Sequence Chart is in Figure~\ref{quick}.
192
193 In order to support easy drawing of \MSC{}s in \LaTeX\ documents, we have
194 developed the \mscpack. The current version of the \mscpack{}
195 supports the following \MSC{} constructs: \MSC{} frame, instances (both
196 single line width and double line width), messages (including
197 self-messages and messages to the environment), actions, singular and
198 combined timer events (set, timeout, reset, set-timeout, set-stop),
199 lost and found messages, generalized order, conditions, coregions,
200 activation regions, suspension regions, gates, instance creation,
201 instance stop, time measurements, references, and inline
202 expressions. In addition, there is support for \HMSC{}'s (high-level
203 \MSC{}s) and \MSCdoc{}s.
204
205 In this manual we explain the design and the use of the \mscpack. For
206 a complete overview of all features, we refer to the reference
207 manual~\cite{BM02}, which is included in the distribution under the
208 name \verb+refman.ps+. Another way to learn how to use the \mscpack{}
209 is to have a look at the \LaTeX{} source code of the manual and the
210 source code of the reference manual. They are included in the
211 distribution under the names \verb+manual.tex+ and \verb+refman.tex+,
212 respectively. The \MSC{} constructs are simply introduced as
213 syntactic constructs. This paper is not meant to describe their use or
214 meaning.
215
216 We list the backgrounds of the package and some design decisions in
217 Section~\ref{background}.
218 Section~\ref{install} contains notes on installing the
219 package. Section~\ref{quickstart} contains an example of using the
220 package. It allows the impatient reader to quickly start using the
221 package. The details of using the package are explained in
222 Section~\ref{use}. In Section~\ref{parameters} the parameters are
223 explained which determine detailed layout of the various symbols.
224 A large but meaningless example is given in
225 Section~\ref{example}.
226
227
228 \section{Background and motivation}
229 \label{background}
230 Several commercial and non-commercial tools are available, which
231 support drawing or generating Message Sequence Charts. However, these
232 tools are in general not freely available and often not flexible
233 enough to satisfy all user's wishes with respect to the layout and
234 graphical appearance of an \MSC{}.
235 Therefore, people often use general drawing tools, such as {\em xfig}
236 to draw \MSC{}s. However flexible this approach is, it takes quite some
237 effort to produce nice \MSC{} drawings in a tool which is not dedicated
238 to \MSC{}s. Furthermore, when drawing a number of \MSC{}s it requires some
239 preciseness in order to obtain a consistent set of \MSC{}s.
240
241 For these reasons, we have started the design of a set of
242 \LaTeX\ macros which support the drawing of \MSC{}s. In this way, an \MSC{} can be
243 represented in \LaTeX\ in a textual format and compiled into
244 e.g.\ PostScript.
245
246 We aimed at satisfying the following requirements and design
247 decisions.
248 \begin{itemize}
249 \item
250 The package should follow the ITU standard with respect to shape and
251 placement of the symbols. (The current version supports
252 the \MSC2000 standard.)
253 \item
254 Static and dynamic semantics are not considered. The user is allowed
255 to violate all semantical restrictions and draw inconsistent \MSC{}s.
256 The package only supports elementary syntactical requirements.
257 \item
258 The package should offer functionality at the right level of
259 abstraction. Rather than supplying coordinates of pixels, the
260 user should be able to express the placement of symbols in terms of
261 {\em levels}.
262 Nevertheless, the textual representation of \MSC{}s as defined by the ITU
263 standard has a level of abstraction which is too high for our purposes.
264 It lacks information about the actual positioning of the \MSC{} symbols,
265 while we think that in our package this should be under user control.
266 \item
267 There should be only minimal automatic restructuring and layout of the
268 \MSC{} (e.g.\ the relative positioning of two messages should be as
269 defined by the user, even if the messages are not causally ordered).
270 \item
271 The user can customize the appearance of the \MSC{}s by manipulating
272 an appropriate set of parameters.
273 \end{itemize}
274
275 \section{Installation, copyright and system requirements}
276 \label{install}
277
278 The \mscpack{} is still under development. The authors
279 appreciate any comments and suggestions for improvements. The most
280 recent version of the package can be downloaded from
281 \url{http://satoss.uni.lu/mscpackage/}.
282
283
284 The \mscpack{} has a \emph{LaTeX Project Public License}
285 (LPPL), see~\url{http://www.latex-project.org/lppl.txt}:
286 {\small
287 \verbatiminput{COPYRIGHT}
288 } As such, it is free of charge and can be freely
289 distributed. Furthermore, it is allowed to make modifications to the
290 package, provided that modified versions get different names. The
291 authors accept no liability with respect to the functioning of the
292 package.
293
294 The \mscpack{} runs with \LaTeXe. It has been tested with \LaTeXe\
295 version dated 1998/06/01 using \TeX\ version 3.14159. The following
296 additional packages are required: \textsf{tikz}, \textsf{calc},
297 and \textsf{xstring}. These packages are in general
298 part of the standard \LaTeXe\ distribution. These additional packages
299 can be obtained from the {\em ctan} database for \LaTeX\, e.g.\ via
300 the following URL: \url{http://www.tex.ac.uk/}. The \textsf{tikz}
301 package is described shortly in~\cite{mertz2007graphics} or in the \pgfname
302 manual~\cite{tantau2022pgf}.
303 The generated output can be previewed with pdf/ps previewing software.
304 It may be needed to update all \LaTeX\ related software
305 to a more recent version in order to smoothly work with the \mscpack.
306
307 The \mscpack{} can be installed easily. Just put the file
308 |msc.sty| in a directory which is searched by \LaTeX{} for style
309 files. The set of directories actually searched depends on the \TeX\
310 installation, but often the {\em current directory} is included. UNIX
311 users may have to set the environment variable \texttt{\$TEXINPUTS} to
312 an appropriate value. For more details on this topic consult
313 documentation of your \TeX\ installation.
314
315 %The following text is currently not applicable -sm
316 %
317 %A problem may occur when using more packages than the \MSC{} macro
318 %package in your \LaTeX\ document. This happens, e.g.\ when using the
319 %{\em epsfig} package. These problems are due to the combination of
320 %several packages which are required (but not provided) by the \MSC{}
321 %macro package. The solution is to change the order of the
322 %\verb+usepackage+ clauses.
323
324 \section{Quick start}
325 \label{quickstart}
326 The \mscpack{} is easy to use.
327 Below is an example of the use of the package and
328 Figure~\ref{quick} shows the generated \MSC{}.
329 \begin{figure}[htbp]
330 \begin{center}
331 \begin{codeexample}[width=\linewidth-6.8cm]
332 \begin{msc}{Example}
333 \declinst{usr}{User}{}
334 \declinst{m1}{Machine 1}{control}
335 \declinst{m2}{Machine 2}{drill}
336
337 \mess[label position=below]
338 {startm1}{usr}{m1}
339 \nextlevel
340 \mess{startm2}{m1}{m2}
341 \nextlevel
342 \mess{log}{m1}{envleft}
343 \nextlevel
344 \nextlevel
345 \mess{output}{m2}{usr}[2]
346 \mess{free}{m1}{usr}
347 \nextlevel
348 \end{msc}
349 \end{codeexample}
350 \end{center}
351 \caption{The generated \MSC{}}
352 \label{quick}
353 \end{figure}
354 The \mscpack{} is activated by the clause \verb+\usepackage{msc}+. This package
355 contains, among others, a definition of the environment |msc|. This
356 environment is used to draw \MSC{}s. The \MSC{} definition is surrounded by the
357 clauses |\begin{msc}{Example}| and |\end{msc}|. The name of the
358 \MSC{}, {\tt Example}, is displayed in the upper-left corner of the \MSC{}.
359
360 The next four lines define the \emph{instances}:
361 |\declinst{m1}{Machine 1}{control}| defines an instance with
362 \meta{nickname} |m1| and a description consisting of two parts,
363 namely, |Machine 1| and |control|. The nickname is used in
364 all subsequent references to this instance. The first part of the
365 description is drawn above the rectangular instance head symbol, and
366 the second part of the description is drawn inside the instance head
367 symbol.
368
369 The following lines contain the definitions of the messages. Every
370 message has a source and a destination instance. The clause
371 |\mess[label position=below]{startm1}{usr}{m1}| defines a message with name
372 |startm1|, which goes from instance |usr| to instance |m1|.
373 Between square brackets we can put optional list of options. Each option is
374 comma separated from another option. In this example we specify the placement of
375 the label to be below the message arrow.
376
377 In order to control the vertical placement of the messages, the \MSC{} is
378 divided into levels. At every level, any number of messages may start.
379 The vertical position of the end point of a message is determined
380 by the optional fourth argument of the message definition, as in the
381 clause |\mess{output}{m2}{user}[2]|.
382 This argument is the vertical offset (in number of levels) between the
383 start point of the message (i.e.,\ the current level) and its end point.
384 If the value is 0 the message is drawn horizontally. A negative offset
385 means that the arrow has an upward slope. Equivalently we could specify this
386 value using option: |\mess[level shift=2]{output}{m2}{user}|.
387
388 The clause |\nextlevel| is used to advance to the next level.
389
390 \section{Use of the \mscpack}
391 \label{use}
392 \subsection{Options}
393 Each command supported by the \mscpack\ can be provided with a list of
394 options. A list of
395 options is surrounded by square brackets and options are separated
396 by a comma. In fact options are \pgfname\ keys and the parsing of options
397 is done internally by the \tikzname\ package. All keys defined by the
398 \mscpack\ are
399 prefixed by the |/msc| keyword. When a key is not fully specified (i.e.,\ it is
400 specified without the |/msc|, |/tikz| or some other prefix) the
401 package will search first for the keys in the |/msc| namespace and if no
402 key is found it will search the default |/tikz| name space.
403
404 In the description below, optional arguments are marked in \opt{green}.
405 \subsection{The \MSC{} frame}
406 \label{mscframe}
407 The |msc| environment is used for making \MSC{} definitions. Thus, such a
408 definition looks as follows.
409 \begin{environment}{{msc}\opt{\oarg{options}}\marg{msc name}}
410 This declares the |msc| environment. The frame and the header of the
411 \MSC{} are drawn.
412 The argument \meta{msc name} is the name of the \MSC{}.
413 The header of an \MSC{} is formed from the keyword |msc|, followed
414 by the \meta{msc name}.
415
416 The size of the \MSC{} frame is determined vertically by the number of levels
417 occurring in the \MSC{} (see Section~\ref{levels}) and horizontally by
418 the number of instances (see Section~\ref{instances}).
419 \msckey{title position}{\meta{position}}{
420 Controls the position of the header of the MSC. Possible values of
421 \meta{position} are:
422 |left|, |right|, and |center|.}
423 \msckey{msc keyword}{\meta{keyword}}{
424 Specifies the \meta{keyword} in the header.}
425 \msckey{title distance}{\meta{distance}}{
426 Specifies the \meta{distance} between left/right side of the frame and the MSC
427 header.}
428 \msckey{title top distance}{\meta{distance}}{
429 Specifies the \meta{distance} between top of the frame and the (top
430 of the) MSC header.}
431 \msckey{left environment distance}{\meta{distance}}{
432 Specifies the \meta{distance} between the left-most instance and the
433 left side of the frame.
434 }
435 \msckey{right environment distance}{\meta{distance}}{
436 Specifies the \meta{distance} between the right-most instance and
437 the right side of the frame.
438 }
439 \begin{key}{/msc/environment distance}
440 Sets the keys |right environment distance| and |left environment distance| to
441 the provided value.
442 \end{key}
443 \msckey{instance distance}{\meta{distance}}{
444 Sets the \meta{distance} between the (vertical) instance lines.
445 }
446
447 \begin{key}{/msc/draw frame=\meta{colour} (default , initially \mscget{draw frame})}
448 Sets the colour of the frame. If you do not want to draw a frame, set
449 \meta{colour} to |none|. When \meta{colour} is empty, then the last colour is used,
450 usually black.
451 \end{key}
452
453 \begin{key}{/msc/draw grid=\meta{grid type} (default grid, initially \mscget{draw grid})}
454 Specifies if we want to draw the help grid in msc. Possible values for
455 \meta{grid type} are |grid|,
456 |color grid| and |none|.
457 \end{key}
458
459 \end{environment}
460
461 \subsection{Levels}
462 \label{levels}
463 An \MSC{} is vertically divided in {\em levels}. All events in an \MSC{} are
464 attached to a certain level, or stretch out over several levels.
465 Any number of events can be drawn at a certain level.
466 An event will always be drawn (or started) at the current level, unless a level
467 offset is specified (see e.g.\ the |\mess| command in
468 Section~\ref{messages}). The \meta{level offset} is a positive integer number, which
469 denotes at which level, relative to the current level, an event should
470 be drawn.
471 Drawing starts at level 0.
472 The following command is used to advance to the next level.
473 \begin{command}{\nextlevel\opt{\oarg{level offset}}}
474 The \meta{lever offset} is a positive integer value which denotes the number of
475 levels to advance. By default, the value of \meta{lever offset} is 1, which means
476 drawing continues at the next level.
477 \end{command}
478 The following keys influence the |\nextlevel| command:
479 \msckey{first level height}{\meta{distance}}{
480 Specifies the \meta{distance} between the instance start symbol and the first level.}
481 \msckey{level height}{\meta{distance}}{
482 Specifies the \meta{distance} between two consecutive levels.}
483 \msckey{last level height}{\meta{distance}}{
484 Specifies the \meta{distance} between the last level and the instance end symbol.}
485
486 Figure~\ref{parametersfig} on page~\pageref{parametersfig} shows all lengths of
487 the \mscpack.
488 \subsection{Instances}
489 \label{instances}
490 All instances have to be declared before they can be used. An instance
491 consists of an instance head symbol with an associated name, an
492 instance axis and an instance end symbol. Normal instances have a
493 single line axis. Fat instances have a double line axis. The order of
494 the instance declarations determines the order in which the instances
495 occur in the drawing.
496
497 An instance is declared with the following command.
498
499 \begin{command}{\declinst\opt{*}\marg{nickname}\marg{instance name above}\marg{instance name within}}
500 The starred version produces a fat instance.
501 The \meta{nickname} is used for referring to this instance in the rest of the
502 MSC definition.
503 The \meta{instance name above} is put above the instance head symbol.
504 The \meta{instance name within} is put inside the instance head symbol.
505 \MSC{} definition.
506 \end{command}
507 The keys associated with the command:
508 \msckey{head height}{\meta{height}} {
509 Specifes the minimum \meta{height} of the instance head symbol.}
510 \msckey{instance width}{\meta{width}}{
511 Specifes the minimum \meta{width} of the instance head symbol.}
512 \msckey{head top distance}{\meta{distance}}{
513 Specifes the \meta{distance} between top of the head symbols and frame.}
514 \msckey{foot height}{\meta{height}}{
515 Specifes the \meta{height} of the instance foot symbol.}
516 \msckey{foot distance}{\meta{distance}}{
517 Specifes the \meta{distance} between the instance foot symbol and the bottom of the \MSC{} frame.}
518 \msckey{environment distance}{\meta{distance}}{
519 Specifies the \meta{distance} between the edge of the \MSC{} and the first/last instance axis.}
520 \msckey{instance width}{\meta{width}}{
521 Specifies the \meta{width} of the instance head and foot symbols.}
522 \msckey{label distance}{\meta{distance}}{
523 Specifies the \meta{distance} between the instance head symbol and the part of the
524 instance name drawn above the head symbol.}
525 \msckey{draw head}{\meta{colour}}{
526 Sets the colour of the instance head. If you do not want to draw an instance head, set
527 \meta{colour} to |none|. When \meta{colour} is empty, then the last colour is used,
528 usually black.
529 }
530
531 % The command \verb+\setfootcolor{color}+ sets the
532 % fill color of the footer symbol. Valid color values are, e.g.,
533 % \texttt{black} (default), \texttt{white}, and \texttt{gray}.
534 The following \MSC{} shows the declaration of an \MSC{} with three
535 instances. The first and the last are normal instances (one line axis),
536 whereas the second is a fat instance (double line axis). The optional
537 parameter |values small|, indicates that the small drawing
538 style should be used (see Section~\ref{parameters}).
539 % \setmscvalues{small}
540 \begin{codeexample}[width=\linewidth-8.8cm]
541 \begin{msc}[small values]{instances}
542 \declinst{i}{above}{within}
543 \declinst*{j}{}{j}
544 \declinst{k}{k}{}
545 \end{msc}
546 \end{codeexample}
547
548 \subsection{Messages}
549 \label{messages}
550 A message is denoted by an arrow from the sending instance to the
551 receiving instance. The instances are referred to by their nicknames.
552 A message is defined with the following command.
553 \begin{command}{\mess\opt{*}\opt{\oarg{options}}\marg{name}\marg{sender}\marg{receiver}\opt{\oarg{leveloffset}}}
554 % \begin{verbatim}
555 % \mess(*)[pos]{name}[labelpos]{sender}[placement]{receiver}[leveloffset]
556 % \end{verbatim}
557 The \meta{name} of the message may be any string. The \mscpack{}
558 processes the \meta{name} argument in LR-mode,
559 see~\cite[page~36]{Lam94}. This means that the string will consist of
560 one line. To generate multi-line message names, use the standard
561 \cmd{parbox} command, see the \emph{Tricks} section in the reference
562 manual~\cite{BM02}. By default, the name of a message label is drawn
563 above the center of the arrow, but the optional keys |label position|,
564 |side|, and |pos| influence the actual location,
565 as described below. The arrow starts at the current level at the
566 sending instance. The arrow ends at the current level plus the
567 level \meta{leveloffset}, at the receiving instance. \meta{leveloffset} can be
568 also modified by specifying keys |level shift| and |offset|. The
569 \meta{sender} and \meta{receiver} should be the nicknames of declared
570 instances.
571 Messages to or from the environment (i.e.,\ the left or the right side
572 of the \MSC{} frame) can be
573 specified by setting the sender or the receiver argument to one of the values
574 |envleft| or |envright|. (Note: Since instances and
575 environments are treated equally in the implementation, at every position
576 where the nickname of an instance is required, also
577 |envleft| and |envright| are allowed.)
578
579 In case the sending and the receiving instance are the same, the
580 message is a \emph{self message}. A self message is drawn as a
581 polyline connecting the instance axis to itself.
582
583 The starred version of the command, |\mess*|, produces the same
584 result as |\mess|, except that the arrow is drawn with a dashed
585 line. This can be used to draw a {\em method reply} (see~\cite{z120}).
586 \end{command}
587 The following keys influence the messages:
588 \msckey{level shift}{\meta{integer}}{
589 For non-self message, \meta{integer} determines at which level message should arrive relative to the starting level
590 of the message.
591 }
592 \msckey{offset}{\meta{integer}}{
593 For self message, \meta{integer} determines how many levels the message arrow should advance.
594 }
595 \msckey{side}{\meta{side}}{
596 Determine the position of the arrow with respect to the instance axis. Valid values
597 for \meta{side} are |left| and |right|. In case of a non-self message the key is ignored.
598 }
599 \msckey{label position}{\meta{position}}{
600 Determines the position of the label.In case of non-self message, valid values
601 for \meta{position} are |above|, |below|, |above~left|, |above~right|,
602 |below~left| and |below~right|. In case of self message valid values are |left|
603 and |right| and the default value is taken from the value of the key |side|. As
604 the implementation uses corresponding |/tikz| keys the |label~position=| part
605 can be skipped.
606 }
607 \msckey{pos}{\meta{real}}{
608 Determines the relative distance of the message label to the beginning of the
609 message. Valid values for \meta{real} are real numbers in the closed interval $[0,1]$.
610 The key works in similar way as |/tikz/pos| key.
611 }
612 \msckey{self message width}{\meta{width}}{
613 Controls the \meta{width} of the polyline used for drawing self-message.
614 % It also affects other commands such as |\order|, |\settimeout| or |\setstoptimer|.
615 }
616 \msckey{label distance}{\meta{distance}}{
617 Specifies the \meta{distance} between the label of a message and the message arrow.
618 }
619 \msckey{arrow scale}{\meta{scale}}{
620 The \meta{scale} specifies by which factor should the message arrow be scaled. Influences all
621 arrows drawn in |msc| environment.
622 }
623
624 In Figure~\ref{fig:mscsomeExample} we see \MSC{} that shows an example of the use of messages.
625 In this sample \MSC{} and the following \MSC{}s in this section we will
626 not list the complete textual representations of the \MSC{}s. For brevity
627 we omit the environment call and the declarations of the instances.
628 Note the final |\nextlevel| command which is needed
629 to make the instance axis long enough to receive message
630 \verb+a+.
631
632 Figure~\ref{fig:refpoints:B} shows different options that can be used to
633 position label. We use the keys |pos|, |label position| and |side| to place
634 the labels. Additionally we use |/tikz/anchor| key, which is an alternative way
635 to specify the placement of the label (see PGF Manual~\cite{tantau2022pgf}).
636
637 \begin{figure}[htbp]
638 \begin{codeexample}[width=\linewidth-9.8cm]
639 \begin{msc}[small values,head top distance=0.8cm]{messages}
640 \declinst{i}{}{i}
641 \declinst{j}{}{j}
642 \declinst{k}{}{k}
643 \mess{a}{j}{i}[3]
644 \mess{self}{i}{i}[1]
645 \nextlevel
646 \mess*{b}{j}{k}
647 \mess[b]{c}{k}{envright}
648 \nextlevel
649 \mess{d}{k}[.6]{i}
650 \end{msc}
651 \end{codeexample}
652 \caption{Example showing msc messages}
653 \label{fig:mscsomeExample}
654 \end{figure}
655 %
656 \begin{figure}[htbp]
657 \begin{codeexample}[width=\linewidth-9.8cm]
658 \begin{msc}[small values]{Label reference points}
659 \declinst{m0}{I0}{}
660 \declinst{m1}{I1}{}
661 \declinst{m2}{I2}{}
662 \nextlevel
663
664 \mess[label position=above]{above}{m0}{m1}
665 \nextlevel
666 \mess[label position=below]{below}{m1}{m2}
667 \nextlevel[2]
668
669 \mess[anchor=south,pos=0.1]{south}{m1}{m0}
670 \nextlevel
671 \mess[anchor=north]{north}{m2}{m1}
672 \nextlevel[2]
673
674 \mess[label position=left]{left}{m0}{m0}[2]
675 \mess[side=right,pos=0.9]{right}{m2}{m2}[2]
676 \nextlevel[4]
677 \mess[label position=right]{right}{m0}{m0}[2]
678 \mess[left,side=right]{left}{m2}{m2}[2]
679 \nextlevel[6]
680
681 \mess[anchor=east]{east}{m0}{m0}[-2]
682 \mess[anchor=west,side=right]{west}{m2}{m2}[-2]
683 \nextlevel[4]
684 \mess[right]{right}{m0}{m0}[-2]
685 \mess[side=right,left]{left}{m2}{m2}[-2]
686 \nextlevel[2]
687
688 \mess[below left]{below left}{m0}{m1}[2]
689 \mess[above right]{above right}{m1}{m2}[2]
690 \nextlevel[6]
691
692 \mess[anchor=south west]{SW}{m1}{m0}[-2]
693 \mess[anchor=north east,pos=0]{NE}{m2}{m1}[-2]
694 \nextlevel[2]
695 \end{msc}
696 \end{codeexample}
697 \caption{Different placing the message labels}
698 \label{fig:refpoints:B}
699 \end{figure}
700
701 \subsection{Comments}
702 \label{comments}
703
704 Comments are additional texts to clarify (events on) an instance. The
705 following command can be used to add comments to an \MSC{} diagram.
706 \begin{command}{\msccomment\opt{\oarg{options}}\marg{text}\marg{instance}}
707
708 The \meta{instance} parameter defines the instance to which the
709 comment is attached. The text of the comment is specified by the
710 \meta{text} parameter and is processed in LR-mode.
711 The key |side| affect the horizontal position relative to its instance.
712 \end{command}
713 The following key affects the drawing of the comment:
714 \msckey{msccomment distance}{\meta{distance}}{
715 Specifies the \meta{distance} at which the comment will be placed from the
716 \meta{instance} instance.
717 }
718
719 The following diagram shows how to use comments. In this diagram we modify the
720 distance between the frame and the instances in order to fit the comments inside
721 the frame.
722 \begin{codeexample}[width=\linewidth-8.8cm]
723 \begin{msc}[small values,
724 left environment distance=2.6cm,
725 right environment distance=1.9cm]{comments}
726 \declinst{i}{}{i}
727 \declinst{j}{}{j}
728 \mess{a}{i}{j}[2]
729 \msccomment[msccomment distance=1.2cm]{start}{i}
730 \nextlevel[2]
731 \msccomment[side=right]{end}{j}
732 \nextlevel
733 \end{msc}
734 \end{codeexample}
735
736
737
738 \subsection{Actions}
739 \label{actions}
740 An instance can perform an action, which is denoted by a
741 rectangle. There are two commands to draw actions:
742 \begin{command}{\action\opt{*}\opt{\oarg{options}}\marg{name}\marg{instance}}
743 The action is attached at the current level to the \meta{instance}.
744 The \meta{name} is centered inside the action symbol and is processed
745 in LR-mode. The height and width of the action symbol are adjusted so that
746 the \meta{name} fits inside a rectangle.
747
748 The starred version of the command, |\action*|, produces the same
749 result as |\action|, except that the width of the action is not adjusted.
750
751 The following keys determine the detailed drawing of the action
752 symbol:
753 \msckey{action width}{\meta{width}}{Specifies the \meta{width} of the action symbol.}
754 \msckey{action height}{\meta{hegiht}}{Specifies the \meta{height} of the action symbol.}
755 \end{command}
756 \begin{command}{\naction\opt{*}\opt{\oarg{options}}\marg{name}\marg{instance}}
757 The |\naction| command produces an action box with a diagonal
758 cross in it. It is otherwise identical to the |\action| command.
759 \end{command}
760
761
762 The following example shows that after an action often a multiple level
763 increment is needed to obtain nice pictures.
764 \begin{codeexample}[width=\linewidth-8.8cm]
765 \begin{msc}[small values, instance distance=1.6cm]{action}
766 \declinst{i}{}{i}
767 \declinst{j}{}{j}
768 \mess{a}{j}{i}
769 \nextlevel
770 \naction{doit}{i}
771 \nextlevel[2]
772 \action*{doitnow}{i}
773 \nextlevel[2]
774 \mess{b}{i}{j}
775 \end{msc}
776 \end{codeexample}
777
778 \subsection{Timers}
779 \label{timers}
780 There are five commands to draw timer events.
781 \begin{command}{\settimer\opt{\oarg{options}}\marg{name}\marg{instance}}%
782 Setting of a timer is drawn as a line connecting the \meta{instance}
783 to the {\em hour glass} symbol. The \meta{name} is put near this
784 symbol. The key |side| is determines on which side of the instance axis the
785 timer is drawn. The key |self message width| determines the lenght of the arm
786 between the symbol and the instance axis. The key |label distance| determines
787 the distance between the name and the timer symbol. The key |arrow scale|
788 determines the scaling of the arrow.
789 {\em hour glass} symbol to the \meta{instance}.
790 \end{command}
791 \begin{command}{\timeout\opt{\oarg{options}}\marg{name}\marg{instance}}
792 A time-out is represented by an arrow from an
793 {\em hour glass} symbol to the \meta{instance}.
794 \end{command}
795 \begin{command}{\stoptimer\opt{\oarg{options}}\marg{name}\marg{instance}}
796 Stopping a timer is drawn as a line connecting the \meta{instance} with the timer stop
797 symbol (denoted by a cross).
798 \end{command}
799 \begin{command}{\settimeout\opt{\oarg{options}}\marg{name}\marg{instance}\opt{\oarg{offset}}}
800 The command |\settimeout| is a combination of the setting of a
801 timer and a time out. The \meta{offset} denotes the number of levels
802 between the two events.
803 \end{command}
804 \begin{command}{\setstoptimer\opt{\oarg{options}}\marg{name}\marg{instance}\opt{\oarg{offset}}}
805 Likewise, |\setstoptimer| is a combination
806 of the setting of a timer and stopping a timer.
807 \end{command}
808 \msckey{offset}{\meta{offset}}{
809 The key holds the value of \meta{offset}. It denotes the number of levels
810 between the two events.
811 }%
812 \msckey{timer width}{\meta{width}}{
813 The key determines the \meta{width} of the hour glass and the time out symbols.
814 }
815
816 The various timer symbols are shown in the following example.
817
818 \medskip
819 \begin{codeexample}[width=\linewidth-9.8cm]
820 \begin{msc}[small values]{timers}
821 \declinst{i}{}{i}
822 \declinst{j}{}{j}
823 \declinst{k}{}{k}
824 \settimer{T,50}{j}
825 \setstoptimer[r]{V}{k}[6]
826 \nextlevel[2]
827 \timeout{T}{j}
828 \settimeout{U}{i}
829 \nextlevel[2]
830 \settimer[r]{T,20}{j}
831 \nextlevel[2]
832 \stoptimer[r]{T}{j}
833 \end{msc}
834 \end{codeexample}
835
836 \subsection{Time measurements}
837 \label{measurements}
838 There are several commands to add time measurements to an \MSC{}.
839 \begin{command}{
840 \mscmark\opt{\oarg{options}}\marg{name}\marg{instance}
841 }
842 This command attach an absolute time stamp to an event on an \meta{instance}.
843 The \meta{name} is the text attached to the mark symbol, which is a dashed
844 polyline. The position of the mark is determined by the keys |position| (above,
845 below) and |side| (left,right).
846 \end{command}
847 \msckey{position}{\meta{position}}{
848 The key determines the position of the mark symbol relative to the marked
849 event. The allowed values for \meta{position} are |above|, |mid| and |below|.
850 }
851 \begin{command}{\measure\opt{*}\opt{\oarg{options}}\marg{name}\marg{instance1}\marg{instance2}\opt{\oarg{offset}}}
852 This command connects two events from \meta{instance1} and \meta{instance2}.
853 The first event is at the current level. The second event is \meta{offset}
854 levels lower than the first event. Not that instead giving optional argument
855 \meta{offset} we can specify the key |offset|. The \meta{name} is attached to
856 the measure symbol. The measure symbol can be placed ath the left or right of
857 \meta{instance1}. This is determined by the value of the key |side|. In the
858 starred version of the command arrow heads are at the outside of the measured
859 interval.
860 \end{command}
861 In case the two events are far apart, the measure may be split in two
862 parts. We use two commands to draw this parts:
863 \begin{command}{\measurestart\opt{*}\opt{\oarg{options}}\marg{name}\marg{instance}\marg{gate}}
864 Draws the first part of the measure. The points where these two parts should
865 be connected are drawn by a small cicle, to which the text \meta{gate} in
866 attached.
867 In the starred version of the command arrow heads are at the outside of the
868 measured interval.
869 \end{command}
870 \begin{command}{\measureend\opt{*}\opt{\oarg{options}}\marg{name}\marg{instance}\marg{gate}}
871 Draws the first part of the measure in similar way as |\measurestart| command.
872 \end{command}
873
874
875 Several keys can be used to control the detailed layout of the time measurement
876 symbols. The |label distance| key specify the distance between the label of a
877 measurement and the measurement symbol.
878 \msckey{measure distance}{\meta{distance}}{
879 This key specifies at which \meta{distance} the measurement symbols are drawn from the
880 \meta{instance} line.
881 }
882 \msckey{measure symbol width}{\meta{width}}{
883 Specifies the \meta{width} of the measurement triangle symbol.
884 }
885
886 The following example illustrates marks and measurements in an \MSC{}..
887 \begin{codeexample}[width=\linewidth-9.8cm]
888 \begin{msc}[small values]{Time measurements}
889 \declinst{i}{}{i}
890 \declinst{j}{}{j}
891 \declinst{k}{}{k}
892 \mess{m1}{i}{j}[1]
893 \mscmark{t=0.0}{i}
894 \measure{0.6}{i}{j}[4]
895 \nextlevel
896 \mscmark[position=above,side=right]{t=0.3}{j}
897 \nextlevel[3]
898 \mess{m2}{j}{k}
899 \measurestart*[side=right]{0.2}{k}{g}
900 \nextlevel[6]
901 \mess{m3}{k}{i}
902 \mscmark[position=below,side=left]{t=1.0}{i}
903 \measureend*[side=right]{0.2}{k}{g}
904 \nextlevel
905 \end{msc}
906 \end{codeexample}
907
908 \subsection{Lost and found messages}
909 \label{lostfound}
910 \begin{command}{\lost\opt{\oarg{options}}\marg{name}\marg{gate}\marg{instance}}
911 A lost message is denoted by an arrow starting at an instance and
912 ending at a filled circle.
913 The argument \meta{instance} determines the instance to which the
914 arrow is attached. The \meta{name} of the message is put above the
915 message arrow. The \meta{gate} is a text associated to the circle.
916 The keys |side|, |label position|, |pos|, |label distance| and
917 |self message width|
918 function in similar way as in the |\mess| command
919 (Section~\ref{messages}). That is, |side| controls the placement of the lost or
920 found message with respect to the instance axis. The |label position| and |pos|
921 controls the placement of the \meta{name} with respect to the message arrow.
922 The key |self message width| determines the length of the arrow and |label
923 distance| specifies the distance between the name and the arrow.
924 \end{command}
925 \begin{command}{\found\opt{\oarg{options}}\marg{name}\marg{gate}\marg{instance}}
926 A found message is denoted by an arrow starting at an open circle and ending at
927 an instance. Otherwise the command is identical to the |\lost| command.
928 \end{command}
929 \msckey{lost symbol radius}{\meta{radius}}{
930 Determines the \meta{radius} of the circle for lost and found messages.
931 }
932
933 The following example shows a found and a lost message.
934
935 \begin{codeexample}[width=\linewidth-9.8cm]
936 \begin{msc}[small values]{lost and found}
937 \declinst{i}{}{i}
938 \declinst{j}{}{j}
939 \found{m}{g}{i}
940 \nextlevel
941 \mess{p}{i}{j}
942 \nextlevel
943 \lost[side=right]{n}{}{j}
944 \end{msc}
945 \end{codeexample}
946
947
948 \subsection{Conditions}
949 \label{conditions}
950 There are two commands to draw condition boxes:
951 \begin{command}{\condition\opt{*}\opt{\oarg{options}}\marg{text}\marg{instance list}}
952 A condition is denoted by a hexagon. It is used to express that the
953 system has entered a certain state. A condition relates to a number of
954 instances. All conditions which take part in the condition are covered
955 by the condition symbol. The other instances are drawn through the
956 condition symbol.
957
958 The \meta{text} is placed in the center of the condition. The
959 \meta{instance list} expresses which instances take part in the
960 condition. It is a list of nicknames of instances, separated by
961 commas. Take care not to add extra white space around the nicknames,
962 since this is considered part of the nickname in \LaTeX.
963 The order in which the instances are listed is immaterial.
964
965 The starred version of the command |\condition*|, produces the same
966 result as the command |\condition|, except that the width of the
967 condition symbol is not adjusted to fit the contents of the hexagon.
968 \end{command}
969 \begin{command}{\ncondition\opt{*}\opt{\oarg{options}}\marg{text}\marg{instance list}}
970 The |\ncondition| command produces a condition with a diagonal
971 cross in it. It is otherwise identical to the |\condition| command.
972 \end{command}
973
974 There are several keys that controls the shape of the condition
975 symbol:
976 \msckey{condition height}{\meta{hegiht}}{
977 Determines the \meta{height} of the condition symbol.
978 }
979 \msckey{condition overlap}{\meta{distance}}{
980 The \meta{distance} determines the width of the part of the condition
981 symbol which extends over the rightmost/leftmost contained instance
982 axis.
983 }
984
985 The following example contains some conditions.
986 \begin{codeexample}[width=\linewidth-10.6cm]
987 \begin{msc}[small values]{conditions}
988 \declinst{i}{}{i}
989 \declinst{j}{}{j}
990 \declinst{k}{}{k}
991 \condition{some condition}{i,k}
992 \nextlevel[3]
993 \mess{m}{i}{j}
994 \action{a}{k}
995 \nextlevel
996 \condition{C}{i}
997 \ncondition{D}{j}
998 \nextlevel[2]
999 \condition{A, B, C}{i,j,k}
1000 \nextlevel[2]
1001 \end{msc}
1002 \end{codeexample}
1003
1004 \subsection{Generalized ordering}
1005 \label{ordering}
1006 A generalized order is treated much like a regular message (see
1007 Section~\ref{messages}). There
1008 are three differences: a generalized order is drawn with a
1009 dotted line, it has no label, and the arrow head is in the middle of
1010 the line. A generalized order is defined with the following command.
1011 \begin{command}{\order\opt{\oarg{options}}\marg{sender}\marg{receiver}\opt{\oarg{level offset}}}
1012 The \meta{sender} and \meta{receiver} are the nicknames of the
1013 instances which are connected by the generalized ordering symbol.
1014 At the \meta{receiver} instance, the generalized ordering symbol ends
1015 at the current level plus the \meta{level offset}. The
1016 \meta{level offset} is an optional integer value, with default 0.
1017
1018 In case \meta{sender} and \meta{receiver} denote the same instance,
1019 the order is a \emph{self order}. The placement of the order arrow of
1020 a self order is controlled by the key |side|. It
1021 can have values |left| (meaning that the ordering symbol is drawn
1022 left of the instance axis) and |right| (meaning that the ordering
1023 symbol is drawn right of the instance axis). By default it is drawn at
1024 the left side of the instance.
1025
1026 The position of the arrow is controlled with the |pos| key. The key |self
1027 message width| specify the width of the polyline used for drawing orderings on a
1028 single instance axis. The key |arrow scale| controls the size of the arrow.
1029
1030 Orderings to or from the environment (i.e.,\ the left or the right side
1031 of the \MSC{} frame) can be
1032 specified by setting the sender or the receiver argument to the value
1033 |envleft| or |envright|.
1034 \end{command}
1035
1036 An example of a generalized order is given in the following diagram.
1037 \begin{codeexample}[width=\linewidth-9.6cm]
1038 \begin{msc}[head top distance=0.8cm]
1039 {generalized order}
1040 \declinst{i}{}{i}
1041 \declinst{j}{}{j}
1042 \mess{m}{envleft}{i}
1043 \order{i}{j}[1]
1044 \nextlevel
1045 \mess{k}{j}{envright}
1046 \nextlevel
1047 \end{msc}
1048 \end{codeexample}
1049
1050 \subsection{Instance regions}
1051 \label{regions}
1052 A part of the instance axis can be drawn in a different style. Such a
1053 part is called an {\em instance region}. The following
1054 regions are supported:
1055 {\em coregion} (the instance axis is dashed, which means that the order of the
1056 attached instances is immaterial),
1057 {\em suspension region} (a small rectangle with dashed left and right
1058 sides, which denotes that the instance is suspended),
1059 {\em activation region} (a small filled rectangle, which denotes that
1060 the instance has control).
1061
1062 The following commands are used to draw an instance region.
1063 \begin{command}{\regionstart\opt{\oarg{options}}\marg{type}\marg{instance name}}
1064 After this command the instance axis of \meta{intstance name} is drawn in the
1065 shape determined by \meta{type} starting from the current level.
1066 The \meta{type} can have values |coregion|, |suspension|, and |activation|.
1067 \end{command}
1068 \begin{command}{\regionend\marg{instance name}}
1069 After this command the instance axis for the \meta{instance name} is drawn in
1070 the usual way. In other words it ends current region.
1071 \end{command}
1072 The following keys control the shape of on instance region:
1073 \msckey{region width}{
1074 Determines the \meta{width} of the coregion start and end symbol and the \meta{width} of the activation and suspension rectangle.
1075 }
1076
1077 In the following example, several instance regions are demonstrated.
1078 Note that the relative order of |\mess|, |\regionstart|, and
1079 |\regionend| commands does not matter. Also notice that the
1080 second activation region on~$i$ ends with a method reply
1081 (which is produced by the command |\mess*|).
1082
1083 \medskip
1084
1085 \begin{codeexample}[width=\linewidth-9.6cm]
1086 \begin{msc}[small values]{regions}
1087 \declinst{i}{}{i}
1088 \declinst{j}{}{j}
1089 \declinst{k}{}{k}
1090 \regionstart{activation}{i} \nextlevel[3]
1091 \regionend{i}
1092 \mess{m}{i}{j} \nextlevel
1093 \regionstart{coregion}{j} \nextlevel
1094 \regionstart{suspension}{k}
1095 \mess{p}{j}{k} \nextlevel
1096 \regionstart{activation}{i}
1097 \mess{q}{j}{i} \nextlevel
1098 \regionend{j} \nextlevel[3]
1099 \regionend{i}
1100 \mess*{r}{i}{j} \nextlevel
1101 \mess{s}{j}{k}
1102 \regionend{k} \nextlevel
1103 \end{msc}
1104 \end{codeexample}
1105
1106 \subsection{Instance creation and instance stop}
1107 \label{createstop}
1108 The \MSC{} language offers constructs for dynamic instance creation and
1109 instance destruction.
1110 An instance can dynamically create another instance by issuing a
1111 create command. An instance creation is drawn as a dashed message
1112 arrow. At the side of the arrow head, the instance head symbol for the
1113 created instance is drawn.
1114 An instance end symbol does not denote the end of the specified
1115 process, but merely the end of its current description. Therefore, a
1116 different symbol is needed which denotes that an instance stops before
1117 the end of the \MSC{} in which it is contained.
1118 The instance stop symbol is a cross.
1119
1120 The following commands are used for instance creation and instance
1121 stop.
1122 \begin{command}{\dummyinst\opt{\oarg{options}}\marg{created instance}}
1123 This command reserve space for on instance which will be created dynamically.
1124 |\dummyinst| command is mixed with the declarations of normal instances (see
1125 the |\declinst| command, Section~\ref{instances}). The argument \meta{created
1126 instance} is the nickname of the instance that will be created later.
1127 \end{command}
1128 \begin{command}{\startinst\opt{\oarg{options}}\marg{instance name}%
1129 \marg{text above}\marg{text inside}}
1130 This command create an instance. The created instance must have been declared
1131 first with the |\dummyinst| command. The name of the created instance consists
1132 of two parts. The part called \meta{text above} is placed above the instance
1133 head and the \meta{text inside} is centered within the instance head.
1134 \end{command}
1135 \begin{command}{\create\opt{\oarg{options}}\marg{name}\marg{creator}\marg{instance name}%
1136 \marg{text above}\marg{text inside}}
1137 This command is identical to |\startinst| command except it allows to specify
1138 the creator of the instance. The command results in a horizontal message arrow
1139 labelled with \meta{name}. The arrow starts at the current level at the
1140 instance with the nickname \meta{creator} and ends at the current level at the
1141 instance head of the instance with nickname \meta{instance name}.
1142 As with normal messages, placement of the message label is controlled by the
1143 keys |label position| and |pos|.
1144 \end{command}
1145 \begin{command}{\stop\opt*\opt{\oarg{options}}\marg{instance name}}
1146 An instance is stopped with the |\stop| command.
1147 The \meta{instance} is the nickname of the stopped instance. The
1148 instance axis is not drawn any further below the level at which the
1149 |\stop| command is issued. Also, the instance foot symbol is not
1150 drawn.
1151
1152 If the |\stop*| command is used, then the instance foot symbol is
1153 drawn instead of the stop symbol.
1154 \end{command}
1155 \msckey{stop width}{\meta{width}}{
1156 The \meta{width} determines the size of the stop symbol.
1157 }
1158
1159
1160 Take care not to specify any events on an instance which has not yet
1161 been created or which has already been stopped. However, it is possible
1162 to create an instance after it has stopped, as showed in the next example.
1163
1164 \begin{codeexample}[width=\linewidth-9.6cm]
1165 \begin{msc}[small values]{dynamic instances}
1166 \declinst{i}{}{j}
1167 \dummyinst{j}
1168 \declinst{k}{}{k}
1169
1170 \mess{p}{i}{k}
1171 \nextlevel[3]
1172 \create[label position=below]{kick}{k}{j}{}{j}
1173 \nextlevel[2]
1174 \stop*{k}
1175 \nextlevel
1176 \mess{ok}{j}{i}
1177 \nextlevel
1178 \stop{j}
1179 \nextlevel[2]
1180 \startinst{k}{}{again}
1181 \nextlevel[2]
1182 \end{msc}
1183 \end{codeexample}
1184
1185 \subsection{\MSC{} references}
1186 \label{references}
1187 Within an \MSC{} a reference to other \MSC{}s can be included. Such a
1188 reference is drawn as a rectangle with rounded corners, covering part
1189 of the \MSC{}. The following commands are used to draw \MSC{} references.
1190
1191 \begin{command}{\referencestart\opt{\oarg{options}}\marg{nickname}
1192 \marg{text}\marg{left instance}\marg{right instance}}
1193 The reference symbol starts at the level where the
1194 |\referencestart| command is used, and ends at the level where
1195 the corresponding |\referenceend| command occurs. These commands
1196 correspond if they have the same \meta{nickname}.
1197 The \meta{text} is
1198 placed in the center of the reference symbol. The reference covers all
1199 instances from \meta{leftinstance} to \meta{rightinstance}.
1200
1201 The left and right edge of the reference symbol are
1202 \meta{nickname}|left| and \meta{nickname}|right|, where \meta{nickname} is
1203 the nickname of the \MSC{} reference as defined in the
1204 |\referencestart| command.
1205 These names can be used at every place where the nickname of an
1206 instance is required, e.g.\ as the sender or receiver of a message.
1207 \end{command}
1208 \begin{command}{\referenceend\opt{\oarg{options}}\marg{nickname}}
1209 This command end the reference \meta{nickname} that has been started with the
1210 |\referencestart| command.
1211 \end{command}
1212 The following keys affect the drawing of reference symbol:
1213 \msckey{left reference overlap}{\meta{distance}}{
1214 Determines the \meta{distance} between the left edge of the reference symbol and the
1215 leftmost covered instance axis.
1216 }
1217 \msckey{right reference overlap}{\meta{distance}}{
1218 Determines the \meta{distance} between the right edge of the reference symbol and the
1219 rightmost covered instance axis.
1220 }
1221
1222 The following example shows the usage of references:
1223
1224 \begin{codeexample}[width=\linewidth-9.6cm]
1225 \begin{msc}[small values]{references}
1226 \declinst{i}{}{i}
1227 \declinst{j}{}{j}
1228 \declinst{k}{}{k}
1229 \mess{a}{j}{k}
1230 \nextlevel
1231 \referencestart{r}{a reference}{i}{j}
1232 \nextlevel
1233 \mess{b}{rright}{k}
1234 \nextlevel[2]
1235 \referenceend{r}
1236 \nextlevel[2]
1237 \referencestart{p}{another reference}{i}{k}
1238 \nextlevel
1239 \mess{c}{envright}{pright}
1240 \nextlevel[4]
1241 \referenceend{p}
1242 \end{msc}
1243 \end{codeexample}
1244
1245 \subsection{Inline expressions}
1246 \label{inlines}
1247 An inline expression is a part of an \MSC{} on which an operation is
1248 defined. A rectangle surrounds the part of the \MSC{} containing the
1249 operands. The operands are separated by horizontal dashed lines.
1250 The operator is placed in the upper left corner of the inline
1251 expression symbol.
1252 The following commands are used to draw inline expressions.
1253
1254 \begin{command}{\inlinestart\opt{\oarg{options}}\marg{nickname}\marg{operator}\marg{left instance}\marg{right instance}}
1255 Starts the inline expression at the current level. The inline expression
1256 spans over the instances from \meta{left instance} to \meta{right instance}.
1257 The \meta{operand} is placed in the upper left corner of the rectangle.
1258 %
1259 The left and right edge of the inline expression symbol are named
1260 \meta{nickname}|left| and \meta{nickname}|right|, where \meta{nickname} is
1261 the nickname of the inline expression as defined in the
1262 |\inlinestart| command.
1263 These names can be used at every place where the nickname of an
1264 instance is required, e.g.\ as the sender or receiver of a message.
1265 \end{command}
1266 \begin{command}{\inlineseparator\opt{\oarg{options}}\marg{nickname}}
1267 Draws a dashed line at the current level for the inline expression with
1268 nickname \meta{nickname}.
1269 \end{command}
1270 \begin{command}{\inlineend\opt{*}\opt{\oarg{options}}\marg{nickname}}
1271 Ends the inline expresion with the nickname \meta{nickname} at the current level.
1272 The command |\inlineend*| does the same as the command
1273 |\inlineend|, except that the bottom line of the rectangle is
1274 This is used to indicate that the operand is optional.
1275 dashed.
1276 \end{command}
1277
1278 \msckey{left inline overlap}{\meta{distance}}{
1279 Determines the \meta{distance} which is a distance between the left edge of the inline expression
1280 symbol and the leftmost included instance axis.
1281 }
1282 \msckey{right inline overlap}{\meta{distance}}{
1283 Determines the \meta{distance} which is a distance between the right edge of the inline expression
1284 symbol and the rightmost included instance axis.
1285 }
1286
1287 The following example shows how to draw inline expressions:
1288
1289 \begin{codeexample}[width=\linewidth-9.6cm]
1290 \begin{msc}[small values]{inline expressions}
1291 \declinst{i}{}{i}
1292 \declinst{j}{}{j}
1293 \declinst{k}{}{k}
1294 \inlinestart{exp1}{par}{i}{k} \nextlevel
1295 \mess{a}{k}{j} \nextlevel
1296 \inlinestart[left inline overlap=0.6cm]
1297 {exp2}{alt}{i}{j} \nextlevel[2]
1298 \mess{b}{j}{i} \nextlevel
1299 \inlineseparator{exp2} \nextlevel
1300 \mess{c}{j}{i} \nextlevel
1301 \inlineend{exp2} \nextlevel
1302 \inlineseparator{exp1} \nextlevel
1303 \mess{d}{j}{k} \nextlevel
1304 \inlineend{exp1} \nextlevel
1305 \inlinestart{exp3}{opt}{i}{j} \nextlevel
1306 \mess{e}{envright}{exp3right}
1307 \mess{e}{exp3right}{j} \nextlevel
1308 \mess{f}{j}{i} \nextlevel
1309 \inlineend*{exp3}
1310 \end{msc}
1311 \end{codeexample}
1312 %
1313 \subsection{Gates}
1314 \label{gates}
1315
1316 A gate determines a connection point for messages.
1317
1318 The following command can be used to draw gates.
1319
1320 \begin{command}{\gate\opt{*}\opt{\oarg{options}}\marg{gate name}\marg{instance name}}
1321 The unstarred version produces a normal (invisible) gate. The starred
1322 version produces a visible gate (a small dot). The gate is drawn at the
1323 current level at the instance \meta{instance name} (which can also be the
1324 left and right edge of e.g.\ an \MSC{} reference). The
1325 \meta{gate name} is attached to the gate. The positioning of the \meta{gate
1326 name} relative to the gate is determined by the keys |side| (|left| or
1327 |right|) and |position| (|above|, |mid| or |below|).
1328 \end{command}
1329
1330 There are several keys to control the size and shape of the gate symbol:
1331 \msckey{gate symbol radius}{\meta{radius}}{
1332 The \meta{radius} defines the radius of the gate symbol.
1333 }
1334
1335 The next example shows a number of gates.
1336 \begin{codeexample}[width=\linewidth-9.6cm]
1337 \begin{msc}[small values]{gates}
1338 \declinst{i}{}{i}
1339 \declinst{j}{}{j}
1340 \declinst{k}{}{k}
1341 \referencestart{r}{ref}{i}{j}
1342 \nextlevel
1343 \gate{$g$}{rright}
1344 \mess{b}{rright}{envright}
1345 \gate[r][c]{$h$}{envright}
1346 \nextlevel[2]
1347 \mess{c}{rright}{k}
1348 \gate*[l][b]{$h'$}{rright}
1349 \nextlevel[2]
1350 \referenceend{r}
1351 \end{msc}
1352 \end{codeexample}
1353
1354 \subsection{High-level \MSC{}s}
1355 \label{hmsc}
1356 A High-level \MSC{} (\HMSC{}) is a drawing which defines the relation between
1357 a number of \MSC{}s. It is composed of a start symbol (an upside down
1358 triangle), a number of end symbols (represented by triangles), a
1359 number of \MSC{} references (these are rectangles with rounded corners),
1360 a number of conditions (hexagons) and possibly several connection
1361 points (circles). These symbols are connected by arrows.
1362
1363 The following commands can be used to draw \HMSC{}s.
1364 \begin{environment}{{hmsc}\opt{\oarg{options}}\marg{hmsc name}\opt{(\meta{llx},\meta{lly})(\meta{urx},\meta{ury})}}
1365 In order to draw \HMSC{}s, a new environment is defined, which is called
1366 |hmsc|. The command to begin this environment has several
1367 arguments.
1368
1369 The header of an \HMSC{} is
1370 formed from the value of the key |hmsc keyword| (initially |hmsc|), followed by the
1371 \meta{hmsc name}. The positioning of the header depends on the key
1372 |title position|. The possible values are |left|, |right| and |center|. The
1373 keys |title top distance| and |title distance| control the distances of the
1374 header from the frame.
1375 The size of the \HMSC{} frame is calculated automatically unless the optional
1376 parameters (\meta{llx},\meta{lly}) and (\meta{urx},\meta{ury}) are specified. In
1377 such case the frame is determined by the
1378 coordinates of the lower-left corner,(\meta{llx},\meta{lly}) , and the
1379 coordinates of the upper-right corner, (\meta{urx},\meta{ury}).
1380 \msckey{hmsc keyword}{\meta{keyword}}%
1381 {The \meta{keyword} will be a starting word in a header of \HMSC{}.}
1382 \msckey{north hmsc margin}{\meta{distance}}%
1383 {The \meta{distance} determines the north margin of hmsc environment}
1384 \msckey{south hmsc margin}{\meta{distance}}%
1385 {The \meta{distance} determines the south margin of hmsc environment}
1386 \msckey{east hmsc margin}{\meta{distance}}%
1387 {The \meta{distance} determines the east margin of hmsc environment}
1388 \msckey{west hmsc margin}{\meta{distance}}%
1389 {The \meta{distance} determines the west margin of hmsc environment}
1390 \msckey{west hmsc margin}{\meta{distance}}%
1391 {The \meta{distance} determines the west margin of hmsc environment}
1392 \begin{stylekey}{/msc/hmsc margin=\meta{distance}}
1393 Sets the |north hmsc margin|, |south hmsc margin|, |west hmsc margin|,
1394 |east hmsc margin| to \meta{distance}.
1395 \end{stylekey}
1396 \end{environment}
1397 In the \HMSC{} we can draw number of symbols. Each symbol is in fact a \tikz{}
1398 node and \meta{options} can be used to specify for example the placement
1399 relative to the other nodes. The following commands are used to draw the symbols:
1400 \begin{command}{\hmscstartsymbol\opt{\oarg{options}}\marg{nicknamee}\opt{(\meta{x},\meta{y})}}
1401 Draws an equilateral triangle pointed down representing the start symbol. The
1402 \meta{nickname} can be used later as a reference to the drawn symbol. Optional
1403 \meta{x} and \meta{y} specify the coordinates at which the symbol should be
1404 drawn.
1405 \end{command}
1406 \begin{stylekey}{/msc/start symbol}
1407 A style that is applied to draw a triangle node in
1408 the |\hmscstartsymbol| command.
1409 \end{stylekey}
1410 \msckey{hmsc symbol width}{\meta{width}}{
1411 Sets the width of the triangle of the start and end symbol in hmsc to the \meta{width}.
1412 }
1413 \begin{command}{\hmscendsymbol\opt{\oarg{options}}\marg{nickname}\opt{(\meta{x},\meta{y})}}
1414 The command in identical to |\hmscstartsymbol| command but draws an
1415 equilateral triangle pointed up representing the start symbol.
1416 \end{command}
1417 \begin{stylekey}{/msc/end symbol}
1418 A style that is applied to draw a triangle node in
1419 the |\hmscendsymbol| command.
1420 \end{stylekey}
1421 \begin{command}{\hmscreference\opt{\oarg{options}}\marg{nickname}\marg{text}\opt{(\meta{x},\meta{y})}}
1422 Draws a \meta{text} inside a frame with rounded corners. The \meta{nickname}
1423 can be used later to connect it to other hmsc elements.
1424 \end{command}
1425 \begin{stylekey}{/msc/reference}
1426 A style that is applied to draw a reference node in the |\hmscreference| command.
1427 \end{stylekey}
1428 \msckey{reference height}{\meta{height}}%
1429 { Sets the minimal height of the reference to \meta{height}.}
1430 \msckey{reference width}{\meta{width}}%
1431 { Sets the minimal width of the reference to \meta{width}.}
1432 \begin{command}{\hmsccondion\opt{\oarg{options}}\marg{nickname}\marg{text}\opt{(\meta{x},\meta{y})}}
1433 Draws a \meta{text} inside a rectangular frame with diamond shaped sides. The \meta{nickname}
1434 can be used later to connect it to other hmsc elements.
1435 \end{command}
1436 \msckey{hmsc condition height}{\meta{height}}%
1437 { Sets the minimal height of the condition to \meta{height}.}
1438 \msckey{hmsc condition width}{\meta{width}}%
1439 { Sets the minimal width of the condition to \meta{width}.}
1440 \begin{command}{\hmscconnection\opt{\oarg{options}}\marg{nickname}\opt{(\meta{x},\meta{y})}}
1441 Draws a small circle symbolizing connection at coordinates
1442 (\meta{x},\meta{y}). Later we can refer to the connection using \meta{nickname}.
1443 \end{command}
1444 \msckey{hmsc connection radius}{\meta{distance}}%
1445 { Sets the radius of the connection symbol to the \meta{distance}}
1446
1447 The \HMSC{} grid is not drawn, but used to control the positioning of the
1448 \HMSC{} symbols (|startsymbol|, |endsymbol|, |reference|,
1449 |condition|, and |connection|).
1450 The center of each symbol is drawn on the grid point
1451 with coordinates (\meta{x},\meta{y}). Each symbol also has a \meta{nickname}
1452 for later reference.
1453
1454 \begin{verbatim}
1455 \hmscreference{nickname}{text}(x,y)
1456 \hmsccondition{nickname}{text}(x,y)
1457 \hmscconnection{nickname}(x,y)
1458 \arrow{from-nickname}[coord-list]{to-nickname}
1459 \end{verbatim}
1460
1461 \HMSC{} symbols can be connected by means of the \verb+arrow+ command.
1462 This draws an arrow from the symbol with nickname \verb+from-nickname+
1463 to the symbol with nickname \verb+to-nickname+. The optional argument
1464 \verb+coord-list+ can be used if the line connecting the source and
1465 the destination should not be straight. The \verb+coord-list+ has
1466 the following syntax: \verb+(x1,y1)(x2,y2)...(xk,yk)+. This means
1467 that the connecting line goes through the points with coordinates
1468 (x1,y1), (x2,y2), \ldots, (xk,yk).
1469
1470 Arrows always leave the start symbol at the bottom. They enter the end symbol
1471 at the top.
1472 Arrows start and end either at the middle of the top or at the middle
1473 of the bottom of a reference and condition symbol. The incoming
1474 (outgoing) direction of the arrow determines whether it will start
1475 (end) at the top or at the bottom.
1476
1477 There are several parameters to control the size and shape of the
1478 symbols (see Section~\ref{parameters}). These are
1479 \verb+\hmscconditionheight+ (the height of the condition symbol),
1480 \verb+\hmscconditionwidth+ (the width of the condition symbol,
1481 excluding the left and right angular parts),
1482 \verb+\hmscreferenceheight+ (the height of the reference symbol),
1483 \verb+\hmscreference width+ (the width of the reference symbol),
1484 \verb+\messarrowscale{size}+ (a command to set the size of the arrow
1485 head of a connection line);
1486 \verb+setconnectiontype(type)+ (set the shape of the polyline
1487 connection the symbols; \verb+type+ can be \verb+straight+,
1488 \verb+rounded+, and \verb+curved+),
1489 \verb+\startsymbolwidth+ (the width of the start and end symbol),
1490 \verb+\topnamedist+ (sets the distance between the top of the \HMSC{} frame
1491 and the \HMSC{} header).
1492
1493 An example of an \HMSC{} is in the following diagram. Notice that the
1494 width and height of reference symbols are changed locally (i.e.,
1495 between \verb+{+ and \verb+}+ braces) just before the big
1496 reference~\verb+b+ is defined.
1497
1498 \medskip
1499
1500 \noindent
1501 \begin{minipage}[c]{0.375\linewidth}
1502
1503 \begin{hmsc}{High level}(-3,0)(3,12)
1504 \hmscstartsymbol{s}(0,10)
1505 \hmscreference{a}{A}(0,9)
1506 \hmscconnection{c}(0,7.5)
1507 {
1508 \mscset{reference width=2cm}
1509 \mscset{reference height=2\baselineskip}
1510 % \setlength{\hmscreferencewidth}{2cm}
1511 % \setlength{\hmscreferenceheight}{3\baselineskip}
1512 \hmscreference{b}{\parbox{1.9cm}
1513 {\centering
1514 this is a big
1515 hmsc reference}
1516 }(0,6)
1517 }
1518 \hmsccondition{t}{Again}(1,4.25)
1519 \hmsccondition{ok}{Ok}(0,3.5)
1520 \hmsccondition{q}{\textit{Break}}(-2,3.5)
1521 \hmscendsymbol{e1}(-2,2)
1522 \hmscreference{do}{Do it!}(0,2)
1523 \hmscendsymbol{e2}(0,1)
1524
1525 \arrow{s}{a}
1526 \arrow{a}{c}
1527 \arrow{c}{b}
1528 \arrow{c}[(-2,7.5)]{q}
1529 \arrow{b}{q}
1530 \arrow{q}{e1}
1531 \arrow{b}{ok}
1532 \arrow{ok}{do}
1533 \arrow{do}{e2}
1534 \arrow{b}{t}
1535 \arrow{t}[(1,3.5)(2.5,3.5)(2.5,7.5)]{c}
1536 \end{hmsc}
1537 \end{minipage}\hfill
1538 \begin{minipage}[c]{0.6\linewidth}
1539 {\footnotesize
1540 \begin{verbatim}
1541 \begin{hmsc}{High level}(-3,0)(3,12)
1542 \hmscstartsymbol{s}(0,10)
1543 \hmscreference{a}{A}(0,9)
1544 \hmscconnection{c}(0,7.5)
1545 {\setlength{\hmscreferencewidth}{2cm}
1546 \setlength{\hmscreferenceheight}
1547 {3\baselineskip}
1548 \hmscreference{b}{\parbox{1.9cm}
1549 {\centering this is a big hmsc reference}
1550 }(0,6)}
1551 \hmsccondition{t}{Again}(1,4.5)
1552 \hmsccondition{ok}{Ok}(0,3.5)
1553 \hmsccondition{q}{\textit{Break}}(-2,3.5)
1554 \hmscendsymbol{e1}(-2,2)
1555 \hmscreference{do}{Do it!}(0,2)
1556 \hmscendsymbol{e2}(0,1)
1557 \arrow{s}{a}
1558 \arrow{a}{c}
1559 \arrow{c}{b}
1560 \arrow{c}[(-2,7.5)]{q}
1561 \arrow{b}{q}
1562 \arrow{q}{e1}
1563 \arrow{b}{ok}
1564 \arrow{ok}{do}
1565 \arrow{do}{e2}
1566 \arrow{b}{t}
1567 \arrow{t}[(1,3.5)(2.5,3.5)(2.5,7.5)]{c}
1568 \end{hmsc}
1569 \end{verbatim}
1570 }
1571 \end{minipage}
1572
1573
1574 \subsection{\MSC{} documents}
1575 \label{mscdoc}
1576 An \MSCdoc{} is a drawing which contains various declarations
1577 of objects used in the \MSC{} description. For drawing \MSCdoc{}s
1578 he following commands are provided.
1579
1580 \begin{verbatim}
1581 \begin{mscdoc}[headerpos]{mscdocname}{text}(llx,lly)(urx,ury)
1582 \end{mscdoc}
1583 \reference{text}(x,y)
1584 \separator{y}
1585 \end{verbatim}
1586
1587 As for \MSC{} and \HMSC{}, a new environment is defined, which is named
1588 \verb+mscdoc+. The command to begin an \MSCdoc{} has several
1589 arguments. The argument \verb+headerpos+ is optional. It controls
1590 positioning of the header of the \MSCdoc{}.
1591 This argument can have values
1592 \verb+l+ (for a left aligned header), \verb+c+ (for a centered header)
1593 and \verb+r+ (for a right aligned header).
1594 The header of an \MSCdoc{} is formed from the keyword \verb+mscdocument+,
1595 followed by the \verb+mscdocname+.
1596 The \verb+text+ is placed left-aligned below the \MSCdoc{} header.
1597 The size of the \MSCdoc{} frame is determined by
1598 coordinates of the lower-left corner, \verb+(llx,lly)+, and the
1599 coordinates of the upper-right corner, \verb+(urx,ury)+.
1600
1601 The \MSCdoc{} grid is not drawn, but used to control the positioning of the
1602 \MSC{} references.
1603 The center of such a reference is drawn on the grid point
1604 with coordinates \verb+{x,y}+.
1605
1606 The \verb+separator+ command draws a dashed horizontal line. The \MSC{}
1607 references above the separator are the exported, while the ones below
1608 the separator are local.
1609
1610 There are several parameters to control the size and shape of the
1611 symbols (see Section~\ref{parameters}).
1612 \verb+\mscdocreferenceheight+ (the height of the reference symbol),
1613 \verb+\mscdocreferencewidth+ (the width of the reference symbol),
1614 \verb+\topnamedist+ (sets the distance between the top of the \MSCdoc{}
1615 frame and the \MSCdoc{} header).
1616
1617 An example of an \MSCdoc{} is in the following diagram. Notice that
1618 the size of references in an \MSCdoc{} had to be changed for the last
1619 reference.
1620
1621 \medskip
1622
1623
1624 \begin{minipage}{0.4\linewidth}
1625 \begin{mscdoc}{My declarations}%
1626 (0,0)(6,8)
1627 \reference{a}(1,6)
1628 \reference{b}(3,6)
1629 \reference{c}(1,4)
1630 \reference{d}(3,4)
1631 \separator{3}
1632 \mscset{reference width=4.5cm}
1633 \mscset{reference height=2\baselineskip}
1634 \reference{%
1635 \parbox{4cm}%
1636 {\raggedright This is a
1637 two-line reference}}
1638 (3,1.5)
1639 \end{mscdoc}
1640 \end{minipage}
1641 %
1642 \begin{minipage}{0.5\linewidth}
1643 {\small
1644 \begin{verbatim}
1645 \begin{mscdoc}{My declarations}%
1646 (0,0)(6,8)
1647 \reference{a}(1,6)
1648 \reference{b}(3,6)
1649 \reference{c}(1,4)
1650 \reference{d}(3,4)
1651 \separator{3}
1652 \mscset{reference width=4.5cm}
1653 \mscset{reference height=2\baselineskip}
1654 \reference{%
1655 \parbox{4cm}%
1656 {\raggedright This is a
1657 two-line reference}}
1658 (3,1.5)
1659 \end{mscdoc}
1660 \end{verbatim}
1661 }
1662 \end{minipage}
1663
1664
1665
1666 \section{Style parameters}
1667 \label{parameters}
1668 \definecolor{markColor}{rgb}{0.10,0.10,0.9}
1669
1670 \makeatletter
1671 \NewDocumentCommand{\measureMark}{%
1672 s % arrows outside the measured distance
1673 D<>{1.5pt} % offset of marks
1674 O{.75cm} % offset of label
1675 m % first point
1676 m % second point
1677 m % label
1678 D<>{o} % () coordinates -> angle
1679 % h -> horizontal,
1680 % v -> vertical
1681 % o or what ever -> oblique
1682 O{} % options for tikzset
1683 }{%
1684
1685 {\tikzset{#8}
1686
1687 \coordinate (@1) at #4 ;
1688 \coordinate (@2) at #5 ;
1689
1690 \if #7v % vertical
1691 \coordinate (@0) at ($($#4!.5!#5$) + (#3,0)$) ;
1692 \coordinate (@4) at (@0|-@1) ;
1693 \coordinate (@5) at (@0|-@2) ;
1694 \else
1695 \if #7h % horizontal
1696 \coordinate (@0) at ($($#4!.5!#5$) + (0,#3)$) ;
1697 \coordinate (@4) at (@0-|@1) ;
1698 \coordinate (@5) at (@0-|@2) ;
1699 \else % cotation encoche
1700 \ifnum\pdfstrcmp{\unexpanded\expandafter{\@car#7\@nil}}{(}=\z@
1701 \coordinate (@5) at ($#7!#3!#5$) ;
1702 \coordinate (@4) at ($#7!#3!#4$) ;
1703 \else % cotation oblique
1704 \coordinate (@5) at ($#5!#3!90:#4$) ;
1705 \coordinate (@4) at ($#4!#3!-90:#5$) ;
1706 \fi\fi\fi
1707
1708 \draw[dotted,very thin,shorten >= #2,shorten <= -2*#2] (@4) -- #4 ;
1709 \draw[dotted,very thin,shorten >= #2,shorten <= -2*#2] (@5) -- #5 ;
1710
1711 \IfBooleanTF #1 {% with star
1712 \draw[measureMark arrow,-,draw=none] (@4) -- (@5)
1713 node[measureMark node] {#6\strut};
1714 \draw[measureMark arrow,<-] (@4) -- ($(@4)!-2pt!(@5)$) ;
1715 \draw[measureMark arrow,<-] (@5) -- ($(@5)!-2pt!(@4)$) ;
1716 }{% without star
1717 \ifnum\pdfstrcmp{\unexpanded\expandafter{\@car#7\@nil}}{(}=\z@
1718 \draw[measureMark arrow] (@5) to[bend right]
1719 node[measureMark node] {#6\strut} (@4) ;
1720 \else
1721 \draw[measureMark arrow] (@4) -- (@5)
1722 node[measureMark node] {#6\strut};
1723 \fi
1724 }}
1725 }
1726 \makeatother
1727
1728 By means of a collection of parameters, the graphical appearance of
1729 an \MSC{} can be fine tuned to the user's taste.
1730 The general parameters
1731 are displayed in Figure~\ref{parametersfig} on page~\pageref{parametersfig}.
1732 %
1733 % %========================
1734 \begin{figure}[htb]
1735 \begin{msc}[right environment distance=2.3cm]{Lengths}
1736 \tikzset{%
1737 measureMark node/.style={%
1738 midway,
1739 sloped,
1740 fill=white,
1741 text = markColor,
1742 font=\footnotesize,
1743 inner sep=1.5pt,
1744 outer sep=2pt
1745 },
1746 measureMark arrow/.style={%
1747 <->,
1748 >=latex,
1749 very thin,dashed
1750 },
1751 dimen/.style={<->,>=latex,thin,every rectangle node/.style={fill=white,midway,font=\sffamily}},
1752 symmetry/.style={dashed,thin},
1753 }
1754 \declinst{m1}{aname}{iname}
1755 \declinst{st}{}{}
1756 \declinst{m2}{}{}
1757
1758 \mess{msg1}{m1}{st}
1759 \nextlevel
1760 \mess{msg2}{m1}{st}
1761 \nextlevel
1762 \mess{self}{m1}{m1}
1763 \coregionstart{m2}
1764 \nextlevel[2]
1765 \coregionend{m2}
1766 \nextlevel
1767 \lost[r]{x}{}{m2}
1768 \stop{st}
1769 \settimer{T}{m1}
1770 \nextlevel
1771 \inlinestart[left inline overlap=0.9cm,right inline overlap=0.5cm]{alt}{alt}{m1}{m1}
1772 \nextlevel[2]
1773 \inlineend{alt}
1774 \action{a}{m2}
1775 \nextlevel
1776 \referencestart{ref}{\small reference}{m1}{m1}
1777 \nextlevel
1778 \referenceend{ref}
1779 \nextlevel
1780 \gate*{}{m1}
1781 \nextlevel
1782 \condition{cond1}{m1,m2}
1783 \nextlevel[3]
1784 \mess{msg3}{m2}{m1}
1785 \makeatletter
1786 \msc@endmsc[]
1787 \makeatother
1788
1789 \measureMark*[-2.5cm]{($(msc@env@nw)+(\mscget{title distance},0cm)$)}{($(msc@env@nw)+
1790 (\mscget{title distance},-\mscget{title top distance})$)}%
1791 {title top distance}%
1792 [measureMark node/.append style={above right=-36pt and -2pt,rotate=90}]
1793
1794 \measureMark*[-0.8cm]{($(msc@env@nw)+(0cm,-\mscget{title top distance}-1em)$)}{($(msc@env@nw)+
1795 (\mscget{title distance},-\mscget{title top distance}-1em)$)}%
1796 {title distance}[measureMark node/.append style={left=6pt}]
1797
1798 \measureMark*[-1.1cm]{([email protected])}{($([email protected])+ (0cm,\mscget{label distance})$)}%
1799 {label distance}[measureMark node/.append style={above left=6pt and 9pt,rotate=-90}]
1800
1801 \measureMark*[-1.6cm]{($(msc@level2-|msc@nodem1)+(1.5cm,0)$)}
1802 {($(msc@level2-|msc@nodem1)+ (1.5cm,\mscget{label distance})$)}%
1803 {label distance}[measureMark node/.append style={above left=6pt and 9pt,rotate=-90}]
1804
1805 \measureMark[0.0cm]{($(msc@env@nw)+(4cm,0)$)}{([email protected])}%
1806 {head top distance}<v>[measureMark node/.append style={right=0pt,rotate=90}]
1807
1808 \measureMark[0.2cm]{($(msc@env@nw)+(0,-3cm)$)}{([email protected])}%
1809 {left environment distance}<h>[measureMark node/.append style={above left=0pt and -7pt}]
1810
1811 \measureMark[1.0cm]{($([email protected])+(-\mscget{self message
1812 width},-2.4cm)$)}{($([email protected])+(0cm,-2.4cm)$)}%
1813 {self message width}<h>[measureMark node/.append style={left=8pt}]
1814
1815 \measureMark*[0.21cm]{($([email protected])+(-\mscget{self message width}-
1816 \mscget{timer width}/2,-2.9cm)$)}
1817 {($([email protected])+(-\mscget{self message width}+\mscget{timer width}/2,-2.9cm)$)}%
1818 {timer width}<h>[measureMark node/.append style={left=7pt,yshift=1pt}]
1819
1820 \measureMark[0.17cm]{($(msc@level8-|msc@nodem1)+(-0.9cm,-10pt)$)}
1821 {($(msc@level8-|msc@nodem1)+(0,-10pt)$)}%
1822 {left inline overlap}<h>[measureMark node/.append style={left=12pt}]
1823
1824 \measureMark[0.17cm]{($(msc@level8-|msc@nodem1)+(0.5cm,-2pt)$)}
1825 {($(msc@level8-|msc@nodem1)+(0,-2pt)$)}%
1826 {right inline overlap}<h>[measureMark node/.append style={right=6pt}]
1827
1828 \measureMark[0.0cm]{($(msc@level11-|msc@nodem1)+(-\mscget{left reference overlap},4pt)$)}
1829 {($(msc@level11-|msc@nodem1)+(0,4pt)$)}%
1830 {left reference overlap}<h>[measureMark node/.append style={left=14pt}]
1831
1832 \measureMark*[-0.2cm]{($(msc@level12-|msc@nodem1)+(0,\mscget{gate symbol radius})$)}
1833 {($(msc@level12-|msc@nodem1)$)}%
1834 {gate symbol radius}<v>[measureMark node/.append style={left=1pt,rotate=90}]
1835
1836 \measureMark[-0.3cm]{($(msc@level17-|msc@nodem1)+(-\mscget{instance width}/2,0pt)$)}
1837 {($(msc@level17-|msc@nodem1)+(\mscget{instance width}/2,0pt)$)}%
1838 {instance width}<h>[measureMark node/.append style={below=0pt}]
1839
1840 \measureMark[0.2cm]{(msc@level0-|msc@nodest)}
1841 {(msc@level1-|msc@nodest)}%
1842 {first level height}<v>[measureMark node/.append style={align=left,right=0pt,rotate=90}]
1843
1844 \measureMark[0.2cm]{(msc@level1-|msc@nodest)}
1845 {(msc@level2-|msc@nodest)}%
1846 {level height}<v>[measureMark node/.append style={align=left,right=0pt,rotate=90}]
1847
1848 \measureMark[0.2cm]{([email protected] east)}
1849 {([email protected] east)}%
1850 {head height}<v>[measureMark node/.append style={align=left,right=0pt,rotate=90}]
1851
1852 \measureMark[0.2cm]{($(msc@level3-|msc@nodem2)+(\mscget{region width}/2,0)$)}
1853 {($(msc@level3-|msc@nodem2)+(-\mscget{region width}/2,0)$)}%
1854 {region width}<h>[measureMark node/.append style={align=left,right=5pt}]
1855
1856 \measureMark*[0.2cm]{($(msc@level6-|msc@nodem2)+(\mscget{self message width},\mscget{lost symbol radius})$)}
1857 {($(msc@level6-|msc@nodem2)+(\mscget{self message width},0pt)$)}%
1858 {lost symbol radius}<v>[measureMark node/.append style={align=left,right=0pt,rotate=90}]
1859
1860 \measureMark[-0.2cm]{($(msc@level6-|msc@nodest)+(-\mscget{stop width}/2,-\mscget{stop width}/2)$)}
1861 {($(msc@level6-|msc@nodest)+(\mscget{stop width}/2,-\mscget{stop width}/2)$)}%
1862 {stop width}<h>[measureMark node/.append style={align=left,right=7pt}]
1863
1864 \measureMark[-0.2cm]{($(msc@level4-|msc@nodem1)$)}
1865 {($(msc@level4-|msc@nodest)$)}%
1866 {instance\\ distance}<h>[measureMark node/.append style={align=left,fill=none,yshift=-1pt}]
1867
1868 \measureMark[0.2cm]{($(msc@level9-|msc@nodem2)+(-\mscget{action width}/2,0)$)}
1869 {($(msc@level9-|msc@nodem2)+(\mscget{action width}/2,0)$)}%
1870 {action width}<h>[measureMark node/.append style={align=left,above=-1pt,xshift=3pt}]
1871
1872 \measureMark[0.2cm]{($(msc@level9-|msc@nodem2)+(\mscget{action width}/2,0)$)}
1873 {($(msc@level9-|msc@nodem2)+(\mscget{action width}/2,-\mscget{action height})$)}%
1874 {action height}<v>[measureMark node/.append style={align=left,right=1pt,rotate=90}]
1875
1876 \measureMark[0.5cm]{($(msc@level13-|msc@nodem2)+(\mscget{condition overlap},0)$)}
1877 {($(msc@level13-|msc@nodem2)+(\mscget{condition overlap},-\mscget{condition height})$)}%
1878 {condition height}<v>[measureMark node/.append style={align=left,right=1pt,rotate=90}]
1879
1880 \measureMark[0.2cm]{($(msc@level13-|msc@nodem2)+(\mscget{condition overlap},0)$)}
1881 {($(msc@level13-|msc@nodem2)+(0,0pt)$)}%
1882 {right condition overlap}<h>[measureMark node/.append style={align=left,above=-1pt}]
1883
1884 \measureMark<2pt>[0.2cm]{($(msc@level13-|msc@nodem2)+(\mscget{condition overlap},0)$)}
1885 {($(msc@level13-|msc@nodem2)+(0,0pt)$)}%
1886 {right condition overlap}<h>[measureMark node/.append style={align=left,above=-1pt}]
1887
1888 \measureMark<2pt>[0.2cm]{($(msc@level16-|msc@nodem2)+(0,0)$)}
1889 {($(msc@level17-|msc@nodem2)+(0,0pt)$)}%
1890 {last level height}<v>[measureMark node/.append style={align=left,right=-2pt,rotate=90}]
1891
1892 \measureMark*[0.2cm]{($(msc@level17-|msc@nodem2)+(\mscget{instance width}/2,0)$)}
1893 {($(msc@level17-|msc@nodem2)+(\mscget{instance width}/2,-\mscget{foot height})$)}%
1894 {foot height}<v>[measureMark node/.append style={align=left,right=1pt,rotate=90}]
1895
1896 \measureMark<0pt>[0.0cm]{($(msc@level17-|msc@nodem2)+(0.3cm,-\mscget{foot height})$)}
1897 {($(msc@env@se-|msc@nodem2)+(0.3cm,0)$)}%
1898 {foot distance}<v>[measureMark node/.append style={align=left,left=-1pt,rotate=90}]
1899
1900 \measureMark[0.2cm]{($(msc@env@se)+(0,7.5cm)$)}{([email protected])}%
1901 {right\\ environment\\ distance}<h>[measureMark node/.append style={align=left,right=33pt}]
1902
1903 \mscset{draw frame=none,msc keyword={},msc/name={}}
1904 \end{msc}
1905
1906 \caption{User controllable parameters}
1907 \label{parametersfig}
1908 \end{figure}
1909 %
1910 % The value of a parameter can be changed using standard
1911 % \LaTeX\ commands, e.g.
1912 % \begin{verbatim}
1913 % \setlength{\levelheight}{1cm}
1914 % \end{verbatim}
1915 %
1916 % The following list describes all parameters.
1917 % The default values for drawing \MSC{}s at large, normal and small size are
1918 % included. See the command \verb+\setmscvalues{size}+ below for
1919 % restoring the parameters to their original values.
1920 %
1921 % %========================
1922 % \begin{defs}
1923 %
1924 % \item[\cmd{actionheight}]
1925 % Height of action symbols.\\
1926 % (\lnsvalue{0.75}{0.6}{0.5} cm.)
1927 %
1928 % \item[\cmd{actionwidth}]
1929 % Width of action symbol.\\
1930 % (\lnsvalue{1.25}{1.25}{1.2} cm.)
1931 %
1932 % \item[\cmd{bottomfootdist}]
1933 % Distance between bottom of foot symbol and frame.\\
1934 % (\lnsvalue{1.0}{0.7}{0.5} cm.)
1935 %
1936 % \item[\cmd{commentdist}]
1937 % Distance between a comment and its instance.\\
1938 % (\lnsvalue{0.5}{0.5}{0.5} cm.)
1939 %
1940 % \item[\cmd{conditionheight}]
1941 % Height of condition symbols.\\
1942 % (\lnsvalue{0.75}{0.6}{0.5} cm.)
1943 %
1944 % \item[\cmd{conditionoverlap}]
1945 % Overlap of condition symbol.\\
1946 % (\lnsvalue{0.6}{0.5}{0.4} cm.)
1947 %
1948 % \item[\cmd{envinstdist}]
1949 % Distance between environments and nearest instance line.\\
1950 % (\lnsvalue{2.5}{2.0}{1.2} cm.)
1951 %
1952 % \item[\cmd{firstlevelheight}] Height of level just below head
1953 % symbols. Should not be changed inside the \MSC{} environment.\\
1954 % (\lnsvalue{0.75}{0.6}{0.4} cm.)
1955 %
1956 % \item[\cmd{gatesymbolradius}] Radius of the gate symbol.\\
1957 % (\lnsvalue{0.5}{0.5}{0.5} mm.)
1958 %
1959 % \item[\cmd{hmscconditionheight}]
1960 % Height of \HMSC{} condition symbol.\\
1961 % (\lnsvalue{0.375}{0.3}{0.25} cm.)
1962 %
1963 % \item[\cmd{hmscconditionwidth}]
1964 % Width of \HMSC{} condition symbol.\\
1965 % (\lnsvalue{1.0}{0.8}{0.7} cm.)
1966 %
1967 % \item[\cmd{hmscconnectionradius}]
1968 % Radius of \HMSC{} connection symbol.\\
1969 % (\lnsvalue{0.06}{0.05}{0.04} cm.)
1970 %
1971 % \item[\cmd{hmscreferenceheight}]
1972 % Height of \HMSC{} reference symbol.\\
1973 % (\lnsvalue{0.375}{0.3}{0.25} cm.)
1974 %
1975 % \item[\cmd{hmscreferencewidth}]
1976 % Width of \HMSC{} reference symbol.\\
1977 % (\lnsvalue{1.0}{0.8}{0.7} cm.)
1978 %
1979 % \item[\cmd{hmscstartsymbolwidth}]
1980 % Width of \HMSC{} start symbol.\\
1981 % (\lnsvalue{0.75}{0.6}{0.3} cm.)
1982 %
1983 % \item[\cmd{inlineoverlap}]
1984 % Overlap of inline symbol.\\
1985 % (\lnsvalue{1.5}{1.0}{0.75} cm.)
1986 %
1987 % \item[\cmd{instbarwidth}]
1988 % Default width of vertical instance bars (applies to fat instances only).\\
1989 % (\lnsvalue{0.0}{0.0}{0.0} cm.)
1990 %
1991 % \item[\cmd{instdist}]
1992 % Distance between instance axes.\\
1993 % (\lnsvalue{3.0}{2.2}{1.5} cm.)
1994 %
1995 % \item[\cmd{instfootheight}] Height of foot symbols. Should not be
1996 % changed inside the \MSC{} environment.\\
1997 % (\lnsvalue{0.25}{0.2}{0.15} cm.)
1998 %
1999 % \item[\cmd{instheadheight}] Height of head symbols. Should not be
2000 % changed inside the \MSC{} environment.\\
2001 % (\lnsvalue{0.6}{0.55}{0.5} cm.)
2002 %
2003 % \item[\cmd{instwidth}]
2004 % Width of header and foot symbols.\\
2005 % (\lnsvalue{1.75}{1.6}{1.2} cm.)
2006 %
2007 % \item[\cmd{labeldist}]
2008 % Distance between labels and the symbols to which they belong (for instance, message labels and arrows).\\
2009 % (\lnsvalue{1.0}{1.0}{1.0} ex.)
2010 %
2011 % \item[\cmd{lastlevelheight}] Height of level just above foot
2012 % symbols. Should not be changed inside the \MSC{} environment.\\
2013 % (\lnsvalue{0.5}{0.4}{0.3} cm.)
2014 %
2015 % \item[\cmd{leftnamedist}] Distance between left of the frame and
2016 % (left of) \MSC, \HMSC, or \MSCdoc{} title.\\
2017 % (\lnsvalue{0.3}{0.2}{0.1} cm.)
2018 %
2019 % \item[\cmd{levelheight}]
2020 % Height of a level.\\
2021 % (\lnsvalue{0.75}{0.5}{0.4} cm.)
2022 %
2023 % \item[\cmd{lostsymbolradius}]
2024 % Radius of the lost and found symbols.\\
2025 % (\lnsvalue{0.15}{0.12}{0.08} cm.)
2026 %
2027 % \item[\cmd{markdist}]
2028 % Horizontal distance from a mark to its instance.\\
2029 % (\lnsvalue{1.0}{1.0}{1.0} cm.)
2030 %
2031 % \item[\cmd{measuredist}]
2032 % Horizontal distance from a measure to its (closest) instance.\\
2033 % (\lnsvalue{1.0}{1.0}{1.0} cm.)
2034 %
2035 % \item[\cmd{measuresymbolwidth}]
2036 % Width of a measure symbol.\\
2037 % (\lnsvalue{0.75}{0.6}{0.4} cm.)
2038 %
2039 % \item[\cmd{mscdocreferenceheight}]
2040 % Height of reference symbol in an \MSCdoc.\\
2041 % (\lnsvalue{0.375}{0.3}{0.25} cm.)
2042 %
2043 % \item[\cmd{mscdocreferencewidth}]
2044 % Width of reference symbol in an \MSCdoc.\\
2045 % (\lnsvalue{1.0}{0.8}{0.7} cm.)
2046 %
2047 % \item[\cmd{referenceoverlap}]
2048 % Overlap of reference symbol.\\
2049 % (\lnsvalue{1.5}{1.0}{0.75} cm.)
2050 %
2051 % \item[\cmd{regionbarwidth}]
2052 % Width of region bars.\\
2053 % (\lnsvalue{0.5}{0.4}{0.2} cm.)
2054 %
2055 % \item[\cmd{selfmesswidth}]
2056 % Length of horizontal arms of self messages.\\
2057 % (\lnsvalue{0.75}{0.6}{0.4} cm.)
2058 %
2059 % \item[\cmd{stopwidth}]
2060 % Width of the stop symbol.\\
2061 % (\lnsvalue{0.6}{0.5}{0.3} cm.)
2062 %
2063 % \item[\cmd{timerwidth}]
2064 % Width of the \emph{timer} symbols.\\
2065 % (\lnsvalue{0.4}{0.3}{0.2} cm.)
2066 %
2067 % \item[\cmd{topheaddist}]
2068 % Distance between top of head symbols and frame.\\
2069 % (\lnsvalue{1.5}{1.3}{1.2} cm.)
2070 %
2071 % \item[\cmd{topnamedist}] Distance between top of the frame and
2072 % (top of) \MSC, \HMSC, or \MSCdoc{} title.\\
2073 % (\lnsvalue{0.3}{0.2}{0.2} cm.)
2074 %
2075 % \end{defs}
2076 %
2077 % In addition there are several commands which allow the user to adjust
2078 % the \MSC{} drawing to his own taste.
2079 %
2080 % \begin{defs}
2081 %
2082 % \item[\cmd{messarrowscale}\{\emph{scalefactor}\}] Sets the scale
2083 % factor (a positive real number) of message arrow
2084 % heads. (\lnsvalue{2}{1.5}{1.2})
2085 %
2086 % \item[\cmd{setmscscale}\{\emph{scalefactor}\}] Sets the scale factor
2087 % of the \MSC{} environment to \emph{scalefactor}. the scale factor is
2088 % supposed to be a real number. Scaling is done when the \MSC{}
2089 % environment ends (\verb|\end{msc}|). The default of \emph{scalefactor}
2090 % is~1. A more consistent way for
2091 % varying the size of the \MSC{} can be obtained by using the
2092 % \verb+\setmesvalues+ command as described below.
2093 % (default value 1.)
2094 %
2095 % \item[\cmd{psset}\{\texttt{linewidth=D}\}] This command sets the width
2096 % of all lines in \MSC{}s, \HMSC{}s, and \MSCdoc{}s to length \verb+D+. If
2097 % this command is issued outside the msc environment, then the value is
2098 % set for the complete document. If it is used directly after the start
2099 % of the msc environment it only holds for this \MSC{}.\\
2100 % (large/normal/small value 0.8/0.7/0.6 pt.)
2101 %
2102 % \item[\cmd{setfootcolor}\{\emph{color}\}] Sets the color of the foot
2103 % symbols of \MSC{} instances. Possible values are \emph{black},
2104 % \emph{white}, \emph{gray}, or \emph{lightgray}. For more color values,
2105 % see the documentation of the \LaTeXe{} \textsf{color} package.
2106 %
2107 % \end{defs}
2108 %
2109 % The following command can be used to set the above mentioned
2110 % style parameters to suitable values.
2111 %
2112 % \begin{defs}
2113 % \item[\cmd{setmscvalues}\{\emph{size}\}] Sets all parameters of the \mscpack{} to
2114 % predefined values. Valid values for \emph{size} are:
2115 % \verb|small|, \verb|normal|, and \verb|large|.
2116 % (The default value of \verb+size+ is \verb+normal+.
2117 % This can be used for drawings with at maximum six instances on a
2118 % sheet of A4 paper.
2119 % For sizes \verb+large+ and \verb+small+, a maximum of four and nine
2120 % instances respectively fit on a sheet of A4 paper.)
2121 % \end{defs}
2122 %
2123 % Caution has to be taken when changing the value of a parameter within
2124 % the \MSC{} definition. The following parameters can be changed within an
2125 % \MSC{} definition without unexpected side effects:
2126 %
2127 % \begin{flushleft}
2128 % \verb+\actionheight+,
2129 % \verb+\actionwidth+,
2130 % \verb+\bottomfootdist+,
2131 % \verb+\conditionheight+,
2132 % \verb+\conditionoverlap+,
2133 % \verb+\inlineoverlap+,
2134 % \verb+\instfootheight+,
2135 % \verb+\instwidth+ (however, this may cause different sizes of
2136 % corresponding instance header and footer symbols),
2137 % \verb+\labeldist+,
2138 % \verb+\lastlevelheight+,
2139 % \verb+\levelheight+,
2140 % \verb+\lostsymbolradius+,
2141 % \verb+\referenceoverlap+,
2142 % \verb+\regionbarwidth+,
2143 % \verb+\selfmesswidth+,
2144 % \verb+\stopwidth+,
2145 % \verb+\timerwidth+, and
2146 % \verb+\topnamedist+.
2147 % \end{flushleft}
2148 %
2149 %
2150 % In addition to the parameters specific to the \mscpack,
2151 % standard \LaTeX\ commands can be used to change the type style and
2152 % other details.
2153 % For example, if the command \verb+\sffamily+ is included directly after
2154 % the start of the msc environment, the text in the \MSC{}
2155 % is drawn using a {\sf sans serif} font. Likewise, the text size can be
2156 % changed by inserting, e.g., the command \verb+\small+.
2157 % The \verb+\raisebox+ and \verb+\parbox+ commands
2158 % can also be used to position and format names.
2159
2160
2161 \section{Example}
2162 \label{example}
2163 Figure~\ref{ex} on page~\pageref{ex} shows the \MSC{} defined in the
2164 following \LaTeX\ fragment.
2165
2166 {\small
2167 \begin{verbatim}
2168 \begin{msc}{Example}
2169 \declinst{usr}{The user}{User}
2170 \declinst{m1}{Control}{M1}
2171 \dummyinst{m2}
2172 \declinst{m3}{Another Machine}{M3}
2173
2174 \create{start}{m1}{m2}{Processing}{M2}
2175 \mess{msg 0}{envleft}{usr}
2176 \mess{msg 1}{envright}{m2}[1]
2177 \nextlevel
2178
2179 \mess{msg 2}{usr}{m1}
2180 \order{m1}{m2}[4]
2181 \action{a}{m3}
2182
2183 \nextlevel
2184 \found{msg x}{}{usr}
2185 \nextlevel
2186
2187 \mess{msg 3}{usr}{m2}[-1]
2188 \coregionstart{m1}
2189 \settimeout{S}{m3}[2]
2190 \nextlevel
2191
2192
2193 \mess{msg 4}{m1}{usr}
2194 \coregionstart{m2}
2195 \settimer[r]{T}{m3}
2196 \nextlevel
2197
2198 \mess[r]{msg 5}{m2}{m2}[3]
2199 \mess{msg 6}{usr}{usr}[2]
2200 \nextlevel
2201
2202 \mess{msg 7}{m2}{usr}
2203 \timeout[r]{T}{m3}
2204 \nextlevel
2205
2206 \coregionend{m2}
2207 \nextlevel
2208
2209 \coregionend{m1}
2210 \stoptimer[r]{T'}{m3}
2211 \nextlevel
2212
2213 \lost[r]{msg y}{Mach 1}{usr}
2214 \mess{msg 8}{m1}{envright}
2215 \nextlevel
2216
2217 \condition{condition 1}{usr,m2}
2218 \setstoptimer[r]{U}{m3}
2219 \nextlevel[2]
2220 \stop{usr}
2221
2222 \end{msc}
2223 \end{verbatim}
2224 }
2225
2226 \begin{figure}[htb]
2227 \begin{center}
2228 \begin{msc}{Example}
2229 \declinst{usr}{The user}{User}
2230 \declinst{m1}{Control}{M1}
2231 \dummyinst{m2}
2232 \declinst{m3}{Another Machine}{M3}
2233
2234 \create{start}{m1}{m2}{Processing}{M2}
2235 \mess{msg 0}{envleft}{usr}
2236 \mess{msg 1}{envright}{m2}[1]
2237 \nextlevel
2238
2239 \mess{msg 2}{usr}{m1}
2240 \order{m1}{m2}[4]
2241 \action{a}{m3}
2242
2243 \nextlevel
2244 \found{msg x}{}{usr}
2245 \nextlevel
2246
2247 \mess{msg 3}{usr}{m2}[-1]
2248 \coregionstart{m1}
2249 \settimeout{S}{m3}[2]
2250 \nextlevel
2251
2252
2253 \mess{msg 4}{m1}{usr}
2254 \coregionstart{m2}
2255 \settimer[r]{T}{m3}
2256 \nextlevel
2257
2258 \mess[r]{msg 5}{m2}{m2}[3]
2259 \mess{msg 6}{usr}{usr}[2]
2260 \nextlevel
2261
2262 \mess{msg 7}{m2}{usr}
2263 \timeout[r]{T}{m3}
2264 \nextlevel
2265
2266 \coregionend{m2}
2267 \nextlevel
2268
2269 \coregionend{m1}
2270 \stoptimer[r]{T'}{m3}
2271 \nextlevel
2272
2273 \lost[r]{msg y}{Mach 1}{usr}
2274 \mess{msg 8}{m1}{envright}
2275 \nextlevel
2276
2277 \condition{condition 1}{usr,m2}
2278 \setstoptimer[r]{U}{m3}
2279 \nextlevel[2]
2280 \stop{usr}
2281
2282 \end{msc}
2283
2284 \caption{A menagerie of \MSC{} symbols}
2285 \label{ex}
2286 \end{center}
2287 \end{figure}
2288
2289
2290 \section{Acknowledgments}
2291 Thanks are due to the following people for providing us with useful
2292 input: Cas Cremers, Hugo Jonker, Peter Peters, Sa\v{s}a Radomirovi\'c,
2293 Michel Reniers, and Pim Vullers.
2294
2295 \bibliographystyle{plain}
2296 \bibliography{biblio}
2297 \printindex
2298
2299 \end{document}