Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
Both sides next revision
alvis:proc [2013/12/29 20:30]
marcin created
— (current)
Line 1: Line 1:
-====== Proc statement ====== 
  
-**Passive agents** are used to store data shared among agents and to avoid the simultaneous use of such data by two or more agents. They provide a set of **procedures** that can be called by other agents. Each procedure has its own port attached and a communication with a passive agent via that port is treated as the corresponding procedure call. Depending on the communication direction, such a procedure may be used to send or collect some data from the passive agent.  
- 
- 
- 
-<code> 
-proc (g) p {...} 
-</code> 
- 
-**Listing 1. ** Proc statement syntax, where ''g'' stands for a guard and is optional and ''p'' stands for the corresponding port name. 
- 
-A procedure is accessible for other agents only if the guard evaluates to ''True''. 
- 
- 
- 
- 
-===== Example ===== 
- 
-This is a part of a model only! 
- 
-{{:alvis:buffer.png|}} 
- 
-<code> 
-agent Buffer { 
-  i :: Int = 0; 
-  proc pop  { out pop i; } 
-  proc push { in  push i; } 
-} 
-</code> 
- 
- 
-**[[:alvis:manual|Go back]]**