Ignore:
Timestamp:
Aug 21, 2018, 2:24:29 PM (7 years ago)
Author:
Rob Schluntz <rschlunt@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, no_list, persistent-indexer, pthread-emulation, qualifiedEnum
Children:
2a6292d
Parents:
2b79a70 (diff), efa8b6a (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.
Message:

Merge branch 'master' of plg.uwaterloo.ca:/u/cforall/software/cfa/cfa-cc

File:
1 moved

Legend:

Unmodified
Added
Removed
  • tests/coroutine/fibonacci.c

    r2b79a70 rcdbab55  
    66//
    77// fibonacci.c -- 3-state finite-state machine
    8 
    98//
    109// Author           : Thierry Delisle
    1110// Created On       : Thu Jun  8 07:29:37 2017
    1211// Last Modified By : Peter A. Buhr
    13 // Last Modified On : Fri Apr 27 08:55:31 2018
    14 // Update Count     : 19
     12// Last Modified On : Sat Aug 18 11:21:58 2018
     13// Update Count     : 24
    1514//
    1615
    17 #include <fstream>
    18 #include <coroutine>
     16#include <fstream.hfa>
     17#include <coroutine.hfa>
    1918
    2019coroutine Fibonacci { int fn; };                                                // used for communication
     
    2625        fn = 1;  fn2 = fn1;  fn1 = fn;                                          // 2nd case
    2726        suspend();                                                                                      // restart last resume
    28         for ( ;; ) {
     27        for () {
    2928                fn = fn1 + fn2;  fn2 = fn1;  fn1 = fn;                  // general case
    3029                suspend();                                                                              // restart last resume
     
    3938int main() {
    4039        Fibonacci f1, f2;
    41         for ( int i = 1; i <= 10; i += 1 ) {
     40        for ( 10 ) {                                                                            // print N Fibonacci values
    4241                sout | next( f1 ) | next( f2 ) | endl;
    4342        } // for
Note: See TracChangeset for help on using the changeset viewer.