// // Cforall Version 1.0.0 Copyright (C) 2017 University of Waterloo // // The contents of this file are covered under the licence agreement in the // file "LICENCE" distributed with Cforall. // // fibonacci.cfa // // Author : Thierry Delisle // Created On : Mon Mar 1 16:54:23 2020 // Last Modified By : Peter A. Buhr // Last Modified On : Thu Jun 10 21:54:14 2021 // Update Count : 3 // #include generator Fib { int fn1, fn; }; void main(Fib & fib) with (fib) { [fn1, fn] = [1, 0]; for () { suspend; [fn1, fn] = [fn, fn + fn1]; } } int main() { Fib f1, f2; for ( 10 ) { resume( f1 ); resume( f2 ); sout | f1.fn | f2.fn; // sout | resume( f1 ).fn | resume( f2 ).fn; // compiler bug } } // Local Variables: // // tab-width: 4 // // compile-command: "cfa fibonacci.cfa" // // End: //