Changes in / [1dd5fd1:09dd830]


Ignore:
Location:
libcfa/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/enum.cfa

    r1dd5fd1 r09dd830  
    4242        if ( eof( is ) ) throwResume ExceptionInst( missing_data );
    4343
    44         // Match longest input enumerator string to enumerator labels, where enumerator names are unique.
    45 
     44        // Match input enumerator string to enumerator labels.
    4645        int N = Countof( e ), lnths[N], max = 0;
    4746//      printf( "N %d\n", N );
     
    6160        for ( c; max ) {
    6261                int args = fmt( is, "%c", &ch );                                // read character
    63           if ( eof( is ) ) {
     62                if ( eof( is ) ) {
    6463//                      fprintf( stderr, "Eof1\n" );
    6564                        if ( c == 0 ) return is;                                        // no characters read ?
    66                         clear( is );                                                            // => read something => reset EOF => detect again on next read
     65                        clear( is );                                                            // => reset EOF => detect again on next read
    6766//                      fprintf( stderr, "Eof2\n" );
    68                         break;
    69                 } // if
     67                        goto W;
     68                }
    7069                if ( args != 1 ) throwResume ExceptionInst( missing_data );
    71 
    7270//              printf( "read '%c'\n", ch );
    73                 for ( i; N ) {                                                                  // scan enumeration strings for winner
     71                for ( i; N ) {
    7472//                      printf( "%d %d %d\n", c, i, lnths[i] );
    7573                        if ( c < lnths[i] ) {                                           // eligible for this checking round ?
    7674                                char match = label( fromInt( i ) )[c];  // optimization
    7775//                              printf( "%c '%c'\n", match, ch );
    78                                 // Stop on first match, could be other matches.
    7976                                if ( (match == ch) && (c == 0 || curr == label( fromInt( i ) )[c - 1]) ) {
    8077//                                      printf( "match %d %d %d '%c' '%c' '%c' '%c' 'c'\n", c, i, lnths[i], match, ch, prev, label( fromInt( i ) )[c - 1] );
     
    9592//              fprintf( stderr, "finished2 %d\n", win );
    9693        } // for
    97   W: ;
    98         for ( i; N ) {                                                                          // scan enumeration strings for winner
     94  W :;
     95        for ( i; N ) {                                                                          // scan for winner, must succeed
    9996                if ( win == lnths[i] - 1 ) {
    10097                        char match = label( fromInt( i ) )[win];        // optimization
     
    103100                                e = fromInt( i );
    104101                                break;
    105                         } // if
     102                        }
    106103                } // if
    107104        } else {
  • libcfa/src/iostream.cfa

    r1dd5fd1 r09dd830  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Jul 15 08:16:48 2024
    13 // Update Count     : 2020
     12// Last Modified On : Fri Jul 12 05:45:45 2024
     13// Update Count     : 2019
    1414//
    1515
     
    781781                // Optional leading whitespace at start of strings.
    782782                fmt( is, " " FALSE "%n", &len );                                // try false
    783                 if ( len != sizeof( FALSE ) - 1 ) {                             // -1 removes null terminate
     783                if ( len != sizeof( FALSE ) - 1 ) {                             // remove null terminate
    784784                        fmt( is, " " TRUE "%n", &len );                         // try true
    785785                        if ( len != sizeof( TRUE ) - 1 ) throwResume ExceptionInst( missing_data );
Note: See TracChangeset for help on using the changeset viewer.