Changeset 200fcb3 for tests/coroutine


Ignore:
Timestamp:
Dec 12, 2018, 9:16:12 AM (5 years ago)
Author:
Peter A. Buhr <pabuhr@…>
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:
5ebb1368
Parents:
3d99498
Message:

add auto newline to sout, change endl to nl

Location:
tests/coroutine
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • tests/coroutine/.expect/fmtLines.txt

    r3d99498 r200fcb3  
    1616difi  ed B  y :   Pete  r A. 
    1717 Buh  r//   Last   Mod  ifie 
    18 d On   : M  on S  ep 1  8 11 
    19 :35:  57 2  017/  / Up  date 
    20  Cou  nt       :   31/  /#in 
     18d On   : T  ue D  ec 1  1 23 
     19:31:  12 2  018/  / Up  date 
     20 Cou  nt       :   32/  /#in 
    2121clud  e <f  stre  am.h  fa># 
    2222incl  ude   <cor  outi  ne.h 
     
    3434t )   {      if   ( fm  t.g   
    3535!= 0   ||   fmt.  b !=   0 ) 
    36  sou  t |   endl  ;}vo  id m 
    37 ain(   For  mat   & fm  t )   
    38 {       fo  r (   ;; )   {                                               
    39                                   // f  or a  s ma  ny c 
    40 hara  cter  s           f  or (   fmt 
    41 .g =   0;   fmt.  g <   5; f 
    42 mt.g   +=   1 )   {             /  / gr 
    43 oups   of   5 bl  ocks                          f 
    44 or (   fmt  .b =   0;   fmt. 
    45 b <   4; f  mt.b   +=   1 )   
    46 {       //   blo  cks   of 4   cha 
    47 ract  ers                               f  or (   ;;   
    48 ) {                                                     //   for   new 
    49 line   cha  ract  ers                                     
    50 susp  end(  );                                  i  f (   
    51 fmt.  ch !  = '\  n' )   bre 
    52 ak;             //   igno  re n  ewli 
    53 ne                              }   // f  or                            so 
    54 ut |   fmt  .ch;                                                        / 
    55 / pr  int   char  acte  r                         
    56 } //   for                      s  out   | "   
    57  ";                                                             /  / pr  int   
    58 bloc  k se  para  tor           } / 
    59 / fo  r         s  out   | en  dl;       
    60                                                                   // p  rint   gro 
    61 up s  epar  ator        } /  / fo 
    62 r} /  / ma  invo  id p  rt(   
    63 Form  at &   fmt  , ch  ar c 
    64 h )   {      fmt  .ch   = ch 
    65 ;      res  ume(   fmt   );} 
    66  //   prti  nt m  ain(  ) {       
    67 Form  at f  mt;   char   ch; 
    68         for   ( ;  ; )   {              s  in | 
    69  ch;                                                                            //   rea 
    70 d on  e ch  arac  ter       if 
    71  ( e  of(   sin   ) )   brea 
    72 k;                                                      //   eof   ?            p 
    73 rt(   fmt,   ch   );    }   //   
    74 for}   //   main  // L  ocal 
    75  Var  iabl  es:   ////   tab 
    76 -wid  th:   4 //  // c  ompi 
    77 le-c  omma  nd:   "cfa   fmt 
    78 Line  s.c"   ///  / En  d: / 
    79 /
     36 sou  t |   nl;}  void   mai 
     37n( F  orma  t &   fmt   ) {       
     38for   ( ;;   ) {                                                                 
     39                //   for   as   many   cha 
     40ract  ers               for   ( f  mt.g 
     41 = 0  ; fm  t.g   < 5;   fmt 
     42.g +  = 1   ) {         //   grou 
     43ps o  f 5   bloc  ks                    for 
     44 ( f  mt.b   = 0  ; fm  t.b   
     45< 4;   fmt  .b +  = 1   ) {       
     46// b  lock  s of   4 c  hara 
     47cter  s                         for   ( ;  ; )   
     48{                                                         // f  or n  ewli 
     49ne c  hara  cter  s                                     su 
     50spen  d();                                      if   ( fm 
     51t.ch   !=   '\n'   ) b  reak 
     52;               /  / ig  nore   new  line 
     53                                  } //   for                              sout 
     54 | f  mt.c  h;                                                  //   
     55prin  t ch  arac  ter                   }   
     56// f  or                        sou  t |   "  " 
     57;                                                               //   prin  t bl 
     58ock   sepa  rato  r             }   //   
     59for             sou  t |   nl;                                   
     60                                  // p  rint   gro  up s 
     61epar  ator      } /  / fo  r} / 
     62/ ma  invo  id p  rt(   Form 
     63at &   fmt  , ch  ar c  h )   
     64{      fmt  .ch   = ch  ;     
     65 res  ume(   fmt   );}   //   
     66prti  nt m  ain(  ) {     Form 
     67at f  mt;         char   ch;    for 
     68 ( ;  ; )   {           s  in |   ch; 
     69                                                                                //   rea  d on 
     70e ch  arac  ter     if   ( e 
     71of(   sin   ) )   brea  k;               
     72                                        //   eof   ?            p  rt(   
     73fmt,   ch   );  }   //   for} 
     74 //   main  // L  ocal   Var 
     75iabl  es:   ////   tab  -wid 
     76th:   4 //  // c  ompi  le-c 
     77omma  nd:   "cfa   fmt  Line 
     78s.c"   ///  / En  d: /  /
  • tests/coroutine/.in/fmtLines.txt

    r3d99498 r200fcb3  
    1010// Created On       : Sun Sep 17 21:56:15 2017
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Sep 18 11:35:57 2017
    13 // Update Count     : 31
     12// Last Modified On : Tue Dec 11 23:31:12 2018
     13// Update Count     : 32
    1414//
    1515
     
    2727
    2828void ^?{}( Format & fmt ) {
    29     if ( fmt.g != 0 || fmt.b != 0 ) sout | endl;
     29    if ( fmt.g != 0 || fmt.b != 0 ) sout | nl;
    3030}
    3131
     
    4242                        sout | "  ";                                                            // print block separator
    4343                } // for
    44                 sout | endl;                                                                    // print group separator
     44                sout | nl;                                                                      // print group separator
    4545        } // for
    4646} // main
  • tests/coroutine/fibonacci.c

    r3d99498 r200fcb3  
    1010// Created On       : Thu Jun  8 07:29:37 2017
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sat Aug 18 11:21:58 2018
    13 // Update Count     : 24
     12// Last Modified On : Tue Dec 11 21:57:33 2018
     13// Update Count     : 25
    1414//
    1515
     
    3939        Fibonacci f1, f2;
    4040        for ( 10 ) {                                                                            // print N Fibonacci values
    41                 sout | next( f1 ) | next( f2 ) | endl;
     41                sout | next( f1 ) | next( f2 );
    4242        } // for
    4343}
  • tests/coroutine/fibonacci_1.c

    r3d99498 r200fcb3  
    1010// Created On       : Thu Apr 26 23:20:08 2018
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sat Aug 18 11:21:02 2018
    13 // Update Count     : 13
     12// Last Modified On : Tue Dec 11 21:57:54 2018
     13// Update Count     : 14
    1414//
    1515
     
    3636        Fibonacci f1, f2;
    3737        for ( 10 ) {                                                                            // print N Fibonacci values
    38                 sout | next( f1 ) | next( f2 ) | endl;
     38                sout | next( f1 ) | next( f2 );
    3939        } // for
    4040}
  • tests/coroutine/fmtLines.c

    r3d99498 r200fcb3  
    1010// Created On       : Sun Sep 17 21:56:15 2017
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Aug 16 08:20:54 2018
    13 // Update Count     : 45
     12// Last Modified On : Tue Dec 11 21:58:49 2018
     13// Update Count     : 47
    1414//
    1515
     
    3434                        sout | "  ";                                                            // print block separator
    3535                } // for
    36                 sout | endl;                                                                    // print group separator
     36                sout | nl;                                                                              // print group separator
    3737        } // for
    3838} // main
     
    4343
    4444void ^?{}( Format & fmt ) with( fmt ) {
    45         if ( g != 0 || b != 0 ) sout | endl;
     45        if ( g != 0 || b != 0 ) sout | nl;
    4646}
    4747
     
    5252int main() {
    5353        Format fmt;
     54        sout | nlOff;                                                                           // turn off auto newline
    5455
    5556  eof: for () {                                                                                 // read until end of file
  • tests/coroutine/pingpong.c

    r3d99498 r200fcb3  
    1010// Created On       : Wed Sep 20 11:55:23 2017
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sat Aug 18 11:31:11 2018
    13 // Update Count     : 28
     12// Last Modified On : Tue Dec 11 21:58:06 2018
     13// Update Count     : 29
    1414//
    1515
     
    4040void main( PingPong & pingpong ) {                                              // ping's starter ::main, pong's starter ping
    4141        for ( pingpong.N ) {                                                            // N ping-pongs
    42                 sout | pingpong.name | endl;
     42                sout | pingpong.name;
    4343                cycle( *pingpong.part );
    4444        } // for
  • tests/coroutine/prodcons.c

    r3d99498 r200fcb3  
    1010// Created On       : Mon Sep 18 12:23:39 2017
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sat Aug 18 12:55:10 2018
    13 // Update Count     : 51
     12// Last Modified On : Tue Dec 11 21:58:25 2018
     13// Update Count     : 52
    1414//
    1515
     
    3232                int p1 = random( 100 );
    3333                int p2 = random( 100 );
    34                 sout | p1 | " " | p2 | endl;
     34                sout | p1 | " " | p2;
    3535                int status = delivery( *c, p1, p2 );
    36                 sout | " $" | money | endl;
    37                 sout | status | endl;
     36                sout | " $" | money;
     37                sout | status;
    3838                receipt += 1;
    3939        }
    4040        stop( *c );
    41         sout | "prod stops" | endl;
     41        sout | "prod stops";
    4242}
    4343int payment( Prod & prod, int money ) {
     
    6868        int money = 1, receipt;
    6969        for ( ; ! done; ) {
    70                 sout | p1 | " " | p2 | endl;
    71                 sout | " $" | money | endl;
     70                sout | p1 | " " | p2;
     71                sout | " $" | money;
    7272                status += 1;
    7373                receipt = payment( *p, money );
    74                 sout | " #" | receipt | endl;
     74                sout | " #" | receipt;
    7575                money += 1;
    7676        }
    77         sout | "cons stops" | endl;
     77        sout | "cons stops";
    7878}
    7979int delivery( Cons & cons, int p1, int p2 ) {
     
    9292        srandom( /* getpid() */ 103 );                                          // fixed seed for testing
    9393        start( prod, 5, cons );
    94         sout | "main stops" | endl;
     94        sout | "main stops";
    9595}
    9696
  • tests/coroutine/runningTotal.c

    r3d99498 r200fcb3  
    1010// Created On       : Wed Dec  6 08:05:27 2017
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Aug 16 08:22:29 2018
    13 // Update Count     : 3
     12// Last Modified On : Tue Dec 11 21:59:00 2018
     13// Update Count     : 4
    1414//
    1515
     
    4242        RunTotal rntl;
    4343        for ( i; 10 ) {
    44                 sout | i | add( rntl, i ) | endl;
     44                sout | i | add( rntl, i );
    4545        } // for
    4646}
Note: See TracChangeset for help on using the changeset viewer.