Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • tests/coroutine/pingpong.cfa

    r363b48f r1427e90  
    1010// Created On       : Wed Sep 20 11:55:23 2017
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Mar 26 17:54:14 2019
    13 // Update Count     : 35
     12// Last Modified On : Tue Dec 11 21:58:06 2018
     13// Update Count     : 29
    1414//
    1515
     
    2020        const char * name;
    2121        /* const */ unsigned int N;
    22         PingPong & part;
     22        PingPong * part;
    2323};
    2424
    2525void ?{}( PingPong & this, const char * name, unsigned int N, PingPong & part ) {
    26         this.[name, N] = [name, N];  &this.part = ∂
     26        (this.__cor){name};
     27        this.name = name;
     28        this.N = N;
     29        this.part = ∂
    2730}
    2831void ?{}( PingPong & this, const char * name, unsigned int N ) {
    29         this{ name, N, *0p };                                                           // call first constructor
     32        this{ name, N, *(PingPong *)0 };
    3033}
    3134void cycle( PingPong & pingpong ) {
     
    3336}
    3437void partner( PingPong & this, PingPong & part ) {
    35         &this.part = ∂
     38        this.part = ∂
    3639        resume( this );
    3740}
    38 void main( PingPong & pingpong ) with(pingpong) {               // ping's starter ::main, pong's starter ping
    39         for ( N ) {                                                                                     // N ping-pongs
    40                 sout | name;
    41                 cycle( part );
     41void main( PingPong & pingpong ) {                                              // ping's starter ::main, pong's starter ping
     42        for ( pingpong.N ) {                                                            // N ping-pongs
     43                sout | pingpong.name;
     44                cycle( *pingpong.part );
    4245        } // for
    4346}
     
    5053// Local Variables: //
    5154// tab-width: 4 //
    52 // compile-command: "cfa pingpong.cfa" //
     55// compile-command: "cfa pingpong.c" //
    5356// End: //
Note: See TracChangeset for help on using the changeset viewer.