Ignore:
Timestamp:
Apr 29, 2018, 11:58:08 AM (7 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, with_gc
Children:
db98cd5
Parents:
b91e8c1
Message:

formatting

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/tests/coroutine/fibonacci.c

    rb91e8c1 r71b50f36  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // fibonacci.c --
     7// fibonacci.c -- 3-state finite-state machine
     8
    89//
    910// Author           : Thierry Delisle
    1011// Created On       : Thu Jun  8 07:29:37 2017
    1112// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Mar 22 22:45:44 2018
    13 // Update Count     : 15
     13// Last Modified On : Fri Apr 27 08:55:31 2018
     14// Update Count     : 19
    1415//
    1516
     
    1920coroutine Fibonacci { int fn; };                                                // used for communication
    2021
    21 void ?{}( Fibonacci & fib ) with( fib ) { fn = 0; }
    22 
    23 // main automatically called on first resume
    24 void main( Fibonacci & fib ) with( fib ) {
     22void main( Fibonacci & fib ) with( fib ) {                              // called on first resume
    2523        int fn1, fn2;                                                                           // retained between resumes
    2624        fn = 0;  fn1 = fn;                                                                      // 1st case
     
    2927        suspend();                                                                                      // restart last resume
    3028        for ( ;; ) {
    31                 fn = fn1 + fn2; fn2 = fn1;  fn1 = fn;                   // general case
     29                fn = fn1 + fn2;  fn2 = fn1;  fn1 = fn;                  // general case
    3230                suspend();                                                                              // restart last resume
    3331        } // for
Note: See TracChangeset for help on using the changeset viewer.