| 
            Last change
 on this file since 11f65b3 was             3720c9aa, checked in by Peter A. Buhr <pabuhr@…>, 4 years ago           | 
        
        
          | 
             
formatting and indicate compiler bug 
 
           | 
        
        
          
            
              - 
Property                 mode
 set to                 
100644
               
             
           | 
        
        
          | 
            File size:
            840 bytes
           | 
        
      
      
| Line |   | 
|---|
| 1 | //
 | 
|---|
| 2 | // Cforall Version 1.0.0 Copyright (C) 2017 University of Waterloo
 | 
|---|
| 3 | //
 | 
|---|
| 4 | // The contents of this file are covered under the licence agreement in the
 | 
|---|
| 5 | // file "LICENCE" distributed with Cforall.
 | 
|---|
| 6 | //
 | 
|---|
| 7 | // fibonacci.cfa
 | 
|---|
| 8 | //
 | 
|---|
| 9 | // Author           : Thierry Delisle
 | 
|---|
| 10 | // Created On       : Mon Mar 1 16:54:23 2020
 | 
|---|
| 11 | // Last Modified By : Peter A. Buhr
 | 
|---|
| 12 | // Last Modified On : Thu Jun 10 21:54:14 2021
 | 
|---|
| 13 | // Update Count     : 3
 | 
|---|
| 14 | //
 | 
|---|
| 15 | 
 | 
|---|
| 16 | #include <fstream.hfa>
 | 
|---|
| 17 | 
 | 
|---|
| 18 | generator Fib {
 | 
|---|
| 19 |         int fn1, fn;
 | 
|---|
| 20 | };
 | 
|---|
| 21 | 
 | 
|---|
| 22 | void main(Fib & fib) with (fib) {
 | 
|---|
| 23 |         [fn1, fn] = [1, 0];
 | 
|---|
| 24 |         for () {
 | 
|---|
| 25 |                 suspend;
 | 
|---|
| 26 |                 [fn1, fn] = [fn, fn + fn1];
 | 
|---|
| 27 |         }
 | 
|---|
| 28 | }
 | 
|---|
| 29 | 
 | 
|---|
| 30 | int main() {
 | 
|---|
| 31 |         Fib f1, f2;
 | 
|---|
| 32 |         for ( 10 ) {
 | 
|---|
| 33 |                 resume( f1 ); resume( f2 );
 | 
|---|
| 34 |                 sout | f1.fn | f2.fn;
 | 
|---|
| 35 |                 // sout | resume( f1 ).fn | resume( f2 ).fn; // compiler bug
 | 
|---|
| 36 |         }
 | 
|---|
| 37 | }
 | 
|---|
| 38 | 
 | 
|---|
| 39 | // Local Variables: //
 | 
|---|
| 40 | // tab-width: 4 //
 | 
|---|
| 41 | // compile-command: "cfa fibonacci.cfa" //
 | 
|---|
| 42 | // End: //
 | 
|---|
       
      
  Note:
 See   
TracBrowser
 for help on using the repository browser.