Changes in / [1dd5fd1:09dd830]
- Location:
- libcfa/src
- Files:
-
- 2 edited
-
enum.cfa (modified) (4 diffs)
-
iostream.cfa (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/enum.cfa
r1dd5fd1 r09dd830 42 42 if ( eof( is ) ) throwResume ExceptionInst( missing_data ); 43 43 44 // Match longest input enumerator string to enumerator labels, where enumerator names are unique. 45 44 // Match input enumerator string to enumerator labels. 46 45 int N = Countof( e ), lnths[N], max = 0; 47 46 // printf( "N %d\n", N ); … … 61 60 for ( c; max ) { 62 61 int args = fmt( is, "%c", &ch ); // read character 63 if ( eof( is ) ) {62 if ( eof( is ) ) { 64 63 // fprintf( stderr, "Eof1\n" ); 65 64 if ( c == 0 ) return is; // no characters read ? 66 clear( is ); // => re ad something => reset EOF => detect again on next read65 clear( is ); // => reset EOF => detect again on next read 67 66 // fprintf( stderr, "Eof2\n" ); 68 break;69 } // if67 goto W; 68 } 70 69 if ( args != 1 ) throwResume ExceptionInst( missing_data ); 71 72 70 // printf( "read '%c'\n", ch ); 73 for ( i; N ) { // scan enumeration strings for winner71 for ( i; N ) { 74 72 // printf( "%d %d %d\n", c, i, lnths[i] ); 75 73 if ( c < lnths[i] ) { // eligible for this checking round ? 76 74 char match = label( fromInt( i ) )[c]; // optimization 77 75 // printf( "%c '%c'\n", match, ch ); 78 // Stop on first match, could be other matches.79 76 if ( (match == ch) && (c == 0 || curr == label( fromInt( i ) )[c - 1]) ) { 80 77 // printf( "match %d %d %d '%c' '%c' '%c' '%c' 'c'\n", c, i, lnths[i], match, ch, prev, label( fromInt( i ) )[c - 1] ); … … 95 92 // fprintf( stderr, "finished2 %d\n", win ); 96 93 } // for 97 W :;98 for ( i; N ) { // scan enumeration strings for winner94 W :; 95 for ( i; N ) { // scan for winner, must succeed 99 96 if ( win == lnths[i] - 1 ) { 100 97 char match = label( fromInt( i ) )[win]; // optimization … … 103 100 e = fromInt( i ); 104 101 break; 105 } // if102 } 106 103 } // if 107 104 } else { -
libcfa/src/iostream.cfa
r1dd5fd1 r09dd830 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Mon Jul 15 08:16:48202413 // Update Count : 20 2012 // Last Modified On : Fri Jul 12 05:45:45 2024 13 // Update Count : 2019 14 14 // 15 15 … … 781 781 // Optional leading whitespace at start of strings. 782 782 fmt( is, " " FALSE "%n", &len ); // try false 783 if ( len != sizeof( FALSE ) - 1 ) { // -1 removesnull terminate783 if ( len != sizeof( FALSE ) - 1 ) { // remove null terminate 784 784 fmt( is, " " TRUE "%n", &len ); // try true 785 785 if ( len != sizeof( TRUE ) - 1 ) throwResume ExceptionInst( missing_data );
Note:
See TracChangeset
for help on using the changeset viewer.