Changeset b067d9b for tests/coroutine/fibonacci.cfa
- Timestamp:
- Oct 29, 2019, 4:01:24 PM (6 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 773db65, 9421f3d8
- Parents:
- 7951100 (diff), 8364209 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)links above to see all the changes relative to each parent. - File:
-
- 1 moved
-
tests/coroutine/fibonacci.cfa (moved) (moved from src/tests/coroutine/fibonacci.c ) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
tests/coroutine/fibonacci.cfa
r7951100 rb067d9b 6 6 // 7 7 // fibonacci.c -- 3-state finite-state machine 8 9 8 // 10 9 // Author : Thierry Delisle 11 10 // Created On : Thu Jun 8 07:29:37 2017 12 11 // Last Modified By : Peter A. Buhr 13 // Last Modified On : Fri Apr 27 08:55:31 201814 // Update Count : 1912 // Last Modified On : Fri Mar 22 13:40:35 2019 13 // Update Count : 26 15 14 // 16 15 17 #include <fstream >18 #include <coroutine >16 #include <fstream.hfa> 17 #include <coroutine.hfa> 19 18 20 19 coroutine Fibonacci { int fn; }; // used for communication … … 26 25 fn = 1; fn2 = fn1; fn1 = fn; // 2nd case 27 26 suspend(); // restart last resume 28 for ( ;;) {27 for () { 29 28 fn = fn1 + fn2; fn2 = fn1; fn1 = fn; // general case 30 29 suspend(); // restart last resume … … 39 38 int main() { 40 39 Fibonacci f1, f2; 41 for ( int i = 1; i <= 10; i += 1 ) {42 sout | next( f1 ) | next( f2 ) | endl;40 for ( 10 ) { // print N Fibonacci values 41 sout | next( f1 ) | next( f2 ); 43 42 } // for 44 43 } … … 46 45 // Local Variables: // 47 46 // tab-width: 4 // 48 // compile-command: "cfa fibonacci.c " //47 // compile-command: "cfa fibonacci.cfa" // 49 48 // End: //
Note:
See TracChangeset
for help on using the changeset viewer.