Changeset 93c86ac


Ignore:
Timestamp:
Jun 17, 2023, 1:26:32 PM (17 months ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
master
Children:
c8f0199
Parents:
dc9dd94
Message:

formatting and comments

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tests/coroutine/devicedriver.cfa

    rdc9dd94 r93c86ac  
    1010// Created On       : Sat Mar 16 15:30:34 2019
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sat Apr 20 09:07:19 2019
    13 // Update Count     : 90
     12// Last Modified On : Sat Jun 17 09:11:56 2023
     13// Update Count     : 94
    1414//
    1515
     
    1818
    1919enum Status { CONT, MSG, ESTX, ELNTH, ECRC };
     20
    2021coroutine Driver {
    2122        Status status;
     
    2324}; // Driver
    2425
    25 void ?{}( Driver & d, char * m ) { d.msg = m; }
    26 Status next( Driver & d, char b ) with( d ) {
    27         byte = b; resume( d ); return status;
     26void ?{}( Driver & d, char * m ) { d.msg = m; }                 // constructor
     27
     28Status next( Driver & d, char b ) with( d ) {                   // called by interrupt handler
     29        byte = b; resume( d ); return status;                           // resume coroutine at last suspend
    2830} // next
    2931
     
    7375          if ( eof( sin ) ) break eof;                                          // eof ?
    7476                choose( next( driver, byte ) ) {                                // analyse character
    75                   case MSG:
    76                         sout | "msg:" | msg;
    77                   case ESTX:
    78                         sout | "STX in message";
    79                   case ELNTH:
    80                         sout | "message too long";
    81                   case ECRC:
    82                         sout | "CRC failure";
    83                   default: ;
     77                  case CONT: ;
     78                  case MSG: sout | "msg:" | msg;
     79                  case ESTX: sout | "STX in message";
     80                  case ELNTH: sout | "message too long";
     81                  case ECRC: sout | "CRC failure";
    8482                } // choose
    8583        } // for
     
    8785
    8886// Local Variables: //
    89 // tab-width: 4 //
    9087// compile-command: "cfa -g -Wall -Wextra devicedriver.cfa" //
    9188// End: //
Note: See TracChangeset for help on using the changeset viewer.