|
|
Subject:
Please explain what this program does
Category: Computers > Programming Asked by: pink_snickers-ga List Price: $30.00 |
Posted:
18 Feb 2006 15:01 PST
Expires: 20 Feb 2006 09:01 PST Question ID: 447417 |
Can someone please explain what this program generally does? and especially, what is the connection between the array 'strarray' and value of 'rsult' upon termination? Thanks :) #define MAXIMUM 6 #define MAXIMUMINDEX MAXIMUM-1 bool rsult; byte strarray[MAXIMUM]; proctype prducer( chan out ) { int i; do :: (i <= MAXIMUMINDEX) -> out!strarray[i]; i++; :: (i > MAXIMUMINDEX) -> break; od; } proctype anonymous( chan in; chan out ) { bit x,y; bool r; chan chld = [1] of { bit }; chan c = [1] of { bool }; out!1; if :: in?x -> out!1; run anonymous( chld, c ); do :: in?y -> chld!y; c?r; out!(r && (x==y)); :: timeout -> break; od :: timeout -> skip fi } proctype cnsumer ( chan in ) { bool r; int i=0; do :: (i <= MAXIMUM) -> in?r; i++; :: (i > MAXIMUM) -> break; od; rsult = r; } init { /* array strarray */ strarray[0] = 1; strarray[1] = 1; strarray[2] = 0; strarray[3] = 0; strarray[4] = 1; strarray[5] = 0; chan chld = [1] of { bit }; chan c = [1] of { bool }; run prducer(chld); run anonymous(chld, c); run cnsumer(c); } | |
| |
|
|
There is no answer at this time. |
|
There are no comments at this time. |
If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you. |
Search Google Answers for |
Google Home - Answers FAQ - Terms of Service - Privacy Policy |