/usr/share/doc/maria-doc/html/maria_8.html is in maria-doc 1.3.5-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html401/loose.dtd">
<html>
<!-- Created on May 14, 2011 by texi2html 1.82
texi2html was written by:
Lionel Cons <Lionel.Cons@cern.ch> (original author)
Karl Berry <karl@freefriends.org>
Olaf Bachmann <obachman@mathematik.uni-kl.de>
and many others.
Maintained by: Many creative people.
Send bugs and suggestions to <texi2html-bug@nongnu.org>
-->
<head>
<title>Maria: D. Examples</title>
<meta name="description" content="Maria: D. Examples">
<meta name="keywords" content="Maria: D. Examples">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="texi2html 1.82">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
blockquote.smallquotation {font-size: smaller}
pre.display {font-family: serif}
pre.format {font-family: serif}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
pre.smalldisplay {font-family: serif; font-size: smaller}
pre.smallexample {font-size: smaller}
pre.smallformat {font-family: serif; font-size: smaller}
pre.smalllisp {font-size: smaller}
span.roman {font-family:serif; font-weight:normal;}
span.sansserif {font-family:sans-serif; font-weight:normal;}
ul.toc {list-style: none}
-->
</style>
</head>
<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
<a name="Examples"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="maria_7.html#Bugs" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Dining" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="maria_7.html#Compiling" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="maria.html#Top" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="maria_9.html#Copying" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="maria.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="maria_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="maria_10.html#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="maria_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Examples-1"></a>
<h1 class="appendix">D. Examples</h1>
<p>More examples can be found in the Maria source code, in the directory
‘<tt>parser/test</tt>’.
</p>
<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top"><a href="#Dining">D.1 Dining Philosophers (‘<tt>dining.pn</tt>’)</a></td><td> </td><td align="left" valign="top"> Dining Philosophers
</td></tr>
<tr><td align="left" valign="top"><a href="#Database">D.2 Distributed Database Management (‘<tt>dbm.pn</tt>’)</a></td><td> </td><td align="left" valign="top"> Distributed Database
</td></tr>
</table>
<hr size="6">
<a name="Dining"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Examples" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Database" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Examples" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Examples" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="maria_9.html#Copying" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="maria.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="maria_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="maria_10.html#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="maria_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Dining-Philosophers-_0028dining_002epn_0029"></a>
<h2 class="section">D.1 Dining Philosophers (‘<tt>dining.pn</tt>’)</h2>
<a name="index-dining-philosophers-_0028example_0029"></a>
<table><tr><td> </td><td><pre class="example">#!<var>/usr/local/bin/maria</var>
typedef unsigned (1..5) philosopher;
typedef struct {
philosopher p,
enum { thinking, hungry, eating } s
} status;
</pre><pre class="example">place fork (0..#philosopher) philosopher: philosopher p: p;
place state (#philosopher) status: philosopher p: { p, thinking };
</pre><pre class="example">trans left
in { place state: { p, thinking }; place fork: p; }
out { place state: { p, hungry }; };
</pre><pre class="example">trans right
in { place state: { p, hungry }; place fork: +p; }
out { place state: { p, eating }; };
</pre><pre class="example">trans finish
in { place state: { p, eating }; }
out { place state: { p, thinking }; place fork: p, +p; };
</pre></td></tr></table>
<hr size="6">
<a name="Database"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Dining" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="maria_9.html#Copying" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Examples" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Examples" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="maria_9.html#Copying" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="maria.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="maria_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="maria_10.html#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="maria_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Distributed-Database-Management-_0028dbm_002epn_0029"></a>
<h2 class="section">D.2 Distributed Database Management (‘<tt>dbm.pn</tt>’)</h2>
<a name="index-distributed-database-management-_0028example_0029"></a>
<p>The parameter of the model, the number of database agents, is only
present in the data type definition. The initial marking expression
and the arc expressions are independent of that parameter, thanks to
the multi-set sum operator.
</p>
<table><tr><td> </td><td><pre class="example">typedef unsigned (1..10) db_t;
typedef struct {
db_t first;
db_t second;
} db_pair_t;
</pre><pre class="example">
</pre><pre class="example">place waiting (0..1) db_t;
place performing (0..#db_t-1) db_t;
place inactive (0..#db_t) db_t: (db_t d: d)
minus (place waiting union place performing);
place exclusion (0..1) struct {}: (place waiting equals empty)#{};
</pre><pre class="example">
</pre><pre class="example">place sent (0..#db_t-1) db_pair_t;
place received (0..#db_t-1) db_pair_t;
place acknowledged (0..#db_t-1) db_pair_t;
</pre><pre class="example">
</pre><pre class="example">place unused (1+#db_pair_t-2*#db_t,#db_pair_t-#db_t) db_pair_t:
(db_pair_t p (p.first != p.second): p)
minus (db_t t: (map s { place waiting } {s, t}));
</pre><pre class="example">
</pre><pre class="example">trans update_and_send_messages
in {
place inactive: s;
place exclusion: {};
place unused: db_t t (t != s): { s, t };
}
out {
place waiting: s;
place sent: db_t t (t != s): { s, t };
};
</pre><pre class="example">
</pre><pre class="example">trans receive_acknowledgements
in {
place waiting: s;
place acknowledged: db_t t (t != s): { s, t };
}
out {
place inactive: s;
place exclusion: {};
place unused: db_t t (t != s): { s, t };
};
</pre><pre class="example">
</pre><pre class="example">trans receive_message
in {
place inactive: r;
place sent: { s, r };
}
out {
place performing: r;
place received: { s, r };
}
gate s != r;
</pre><pre class="example">
</pre><pre class="example">trans send_acknowledgement
in {
place performing: r;
place received: { s, r };
}
out {
place inactive: r;
place acknowledged: { s, r };
}
gate s != r;
</pre></td></tr></table>
<hr size="6">
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Examples" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="maria_9.html#Copying" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="maria.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="maria_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="maria_10.html#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="maria_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<p>
<font size="-1">
This document was generated by <em>root</em> on <em>May 14, 2011</em> using <a href="http://www.nongnu.org/texi2html/"><em>texi2html 1.82</em></a>.
</font>
<br>
</p>
</body>
</html>
|