Last change
on this file since 3ac5fd8 was
3720c9aa,
checked in by Peter A. Buhr <pabuhr@…>, 3 years ago
|
formatting and indicate compiler bug
|
-
Property mode set to
100644
|
File size:
840 bytes
|
Rev | Line | |
---|
[427854b] | 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 |
---|
[3720c9aa] | 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 |
---|
[427854b] | 14 | // |
---|
| 15 | |
---|
[3720c9aa] | 16 | #include <fstream.hfa> |
---|
| 17 | |
---|
[427854b] | 18 | generator Fib { |
---|
| 19 | int fn1, fn; |
---|
| 20 | }; |
---|
| 21 | |
---|
[3720c9aa] | 22 | void main(Fib & fib) with (fib) { |
---|
[427854b] | 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 ) { |
---|
[3720c9aa] | 33 | resume( f1 ); resume( f2 ); |
---|
| 34 | sout | f1.fn | f2.fn; |
---|
| 35 | // sout | resume( f1 ).fn | resume( f2 ).fn; // compiler bug |
---|
[427854b] | 36 | } |
---|
| 37 | } |
---|
| 38 | |
---|
| 39 | // Local Variables: // |
---|
| 40 | // tab-width: 4 // |
---|
| 41 | // compile-command: "cfa fibonacci.cfa" // |
---|
[3720c9aa] | 42 | // End: // |
---|
Note: See
TracBrowser
for help on using the repository browser.