D7net Mini Sh3LL v1
Current File : //media/../../usr/share/doc/libgcab-1.0-0/../maria-doc/html/maria_8.html |
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html401/loose.dtd">
<html>
<!-- Created on March 22, 2020 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>March 22, 2020</em> using <a href="http://www.nongnu.org/texi2html/"><em>texi2html 1.82</em></a>.
</font>
<br>
</p>
</body>
</html>
AnonSec - 2021 | Recode By D7net