Home
   News
   About the project
   Language
   Compiler download
   Test suite
   Blog on the programming model
   Zonnon @ OCP Forum
   Collection of examples

TEST: 094-T07-T

category

status

Compilation and execution results for Windows (first) and Mono (second)
NOT PASSED Compiler: 1.2.8.0
Date, time: 2010.08.06, 18:06
Compilation: ERROR
Execution: NOT RUN
(29, 2) Modifier 'shared' cannot be used for a procedure in a non protected object. Add protected modifier to the object
NOT PASSED Compiler: 1.2.8.0
Date, time: 2010.08.06, 22:22
Compilation: ERROR
Execution: NOT RUN
(29, 2) Modifier 'shared' cannot be used for a procedure in a non protected object. Add protected modifier to the object
(0, 0) Assembly reference not resolved: System.Configuration, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a.

code

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  
 (**   
  * 9. Concurrency-Activities-Protocols  
  * 9.4. Protocted-Objects-and-Modules  
  *  
  * Positive test: Simple protected object  
  *)  
   
 module {protected} Main;  
 import System;  
   
 var atime, max:integer;  
   
 type {public} Obj = object  
      var value, hidden: integer;  
   
      procedure {public} exchange;  
      var t:integer;  
      begin  
           writeln("Exchange enter");  
           System.Threading.Thread.Sleep( 300 );  
           t := value;  
           value := hidden;  
           hidden := t;  
           atime := 1;  
           writeln("Exchange leave");            
      end exchange;  
   
   
      procedure {publicshared} getValue: integer;  
         begin  
         atime := 2;  
           writeln("Get value enter");  
           inc(max);  
           System.Threading.Thread.Sleep( 100 );  
           if max = 2 then max := 10 end;  
           dec(max);  
           writeln("Get value leave");  
         return value;            
     end getValue;  
 begin  
   max := 0;  
   hidden := 25;  
   value := 10;  
 end Obj;  
   
   
 var o:Obj;  
   
 activity tryToGetValue;  
 var value:integer;  
 begin  
   System.Threading.Thread.Sleep( 10 ); (* Time for exchage to start *)  
   writeln("Activity is trying to get value");  
   value := o.getValue();  
   writeln("Activity received value: ", value);  
 end tryToGetValue;  
        
   
 var value:integer;  
 begin  
     do{barrier}  
           atime := 3;  
           new tryToGetValue;  
           o.exchange();  
           value := o.getValue();  
      end;  
      writeln("atime ", atime);  
      writeln("max ", max);  
      System.Threading.Thread.Sleep( 10 );  
     if (atime = 2) & (max = 8) then halt(1) else halt(0) end  
 end Main. 

information

  • PASSED - overall positive decision about the test
  • NOT PASSED - overall negative decision about the test
  • SUCCESS - compilation / execution successful
  • ERROR - compilation failed with normal syntax or semantic error
  • ABORT - compilation failed because of an internal compiler error
  • NOT RUN - the test was not / not supposed to be executed
  • FAIL - execution failed
Copyright © 2010 ETH Zurich, Switzerland