Changes in / [a2c2363:e3784a50]


Ignore:
Files:
3 deleted
25 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/common.hfa

    ra2c2363 re3784a50  
    6969        T min( T v1, T v2 ) { return v1 < v2 ? v1 : v2; }
    7070
    71         forall( T, Ts... | { T min( T, T ); T min( T, T, Ts ); } )
    72         T min( T v1, T v2, T v3, Ts vs ) { return min( min( v1, v2 ), v3, vs ); }
     71        forall( T, Ts... | { T min( T, T ); T min( T, Ts ); } )
     72        T min( T v1, T v2, Ts vs ) { return min( min( v1, v2 ), vs ); }
    7373
    7474        forall( T | { int ?>?( T, T ); } )
    7575        T max( T v1, T v2 ) { return v1 > v2 ? v1 : v2; }
    7676
    77         forall( T, Ts... | { T max( T, T ); T max( T, T, Ts ); } )
    78         T max( T v1, T v2, T v3, Ts vs ) { return max( max( v1, v2 ), v3, vs ); }
     77        forall( T, Ts... | { T max( T, T ); T max( T, Ts ); } )
     78        T max( T v1, T v2, Ts vs ) { return max( max( v1, v2 ), vs ); }
    7979
    8080        forall( T | { T min( T, T ); T max( T, T ); } )
  • src/GenPoly/GenPoly.cc

    ra2c2363 re3784a50  
    4848                }
    4949
    50                 bool hasPolyParams( const std::vector<ast::ptr<ast::Expr>> & params, const ast::TypeSubstitution * env ) {
    51                         for ( auto &param : params ) {
    52                                 auto paramType = param.as<ast::TypeExpr>();
    53                                 assertf( paramType, "Aggregate parameters should be type expressions" );
    54                                 if ( isPolyType( paramType->type, env ) ) return true;
     50                bool hasPolyParams( const std::vector<ast::ptr<ast::Expr>> & params, const ast::TypeSubstitution * env) {
     51                        for (auto &param : params) {
     52                                auto paramType = param.strict_as<ast::TypeExpr>();
     53                                if (isPolyType(paramType->type, env)) return true;
    5554                        }
    5655                        return false;
     
    6362                                assertf(paramType, "Aggregate parameters should be type expressions");
    6463                                if ( isPolyType( paramType->get_type(), tyVars, env ) ) return true;
    65                         }
    66                         return false;
    67                 }
    68 
    69                 bool hasPolyParams( const std::vector<ast::ptr<ast::Expr>> & params, const TypeVarMap & typeVars, const ast::TypeSubstitution * env ) {
    70                         for ( auto & param : params ) {
    71                                 auto paramType = param.as<ast::TypeExpr>();
    72                                 assertf( paramType, "Aggregate parameters should be type expressions" );
    73                                 if ( isPolyType( paramType->type, typeVars, env ) ) return true;
    7464                        }
    7565                        return false;
     
    195185        }
    196186
     187        const ast::Type * isPolyType(const ast::Type * type, const TyVarMap & tyVars, const ast::TypeSubstitution * env) {
     188                type = replaceTypeInst( type, env );
     189
     190                if ( auto typeInst = dynamic_cast< const ast::TypeInstType * >( type ) ) {
     191                        if ( tyVars.contains( typeInst->typeString() ) ) return type;
     192                } else if ( auto arrayType = dynamic_cast< const ast::ArrayType * >( type ) ) {
     193                        return isPolyType( arrayType->base, env );
     194                } else if ( auto structType = dynamic_cast< const ast::StructInstType* >( type ) ) {
     195                        if ( hasPolyParams( structType->params, env ) ) return type;
     196                } else if ( auto unionType = dynamic_cast< const ast::UnionInstType* >( type ) ) {
     197                        if ( hasPolyParams( unionType->params, env ) ) return type;
     198                }
     199                return nullptr;
     200        }
     201
    197202const ast::Type * isPolyType( const ast::Type * type,
    198203                const TypeVarMap & typeVars, const ast::TypeSubstitution * subst ) {
     
    202207                if ( typeVars.contains( *inst ) ) return type;
    203208        } else if ( auto array = dynamic_cast< const ast::ArrayType * >( type ) ) {
    204                 return isPolyType( array->base, typeVars, subst );
     209                return isPolyType( array->base, subst );
    205210        } else if ( auto sue = dynamic_cast< const ast::StructInstType * >( type ) ) {
    206                 if ( hasPolyParams( sue->params, typeVars, subst ) ) return type;
     211                if ( hasPolyParams( sue->params, subst ) ) return type;
    207212        } else if ( auto sue = dynamic_cast< const ast::UnionInstType * >( type ) ) {
    208                 if ( hasPolyParams( sue->params, typeVars, subst ) ) return type;
     213                if ( hasPolyParams( sue->params, subst ) ) return type;
    209214        }
    210215        return nullptr;
  • tests/.expect/minmax.txt

    ra2c2363 re3784a50  
    2020double                  4. 3.1  max 4.
    2121long double             4. 3.1  max 4.
    22 
    23 3 arguments
    24 2 3 4   min 2   max 4
    25 4 2 3   min 2   max 4
    26 3 4 2   min 2   max 4
    27 4 arguments
    28 3 2 5 4 min 2   max 5
    29 5 3 4 2 min 2   max 5
  • tests/concurrency/actors/dynamic.cfa

    ra2c2363 re3784a50  
    99struct derived_actor { inline actor; };
    1010struct derived_msg {
    11         inline message;
    12         int cnt;
     11    inline message;
     12    int cnt;
    1313};
    1414
    1515void ?{}( derived_msg & this, int cnt ) {
    16         set_allocation( this, Delete );
    17         this.cnt = cnt;
     16    ((message &) this){ Delete };
     17    this.cnt = cnt;
    1818}
    1919void ?{}( derived_msg & this ) { ((derived_msg &)this){ 0 }; }
    2020
    2121allocation receive( derived_actor & receiver, derived_msg & msg ) {
    22         if ( msg.cnt >= Times ) {
    23                 sout | "Done";
    24                 return Delete;
    25         }
    26         derived_msg * d_msg = alloc();
    27         (*d_msg){ msg.cnt + 1 };
    28         derived_actor * d_actor = alloc();
    29         (*d_actor){};
    30         *d_actor | *d_msg;
    31         return Delete;
     22    if ( msg.cnt >= Times ) {
     23        sout | "Done";
     24        return Delete;
     25    }
     26    derived_msg * d_msg = alloc();
     27    (*d_msg){ msg.cnt + 1 };
     28    derived_actor * d_actor = alloc();
     29    (*d_actor){};
     30    *d_actor | *d_msg;
     31    return Delete;
    3232}
    3333
    3434int main( int argc, char * argv[] ) {
    35         switch ( argc ) {
     35    switch ( argc ) {
    3636          case 2:
    3737                if ( strcmp( argv[1], "d" ) != 0 ) {                    // default ?
    38                         Times = ato( argv[1] );
    39                         if ( Times < 1 ) fallthru default;
     38                        Times = atoi( argv[1] );
     39                        if ( Times < 1 ) goto Usage;
    4040                } // if
    4141          case 1:                                                                                       // use defaults
    4242                break;
    4343          default:
    44                 exit | "Usage: " | argv[0] | " [ times (> 0) ]";
     44          Usage:
     45                sout | "Usage: " | argv[0] | " [ times (> 0) ]";
     46                exit( EXIT_FAILURE );
    4547        } // switch
    4648
    47         sout | "starting";
     49    printf("starting\n");
    4850
    49         executor e{ 0, 1, 1, false };
    50         start_actor_system( e );
     51    executor e{ 0, 1, 1, false };
     52    start_actor_system( e );
    5153
    52         sout | "started";
     54    printf("started\n");
    5355
    54         derived_msg * d_msg = alloc();
    55         (*d_msg){};
    56         derived_actor * d_actor = alloc();
    57         (*d_actor){};
    58         *d_actor | *d_msg;
     56    derived_msg * d_msg = alloc();
     57    (*d_msg){};
     58    derived_actor * d_actor = alloc();
     59    (*d_actor){};
     60    *d_actor | *d_msg;
    5961
    60         sout | "stopping";
     62    printf("stopping\n");
    6163
    62         stop_actor_system();
     64    stop_actor_system();
    6365
    64         sout | "stopped";
     66    printf("stopped\n");
     67
     68    return 0;
    6569}
  • tests/concurrency/actors/executor.cfa

    ra2c2363 re3784a50  
    1010static int ids = 0;
    1111struct d_actor {
    12         inline actor;
    13         d_actor * gstart;
    14         int id, rounds, recs, sends;
     12    inline actor;
     13    d_actor * gstart;
     14    int id, rounds, recs, sends;
    1515};
    1616void ?{}( d_actor & this ) with(this) {
    17         id = ids++;
    18         gstart = (&this + (id / Set * Set - id)); // remember group-start array-element
    19         rounds = Set * Rounds;  // send at least one message to each group member
    20         recs = 0;
    21         sends = 0;
     17    id = ids++;
     18    gstart = (&this + (id / Set * Set - id)); // remember group-start array-element
     19    rounds = Set * Rounds;      // send at least one message to each group member
     20    recs = 0;
     21    sends = 0;
    2222}
    2323
     
    2525
    2626allocation receive( d_actor & this, d_msg & msg ) with( this ) {
    27         if ( recs == rounds ) return Finished;
    28         if ( recs % Batch == 0 ) {
    29                 for ( i; Batch ) {
    30                         gstart[sends % Set] | shared_msg;
    31                         sends += 1;
    32                 }
    33         }
    34         recs += 1;
    35         return Nodelete;
     27    if ( recs == rounds ) return Finished;
     28    if ( recs % Batch == 0 ) {
     29        for ( i; Batch ) {
     30            gstart[sends % Set] | shared_msg;
     31            sends += 1;
     32        }
     33    }
     34    recs += 1;
     35    return Nodelete;
    3636}
    3737
    3838int main( int argc, char * argv[] ) {
    39         switch ( argc ) {
     39    switch ( argc ) {
    4040          case 7:
    4141                if ( strcmp( argv[6], "d" ) != 0 ) {                    // default ?
    42                         BufSize = ato( argv[6] );
    43                         if ( BufSize < 0 ) fallthru default;
     42                        BufSize = atoi( argv[6] );
     43                        if ( BufSize < 0 ) goto Usage;
    4444                } // if
    4545          case 6:
    4646                if ( strcmp( argv[5], "d" ) != 0 ) {                    // default ?
    47                         Batch = ato( argv[5] );
    48                         if ( Batch < 1 ) fallthru default;
     47                        Batch = atoi( argv[5] );
     48                        if ( Batch < 1 ) goto Usage;
    4949                } // if
    5050          case 5:
    5151                if ( strcmp( argv[4], "d" ) != 0 ) {                    // default ?
    52                         Processors = ato( argv[4] );
    53                         if ( Processors < 1 ) fallthru default;
     52                        Processors = atoi( argv[4] );
     53                        if ( Processors < 1 ) goto Usage;
    5454                } // if
    5555          case 4:
    5656                if ( strcmp( argv[3], "d" ) != 0 ) {                    // default ?
    57                         Rounds = ato( argv[3] );
    58                         if ( Rounds < 1 ) fallthru default;
     57                        Rounds = atoi( argv[3] );
     58                        if ( Rounds < 1 ) goto Usage;
    5959                } // if
    6060          case 3:
    6161                if ( strcmp( argv[2], "d" ) != 0 ) {                    // default ?
    62                         Set = ato( argv[2] );
    63                         if ( Set < 1 ) fallthru default;
     62                        Set = atoi( argv[2] );
     63                        if ( Set < 1 ) goto Usage;
    6464                } // if
    6565          case 2:
    6666                if ( strcmp( argv[1], "d" ) != 0 ) {                    // default ?
    67                         Actors = ato( argv[1] );
    68                         if ( Actors < 1 || Actors <= Set || Actors % Set != 0 ) fallthru default;
     67                        Actors = atoi( argv[1] );
     68                        if ( Actors < 1 || Actors <= Set || Actors % Set != 0 ) goto Usage;
    6969                } // if
    7070          case 1:                                                                                       // use defaults
    7171                break;
    7272          default:
    73                 exit | "Usage: " | argv[0]
    74                          | " [ actors (> 0 && > set && actors % set == 0 ) | 'd' (default " | Actors
     73          Usage:
     74                sout | "Usage: " | argv[0]
     75             | " [ actors (> 0 && > set && actors % set == 0 ) | 'd' (default " | Actors
    7576                         | ") ] [ set (> 0) | 'd' (default " | Set
    7677                         | ") ] [ rounds (> 0) | 'd' (default " | Rounds
     
    7980                         | ") ] [ buffer size (>= 0) | 'd' (default " | BufSize
    8081                         | ") ]" ;
     82                exit( EXIT_FAILURE );
    8183        } // switch
    8284
    83         executor e{ Processors, Processors, Processors == 1 ? 1 : Processors * 512, true };
     85    executor e{ Processors, Processors, Processors == 1 ? 1 : Processors * 512, true };
    8486
    85         sout | "starting";
     87    printf("starting\n");
    8688
    87         start_actor_system( e );
     89    start_actor_system( e );
    8890
    89         sout | "started";
     91    printf("started\n");
    9092
    91         d_actor actors[ Actors ];
     93    d_actor actors[ Actors ];
    9294
    9395        for ( i; Actors ) {
     
    9597        } // for
    9698
    97         sout | "stopping";
     99    printf("stopping\n");
    98100
    99         stop_actor_system();
     101    stop_actor_system();
    100102
    101         sout | "stopped";
     103    printf("stopped\n");
     104
     105    return 0;
    102106}
  • tests/concurrency/actors/inherit.cfa

    ra2c2363 re3784a50  
    1818
    1919allocation handle() {
    20         return Finished;
     20    return Finished;
    2121}
    2222
     
    2727
    2828int main() {
    29         sout | "Start";
    30         {
    31                 start_actor_system();
    32                 D_msg * dm = alloc();
    33                 (*dm){};
    34                 D_msg2 * dm2 = alloc();
    35                 (*dm2){};
    36                 Server2 * s = alloc();
    37                 (*s){};
    38                 Server2 * s2 = alloc();
    39                 (*s2){};
    40                 *s | *dm;
    41                 *s2 | *dm2;
    42                 stop_actor_system();
    43         }
    44         {
    45                 start_actor_system();
    46                 Server s[2];
    47                 D_msg * dm = alloc();
    48                 (*dm){};
    49                 D_msg2 * dm2 = alloc();
    50                 (*dm2){};
    51                 s[0] | *dm;
    52                 s[1] | *dm2;
    53                 stop_actor_system();
    54         }
    55         sout | "Finished";
     29    sout | "Start";
     30    {
     31        start_actor_system();
     32        D_msg * dm = alloc();
     33        (*dm){};
     34        D_msg2 * dm2 = alloc();
     35        (*dm2){};
     36        Server2 * s = alloc();
     37        (*s){};
     38        Server2 * s2 = alloc();
     39        (*s2){};
     40        *s | *dm;
     41        *s2 | *dm2;
     42        stop_actor_system();
     43    }
     44    {
     45        start_actor_system();
     46        Server s[2];
     47        D_msg * dm = alloc();
     48        (*dm){};
     49        D_msg2 * dm2 = alloc();
     50        (*dm2){};
     51        s[0] | *dm;
     52        s[1] | *dm2;
     53        stop_actor_system();
     54    }
     55    sout | "Finished";
    5656}
  • tests/concurrency/actors/inline.cfa

    ra2c2363 re3784a50  
    33
    44struct d_actor {
    5         inline actor;
     5    inline actor;
    66};
    77struct msg_wrapper {
    8         int b;
    9         inline message;
     8    int b;
     9    inline message;
    1010};
    1111void ^?{}( msg_wrapper & this ) { sout | "msg_wrapper dtor"; }
    1212
    1313struct d_msg {
    14         int m;
    15         inline msg_wrapper;
     14    int m;
     15    inline msg_wrapper;
    1616};
    1717void ?{}( d_msg & this, int m, int b ) { this.m = m; this.b = b; set_allocation( this, Delete ); }
     
    1919
    2020allocation receive( d_actor &, d_msg & msg ) {
    21         sout | msg.m;
    22         sout | msg.b;
    23         return Finished;
     21    sout | msg.m;
     22    sout | msg.b;
     23    return Finished;
    2424}
    2525
    2626struct d_msg2 {
    27         int m;
    28         inline msg_wrapper;
     27    int m;
     28    inline msg_wrapper;
    2929};
    3030void ^?{}( d_msg2 & this ) { sout | "d_msg2 dtor";}
    3131
    3232allocation receive( d_actor &, d_msg2 & msg ) {
    33         sout | msg.m;
    34         return Finished;
     33    sout | msg.m;
     34    return Finished;
    3535}
    3636
    3737int main() {
    38         processor p;
    39         {
    40                 start_actor_system();                                                           // sets up executor
    41                 d_actor da;
    42                 d_msg * dm = alloc();
    43                 (*dm){ 42, 2423 };
    44                 da | *dm;
    45                 stop_actor_system();                                                            // waits until actors finish
    46         }
    47         {
    48                 start_actor_system();                                                           // sets up executor
    49                 d_actor da;
    50                 d_msg2 dm{ 29079 };
    51                 set_allocation( dm, Nodelete );
    52                 msg_wrapper * mw = &dm;
    53                 message * mg = &dm;
    54                 virtual_dtor * v = &dm;
    55                 da | dm;
    56                 stop_actor_system();                                                            // waits until actors finish
    57         }
     38    processor p;
     39    {
     40        start_actor_system();                                // sets up executor
     41        d_actor da;
     42        d_msg * dm = alloc();
     43        (*dm){ 42, 2423 };
     44        da | *dm;
     45        stop_actor_system();                                // waits until actors finish
     46    }
     47    {
     48        start_actor_system();                                // sets up executor
     49        d_actor da;
     50        d_msg2 dm{ 29079 };
     51        set_allocation( dm, Nodelete );
     52        msg_wrapper * mw = &dm;
     53        message * mg = &dm;
     54        virtual_dtor * v = &dm;
     55        da | dm;
     56        stop_actor_system();                                // waits until actors finish
     57    }
    5858}
  • tests/concurrency/actors/matrix.cfa

    ra2c2363 re3784a50  
    55#include <stdio.h>
    66
    7 int xr = 500, xc = 500, yc = 500, Processors = 1; // default values, must be signed
     7unsigned int xr = 500, xc = 500, yc = 500, Processors = 1; // default values
    88
    99struct derived_actor { inline actor; };
    1010
    1111struct derived_msg {
    12         inline message;
    13         int * Z;
     12    inline message;
     13    int * Z;
    1414        int * X;
    15         int ** Y;
     15    int ** Y;
    1616};
    1717
    1818void ?{}( derived_msg & this ) {}
    1919void ?{}( derived_msg & this, int * Z, int * X, int ** Y ) {
    20         set_allocation( this, Nodelete );
    21         this.Z = Z;
    22         this.X = X;
    23         this.Y = Y;
     20    ((message &) this){ Nodelete };
     21    this.Z = Z;
     22    this.X = X;
     23    this.Y = Y;
    2424}
    2525
    2626allocation receive( derived_actor & receiver, derived_msg & msg ) {
    27         for ( unsigned int i = 0; i < yc; i += 1 ) { // multiply X_row by Y_col and sum products
    28                 msg.Z[i] = 0;
    29                 for ( unsigned int j = 0; j < xc; j += 1 ) {
    30                         msg.Z[i] += msg.X[j] * msg.Y[j][i];
    31                 } // for
    32         } // for
    33         return Finished;
     27    for ( unsigned int i = 0; i < yc; i += 1 ) { // multiply X_row by Y_col and sum products
     28        msg.Z[i] = 0;
     29        for ( unsigned int j = 0; j < xc; j += 1 ) {
     30            msg.Z[i] += msg.X[j] * msg.Y[j][i];
     31        } // for
     32    } // for
     33    return Finished;
    3434}
    3535
    3636int main( int argc, char * argv[] ) {
    37         switch ( argc ) {
     37    switch ( argc ) {
    3838          case 5:
    3939                if ( strcmp( argv[4], "d" ) != 0 ) {                    // default ?
    40                         Processors = ato( argv[4] );
    41                         if ( Processors < 1 ) fallthru default;
     40                        Processors = atoi( argv[4] );
     41                        if ( Processors < 1 ) goto Usage;
    4242                } // if
    4343          case 4:
    4444                if ( strcmp( argv[3], "d" ) != 0 ) {                    // default ?
    45                         xr = ato( argv[3] );
    46                         if ( xr < 1 ) fallthru default;
     45                        xr = atoi( argv[3] );
     46                        if ( xr < 1 ) goto Usage;
    4747                } // if
    4848          case 3:
    4949                if ( strcmp( argv[2], "d" ) != 0 ) {                    // default ?
    50                         xc = ato( argv[2] );
    51                         if ( xc < 1 ) fallthru default;
     50                        xc = atoi( argv[2] );
     51                        if ( xc < 1 ) goto Usage;
    5252                } // if
    5353          case 2:
    5454                if ( strcmp( argv[1], "d" ) != 0 ) {                    // default ?
    55                         yc = ato( argv[1] );
    56                         if ( yc < 1 ) fallthru default;
     55                        yc = atoi( argv[1] );
     56                        if ( yc < 1 ) goto Usage;
    5757                } // if
    5858          case 1:                                                                                       // use defaults
    5959                break;
    6060          default:
    61                 exit | "Usage: " | argv[0]
     61          Usage:
     62                sout | "Usage: " | argv[0]
    6263                         | " [ yc (> 0) | 'd' (default " | yc
    6364                         | ") ] [ xc (> 0) | 'd' (default " | xc
     
    6566                         | ") ] [ processors (> 0) | 'd' (default " | Processors
    6667                         | ") ]" ;
     68                exit( EXIT_FAILURE );
    6769        } // switch
    6870
    69         unsigned int r, c;
     71    unsigned int r, c;
    7072        int * Z[xr], * X[xr], * Y[xc];
    7173
     
    8688        } // for
    8789
    88         executor e{ Processors, Processors, Processors == 1 ? 1 : Processors * 16, true };
     90    executor e{ Processors, Processors, Processors == 1 ? 1 : Processors * 16, true };
    8991
    90         sout | "starting";
     92    printf("starting\n");
    9193
    92         start_actor_system( e );
     94    start_actor_system( e );
    9395
    94         sout | "started";
     96    printf("started\n");
    9597
    96         derived_msg messages[xr];
     98    derived_msg messages[xr];
    9799
    98         derived_actor actors[xr];
     100    derived_actor actors[xr];
    99101
    100102        for ( unsigned int r = 0; r < xr; r += 1 ) {
     
    106108        } // for
    107109
    108         sout | "stopping";
     110    printf("stopping\n");
    109111
    110         stop_actor_system();
     112    stop_actor_system();
    111113
    112         sout | "stopped";
     114    printf("stopped\n");
    113115
    114         for ( r = 0; r < xr; r += 1 ) {                                         // deallocate X and Z matrices
     116    for ( r = 0; r < xr; r += 1 ) {                                             // deallocate X and Z matrices
    115117                free( X[r] );
    116                 free( Z[r] );
     118        free( Z[r] );
    117119        } // for
    118120        for ( r = 0; r < xc; r += 1 ) {                                         // deallocate Y matrix
    119                 free( Y[r] );
     121        free( Y[r] );
    120122        } // for
     123
     124    return 0;
    121125}
  • tests/concurrency/actors/pingpong.cfa

    ra2c2363 re3784a50  
    1010
    1111struct p_msg {
    12         inline message;
    13         size_t count;
     12    inline message;
     13    size_t count;
    1414};
    15 //static inline void ?{}( p_msg & this ) { ((message &)this){}; this.count = 0; }
    16 static inline void ?{}( p_msg & this ) { this.count = 0; }
     15static inline void ?{}( p_msg & this ) { ((message &)this){}; this.count = 0; }
    1716
    1817ping * pi;
     
    2120
    2221allocation receive( ping & receiver, p_msg & msg ) {
    23         msg.count++;
    24         if ( msg.count > times ) return Finished;
     22    msg.count++;
     23    if ( msg.count > times ) return Finished;
    2524
    26         allocation retval = Nodelete;
    27         if ( msg.count == times ) retval = Finished;
    28         *po | msg;
    29         return retval;
     25    allocation retval = Nodelete;
     26    if ( msg.count == times ) retval = Finished;
     27    *po | msg;
     28    return retval;
    3029}
    3130
    3231allocation receive( pong & receiver, p_msg & msg ) {
    33         msg.count++;
    34         if ( msg.count > times ) return Finished;
    35        
    36         allocation retval = Nodelete;
    37         if ( msg.count == times ) retval = Finished;
    38         *pi | msg;
    39         return retval;
     32    msg.count++;
     33    if ( msg.count > times ) return Finished;
     34   
     35    allocation retval = Nodelete;
     36    if ( msg.count == times ) retval = Finished;
     37    *pi | msg;
     38    return retval;
    4039}
    4140
     
    4342
    4443int main( int argc, char * argv[] ) {
    45         sout | "start";
     44    printf("start\n");
    4645
    47         processor p[Processors - 1];
     46    processor p[Processors - 1];
    4847
    49         start_actor_system( Processors ); // test passing number of processors
    50         ping pi_actor;
    51         pong po_actor;
    52         po = &po_actor;
    53         pi = &pi_actor;
    54         p_msg m;
    55         pi_actor | m;
    56         stop_actor_system();
     48    start_actor_system( Processors ); // test passing number of processors
    5749
    58         sout | "end";
     50    ping pi_actor;
     51    pong po_actor;
     52    po = &po_actor;
     53    pi = &pi_actor;
     54    p_msg m;
     55    pi_actor | m;
     56    stop_actor_system();
     57
     58    printf("end\n");
     59    return 0;
    5960}
  • tests/concurrency/actors/poison.cfa

    ra2c2363 re3784a50  
    1111
    1212int main() {
    13         sout | "Start";
     13    sout | "Start";
    1414
    15         sout | "Finished";
    16         {
    17                 start_actor_system();
    18                 Server s[10];
    19                 for ( i; 10 ) {
    20                         s[i] | finished_msg;
    21                 }
    22                 stop_actor_system();
    23         }
     15    sout | "Finished";
     16    {
     17        start_actor_system();
     18        Server s[10];
     19        for ( i; 10 ) {
     20            s[i] | finished_msg;
     21        }
     22        stop_actor_system();
     23    }
    2424
    25         sout | "Delete";
    26         {
    27                 start_actor_system();
    28                 for ( i; 10 ) {
    29                         Server * s = alloc();
    30                         (*s){};
    31                         (*s) | delete_msg;
    32                 }
    33                 stop_actor_system();
    34         }
     25    sout | "Delete";
     26    {
     27        start_actor_system();
     28        for ( i; 10 ) {
     29            Server * s = alloc();
     30            (*s){};
     31            (*s) | delete_msg;
     32        }
     33        stop_actor_system();
     34    }
    3535
    36         sout | "Destroy";
    37         {
    38                 start_actor_system();
    39                 Server s[10];
    40                 for ( i; 10 )
    41                         s[i] | destroy_msg;
    42                 stop_actor_system();
    43                 for ( i; 10 )
    44                         if (s[i].val != 777)
    45                                 sout | "Error: dtor not called correctly.";
    46         }
     36    sout | "Destroy";
     37    {
     38        start_actor_system();
     39        Server s[10];
     40        for ( i; 10 )
     41            s[i] | destroy_msg;
     42        stop_actor_system();
     43        for ( i; 10 )
     44            if (s[i].val != 777)
     45                sout | "Error: dtor not called correctly.";
     46    }
    4747
    48         sout | "Done";
     48    sout | "Done";
     49    return 0;
    4950}
  • tests/concurrency/actors/static.cfa

    ra2c2363 re3784a50  
    99struct derived_actor { inline actor; };
    1010struct derived_msg {
    11         inline message;
    12         int cnt;
     11    inline message;
     12    int cnt;
    1313};
    1414
    1515void ?{}( derived_msg & this, int cnt ) {
    16         set_allocation( this, Nodelete );
    17         this.cnt = cnt;
     16    ((message &) this){ Nodelete };
     17    this.cnt = cnt;
    1818}
    1919void ?{}( derived_msg & this ) { ((derived_msg &)this){ 0 }; }
    2020
    2121allocation receive( derived_actor & receiver, derived_msg & msg ) {
    22         if ( msg.cnt >= Times ) {
    23                 sout | "Done";
    24                 return Finished;
    25         }
    26         msg.cnt++;
    27         receiver | msg;
    28         return Nodelete;
     22    if ( msg.cnt >= Times ) {
     23        sout | "Done";
     24        return Finished;
     25    }
     26    msg.cnt++;
     27    receiver | msg;
     28    return Nodelete;
    2929}
    3030
    3131int main( int argc, char * argv[] ) {
    32         switch ( argc ) {
     32    switch ( argc ) {
    3333          case 2:
    3434                if ( strcmp( argv[1], "d" ) != 0 ) {                    // default ?
    35                         Times = ato( argv[1] );
    36                         if ( Times < 1 ) fallthru default;
     35                        Times = atoi( argv[1] );
     36                        if ( Times < 1 ) goto Usage;
    3737                } // if
    3838          case 1:                                                                                       // use defaults
    3939                break;
    4040          default:
    41                 exit | "Usage: " | argv[0] | " [ times (> 0) ]";
     41          Usage:
     42                sout | "Usage: " | argv[0] | " [ times (> 0) ]";
     43                exit( EXIT_FAILURE );
    4244        } // switch
    4345
    44         sout | "starting";
     46    printf("starting\n");
    4547
    46         executor e{ 0, 1, 1, false };
    47         start_actor_system( e );
     48    executor e{ 0, 1, 1, false };
     49    start_actor_system( e );
    4850
    49         sout | "started";
     51    printf("started\n");
    5052
    51         derived_msg msg;
     53    derived_msg msg;
    5254
    53         derived_actor actor;
     55    derived_actor actor;
    5456
    55         actor | msg;
     57    actor | msg;
    5658
    57         sout | "stopping";
     59    printf("stopping\n");
    5860
    59         stop_actor_system();
     61    stop_actor_system();
    6062
    61         sout | "stopped";
     63    printf("stopped\n");
     64
     65    return 0;
    6266}
  • tests/concurrency/actors/types.cfa

    ra2c2363 re3784a50  
    99
    1010struct derived_actor {
    11         inline actor;
    12         int counter;
     11    inline actor;
     12    int counter;
    1313};
    1414static inline void ?{}( derived_actor & this ) { ((actor &)this){}; this.counter = 0; }
    1515
    1616struct d_msg {
    17         inline message;
    18         int num;
     17    inline message;
     18    int num;
    1919};
    2020
    2121// this isn't a valid receive routine since int is not a message type
    2222allocation receive( derived_actor & receiver, int i ) with( receiver ) {
    23         mutex(sout) sout | i;
    24         counter++;
    25         if ( counter == 2 ) return Finished;
    26         return Nodelete;
     23    mutex(sout) sout | i;
     24    counter++;
     25    if ( counter == 2 ) return Finished;
     26    return Nodelete;
    2727}
    2828
    2929allocation receive( derived_actor & receiver, d_msg & msg ) {
    30         return receive( receiver, msg.num );
     30    return receive( receiver, msg.num );
    3131}
    3232
    3333struct derived_actor2 {
    34         struct nested { int i; }; // testing nested before inline
    35         inline actor;
     34    struct nested { int i; }; // testing nested before inline
     35    inline actor;
    3636};
    3737
    3838allocation receive( derived_actor2 & receiver, d_msg & msg ) {
    39         mutex(sout) sout | msg.num;
    40         return Finished;
     39    mutex(sout) sout | msg.num;
     40    return Finished;
    4141}
    4242
     
    4444struct derived_actor4 { inline derived_actor3; };
    4545struct d_msg2 {
    46         inline message;
    47         int num;
     46    inline message;
     47    int num;
    4848};
    4949
    5050allocation receive( derived_actor3 & receiver, d_msg & msg ) {
    51         mutex(sout) sout | msg.num;
    52         if ( msg.num == -1 ) return Nodelete;
    53         return Finished;
     51    mutex(sout) sout | msg.num;
     52    if ( msg.num == -1 ) return Nodelete;
     53    return Finished;
    5454}
    5555
    5656allocation receive( derived_actor3 & receiver, d_msg2 & msg ) {
    57         mutex(sout) sout | msg.num;
    58         return Finished;
     57    mutex(sout) sout | msg.num;
     58    return Finished;
    5959}
    6060
     
    6262
    6363int main( int argc, char * argv[] ) {
    64         sout | "start";
     64    printf("start\n");
    6565
    66         processor p[Processors - 1];
     66    processor p[Processors - 1];
    6767
    68         sout | "basic test";
    69         start_actor_system( Processors ); // test passing number of processors
    70         derived_actor a;
    71         d_msg b, c;
    72         b.num = 1;
    73         c.num = 2;
    74         a | b | c;
    75         stop_actor_system();
     68    printf("basic test\n");
     69    start_actor_system( Processors ); // test passing number of processors
     70    derived_actor a;
     71    d_msg b, c;
     72    b.num = 1;
     73    c.num = 2;
     74    a | b | c;
     75    stop_actor_system();
    7676
    77         sout | "same message and different actors test";
    78         start_actor_system(); // let system detect # of processors
    79         derived_actor2 d_ac2_0, d_ac2_1;
    80         d_msg d_ac2_msg;
    81         d_ac2_msg.num = 3;
    82         d_ac2_0 | d_ac2_msg;
    83         d_ac2_1 | d_ac2_msg;
    84         stop_actor_system();
     77    printf("same message and different actors test\n");
     78    start_actor_system(); // let system detect # of processors
     79    derived_actor2 d_ac2_0, d_ac2_1;
     80    d_msg d_ac2_msg;
     81    d_ac2_msg.num = 3;
     82    d_ac2_0 | d_ac2_msg;
     83    d_ac2_1 | d_ac2_msg;
     84    stop_actor_system();
    8585
    86        
    87         {
    88                 sout | "same message and different actor types test";
    89                 executor e{ 0, Processors, Processors == 1 ? 1 : Processors * 4, false };
    90                 start_actor_system( e ); // pass an explicit executor
    91                 derived_actor2 d_ac2_2;
    92                 derived_actor3 d_ac3_0;
    93                 d_msg d_ac23_msg;
    94                 d_ac23_msg.num = 4;
    95                 d_ac3_0 | d_ac23_msg;
    96                 d_ac2_2 | d_ac23_msg;
    97                 stop_actor_system();
    98         } // RAII to clean up executor
     86   
     87    {
     88        printf("same message and different actor types test\n");
     89        executor e{ 0, Processors, Processors == 1 ? 1 : Processors * 4, false };
     90        start_actor_system( e ); // pass an explicit executor
     91        derived_actor2 d_ac2_2;
     92        derived_actor3 d_ac3_0;
     93        d_msg d_ac23_msg;
     94        d_ac23_msg.num = 4;
     95        d_ac3_0 | d_ac23_msg;
     96        d_ac2_2 | d_ac23_msg;
     97        stop_actor_system();
     98    } // RAII to clean up executor
    9999
    100         {
    101                 sout | "different message types, one actor test";
    102                 executor e{ 1, Processors, Processors == 1 ? 1 : Processors * 4, true };
    103                 start_actor_system( Processors );
    104                 derived_actor3 a3;
    105                 d_msg b1;
    106                 d_msg2 c2;
    107                 b1.num = -1;
    108                 c2.num = 5;
    109                 a3 | b1 | c2;
    110                 stop_actor_system();
    111         } // RAII to clean up executor
     100    {
     101        printf("different message types, one actor test\n");
     102        executor e{ 1, Processors, Processors == 1 ? 1 : Processors * 4, true };
     103        start_actor_system( Processors );
     104        derived_actor3 a3;
     105        d_msg b1;
     106        d_msg2 c2;
     107        b1.num = -1;
     108        c2.num = 5;
     109        a3 | b1 | c2;
     110        stop_actor_system();
     111    } // RAII to clean up executor
    112112
    113         {
    114                 sout | "nested inheritance actor test";
    115                 executor e{ 1, Processors, Processors == 1 ? 1 : Processors * 4, true };
    116                 start_actor_system( Processors );
    117                 derived_actor4 a4;
    118                 d_msg b1;
    119                 d_msg2 c2;
    120                 b1.num = -1;
    121                 c2.num = 5;
    122                 a4 | b1 | c2;
    123                 stop_actor_system();
    124         } // RAII to clean up executor
     113    {
     114        printf("nested inheritance actor test\n");
     115        executor e{ 1, Processors, Processors == 1 ? 1 : Processors * 4, true };
     116        start_actor_system( Processors );
     117        derived_actor4 a4;
     118        d_msg b1;
     119        d_msg2 c2;
     120        b1.num = -1;
     121        c2.num = 5;
     122        a4 | b1 | c2;
     123        stop_actor_system();
     124    } // RAII to clean up executor
    125125
    126         sout | "end";
     126    printf("end\n");
     127    return 0;
    127128}
  • tests/concurrency/channels/barrier.cfa

    ra2c2363 re3784a50  
    88
    99size_t total_operations = 0;
    10 ssize_t Processors = 1, Tasks = 5, BarrierSize = 2;             // must be signed
     10int Processors = 1, Tasks = 5, BarrierSize = 2;
    1111
    1212typedef channel( int ) Channel;
     
    6565          case 3:
    6666                if ( strcmp( argv[2], "d" ) != 0 ) {                    // default ?
    67                         BarrierSize = ato( argv[2] );
    68             if ( Processors < 1 ) fallthru default;
     67                        BarrierSize = atoi( argv[2] );
     68            if ( Processors < 1 ) goto Usage;
    6969                } // if
    7070          case 2:
    7171                if ( strcmp( argv[1], "d" ) != 0 ) {                    // default ?
    72                         Processors = ato( argv[1] );
    73                         if ( Processors < 1 ) fallthru default;
     72                        Processors = atoi( argv[1] );
     73                        if ( Processors < 1 ) goto Usage;
    7474                } // if
    7575          case 1:                                                                                       // use defaults
    7676                break;
    7777          default:
    78                 exit | "Usage: " | argv[0]
     78          Usage:
     79                sout | "Usage: " | argv[0]
    7980             | " [ processors (> 0) | 'd' (default " | Processors
    8081                         | ") ] [ BarrierSize (> 0) | 'd' (default " | BarrierSize
    8182                         | ") ]" ;
     83                exit( EXIT_FAILURE );
    8284        } // switch
    8385    if ( Tasks < BarrierSize )
  • tests/concurrency/channels/big_elems.cfa

    ra2c2363 re3784a50  
    22#include "parallel_harness.hfa"
    33
    4 ssize_t Processors = 10, Channels = 10, Producers = 40, Consumers = 40, ChannelSize = 128;
     4size_t Processors = 10, Channels = 10, Producers = 40, Consumers = 40, ChannelSize = 128;
    55
    66int main() {
  • tests/concurrency/channels/churn.cfa

    ra2c2363 re3784a50  
    77#include <time.hfa>
    88
    9 ssize_t Processors = 1, Channels = 4, Producers = 2, Consumers = 2, ChannelSize = 128;
     9size_t Processors = 1, Channels = 4, Producers = 2, Consumers = 2, ChannelSize = 128;
    1010
    1111owner_lock o;
     
    9090      case 4:
    9191                if ( strcmp( argv[3], "d" ) != 0 ) {                    // default ?
    92                         ChannelSize = ato( argv[3] );
    93                         if ( ChannelSize < 1 ) fallthru default;
     92                        if ( atoi( argv[3] ) < 1 ) goto Usage;
     93                        ChannelSize = atoi( argv[3] );
    9494                } // if
    9595      case 3:
    9696                if ( strcmp( argv[2], "d" ) != 0 ) {                    // default ?
    97                         Channels = ato( argv[2] );
    98                         if ( Channels < 1 ) fallthru default;
     97                        if ( atoi( argv[2] ) < 1 ) goto Usage;
     98                        Channels = atoi( argv[2] );
    9999                } // if
    100100      case 2:
    101101                if ( strcmp( argv[1], "d" ) != 0 ) {                    // default ?
    102                         Processors = ato( argv[1] );
    103                         if ( Processors < 1 ) fallthru default;
     102                        if ( atoi( argv[1] ) < 1 ) goto Usage;
     103                        Processors = atoi( argv[1] );
    104104                } // if
    105105          case 1:                                                                                       // use defaults
    106106                break;
    107107          default:
    108                 exit | "Usage: " | argv[0]
     108          Usage:
     109                sout | "Usage: " | argv[0]
    109110             | " [ processors > 0 | d ]"
    110111             | " [ producers > 0 | d ]"
    111112             | " [ consumers > 0 | d ]"
    112113             | " [ channels > 0 | d ]";
     114                exit( EXIT_FAILURE );
    113115    }
    114116    processor p[Processors - 1];
  • tests/concurrency/channels/contend.cfa

    ra2c2363 re3784a50  
    127127          case 3:
    128128                if ( strcmp( argv[2], "d" ) != 0 ) {                    // default ?
    129                         ChannelSize = ato( argv[2] );
    130                         if ( ChannelSize < 1 ) fallthru default;
     129                        ChannelSize = atoi( argv[2] );
    131130                } // if
    132131          case 2:
    133132                if ( strcmp( argv[1], "d" ) != 0 ) {                    // default ?
    134                         Processors = ato( argv[1] );
    135                         if ( Processors < 1 ) fallthru default;
     133                        Processors = atoi( argv[1] );
     134                        if ( Processors < 1 ) goto Usage;
    136135                } // if
    137136          case 1:                                                                                       // use defaults
    138137                break;
    139138          default:
    140                 exit | "Usage: " | argv[0]
     139          Usage:
     140                sout | "Usage: " | argv[0]
    141141             | " [ processors (> 0) | 'd' (default " | Processors
    142142                         | ") ] [ channel size (>= 0) | 'd' (default " | ChannelSize
    143143                         | ") ]" ;
     144                exit( EXIT_FAILURE );
    144145        } // switch
    145 
    146146    test(Processors, Channels, Producers, Consumers, ChannelSize);
    147147}
  • tests/concurrency/channels/daisy_chain.cfa

    ra2c2363 re3784a50  
    88
    99size_t total_operations = 0;
    10 ssize_t Processors = 1, Tasks = 4;                                              // must be signed
     10size_t Processors = 1, Tasks = 4;
    1111
    1212owner_lock o;
     
    3737          case 3:
    3838                if ( strcmp( argv[2], "d" ) != 0 ) {                    // default ?
    39                         Tasks = ato( argv[2] );
    40             if ( Tasks < 1 ) fallthru default;
     39                        Tasks = atoi( argv[2] );
     40            if ( Tasks < 1 ) goto Usage;
    4141                } // if
    4242          case 2:
    4343                if ( strcmp( argv[1], "d" ) != 0 ) {                    // default ?
    44                         Processors = ato( argv[1] );
    45                         if ( Processors < 1 ) fallthru default;
     44                        Processors = atoi( argv[1] );
     45                        if ( Processors < 1 ) goto Usage;
    4646                } // if
    4747          case 1:                                                                                       // use defaults
    4848                break;
    4949          default:
    50                 exit | "Usage: " | argv[0]
     50          Usage:
     51                sout | "Usage: " | argv[0]
    5152             | " [ processors (> 0) | 'd' (default " | Processors
    5253                         | ") ] [ channel size (>= 0) | 'd' (default " | Tasks
    5354                         | ") ]" ;
     55                exit( EXIT_FAILURE );
    5456        } // switch
    5557    processor proc[Processors - 1];
     
    6971    // sout | total_operations;
    7072    sout | "done";
     73
     74    return 0;
    7175}
  • tests/concurrency/channels/hot_potato.cfa

    ra2c2363 re3784a50  
    88
    99size_t total_operations = 0;
    10 ssize_t Processors = 1, Tasks = 4;                                              // must be signed
     10size_t Processors = 1, Tasks = 4;
    1111
    1212owner_lock o;
     
    3838}
    3939
     40
    4041int main( int argc, char * argv[] ) {
    4142    switch ( argc ) {
    4243          case 3:
    4344                if ( strcmp( argv[2], "d" ) != 0 ) {                    // default ?
    44                         Tasks = ato( argv[2] );
    45             if ( Tasks < 1 ) fallthru default;
     45                        Tasks = atoi( argv[2] );
     46            if ( Tasks < 1 ) goto Usage;
    4647                } // if
    4748          case 2:
    4849                if ( strcmp( argv[1], "d" ) != 0 ) {                    // default ?
    49                         Processors = ato( argv[1] );
    50                         if ( Processors < 1 ) fallthru default;
     50                        Processors = atoi( argv[1] );
     51                        if ( Processors < 1 ) goto Usage;
    5152                } // if
    5253          case 1:                                                                                       // use defaults
    5354                break;
    5455          default:
    55                 exit | "Usage: " | argv[0]
     56          Usage:
     57                sout | "Usage: " | argv[0]
    5658             | " [ processors (> 0) | 'd' (default " | Processors
    5759                         | ") ] [ channel size (>= 0) | 'd' (default " | Tasks
    5860                         | ") ]" ;
     61                exit( EXIT_FAILURE );
    5962        } // switch
    60 
    6163    processor proc[Processors - 1];
    6264
  • tests/concurrency/channels/pub_sub.cfa

    ra2c2363 re3784a50  
    8787          case 3:
    8888                if ( strcmp( argv[2], "d" ) != 0 ) {                    // default ?
    89                         Tasks = ato( argv[2] );
    90             if ( Tasks < 1 ) fallthru default;
     89                        Tasks = atoi( argv[2] );
     90            if ( Tasks < 1 ) goto Usage;
    9191                } // if
    9292          case 2:
    9393                if ( strcmp( argv[1], "d" ) != 0 ) {                    // default ?
    94                         Processors = ato( argv[1] );
    95                         if ( Processors < 1 ) fallthru default;
     94                        Processors = atoi( argv[1] );
     95                        if ( Processors < 1 ) goto Usage;
    9696                } // if
    9797          case 1:                                                                                       // use defaults
    9898                break;
    9999          default:
    100                 exit | "Usage: " | argv[0]
     100          Usage:
     101                sout | "Usage: " | argv[0]
    101102             | " [ processors (> 0) | 'd' (default " | Processors
    102103                         | ") ] [ Tasks (> 0) | 'd' (default " | Tasks
    103104                         | ") ]" ;
     105                exit( EXIT_FAILURE );
    104106        } // switch
    105107    BarrierSize = Tasks;
  • tests/concurrency/examples/matrixSum.cfa

    ra2c2363 re3784a50  
    1010// Created On       : Mon Oct  9 08:29:28 2017
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Sep  8 19:05:34 2023
    13 // Update Count     : 19
     12// Last Modified On : Wed Feb 20 08:37:53 2019
     13// Update Count     : 16
    1414//
    1515
    1616#include <fstream.hfa>
     17#include <kernel.hfa>
    1718#include <thread.hfa>
    1819
     
    3435
    3536int main() {
    36         const int rows = 10, cols = 1000;
     37        /* const */ int rows = 10, cols = 1000;
    3738        int matrix[rows][cols], subtotals[rows], total = 0;
    3839        processor p;                                                                            // add kernel thread
    3940
    40         for ( r; rows ) {                                                                       // initialize
     41        for ( r; rows ) {
    4142                for ( c; cols ) {
    4243                        matrix[r][c] = 1;
    4344                } // for
    4445        } // for
    45 
    4646        Adder * adders[rows];
    4747        for ( r; rows ) {                                                                       // start threads to sum rows
    4848                adders[r] = &(*malloc()){ matrix[r], cols, subtotals[r] };
    49                 // adders[r] = new( matrix[r], cols, subtotals[r] );
     49//              adders[r] = new( matrix[r], cols, &subtotals[r] );
    5050        } // for
    51 
    5251        for ( r; rows ) {                                                                       // wait for threads to finish
    5352                delete( adders[r] );
     
    5857
    5958// Local Variables: //
     59// tab-width: 4 //
    6060// compile-command: "cfa matrixSum.cfa" //
    6161// End: //
  • tests/concurrency/unified_locking/locks.cfa

    ra2c2363 re3784a50  
    11#include <stdio.h>
    2 #include <locks.hfa>
     2#include "locks.hfa"
    33#include <stdlib.hfa>
    44#include <thread.hfa>
  • tests/concurrency/unified_locking/pthread_locks.cfa

    ra2c2363 re3784a50  
    11#include <stdio.h>
    2 #include <locks.hfa>
     2#include "locks.hfa"
    33#include <stdlib.hfa>
    44#include <thread.hfa>
  • tests/concurrency/unified_locking/test_debug.cfa

    ra2c2363 re3784a50  
    1 #include <locks.hfa>
     1#include "locks.hfa"
    22
    33fast_block_lock f;
  • tests/concurrency/unified_locking/thread_test.cfa

    ra2c2363 re3784a50  
    11#include <stdio.h>
    2 #include <locks.hfa>
     2#include "locks.hfa"
    33#include <stdlib.hfa>
    44#include <thread.hfa>
  • tests/minmax.cfa

    ra2c2363 re3784a50  
    4545        sout | "double\t\t\t"                           | 4.0 | 3.1 | "\tmax" | max( 4.0, 3.1 );
    4646        sout | "long double\t\t"                        | 4.0l | 3.1l | "\tmax" | max( 4.0l, 3.1l );
    47 
    48         sout | nl;
    49 
    50         sout | "3 arguments";
    51         sout | 2 | 3 | 4 | "\tmin" | min(2, 3, 4) | "\tmax" | max(2, 3, 4);
    52         sout | 4 | 2 | 3 | "\tmin" | min(4, 2, 3) | "\tmax" | max(4, 2, 3);
    53         sout | 3 | 4 | 2 | "\tmin" | min(3, 4, 2) | "\tmax" | max(3, 4, 2);
    54 
    55         sout | "4 arguments";
    56         sout | 3 | 2 | 5 | 4 | "\tmin" | min(3, 2, 5, 4) | "\tmax" | max(3, 2, 5, 4);
    57         sout | 5 | 3 | 4 | 2 | "\tmin" | min(5, 3, 4, 2) | "\tmax" | max(5, 3, 4, 2);
    5847} // main
    5948
Note: See TracChangeset for help on using the changeset viewer.