Changeset 062467b for libcfa/src/enum.cfa
- Timestamp:
- Jul 2, 2024, 3:18:37 PM (7 weeks ago)
- Branches:
- master
- Children:
- 597f284
- Parents:
- bc48c0d
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/enum.cfa
rbc48c0d r062467b 10 10 int args = fmt( is, "%255s", val ); 11 11 if ( ! eof( is ) && args != 1 ) throwResume ExceptionInst( missing_data ); 12 for ( s; E ) {13 if ( val == label( s ) ) { e = s; break; }14 } else {15 fprintf( stderr, "invalid enumeration constant\n" );16 abort(); // cannot use abort stream17 } // for12 // for ( s; E ) { 13 // if ( val == label( s ) ) { e = s; break; } 14 // } else { 15 // fprintf( stderr, "invalid enumeration constant\n" ); 16 // abort(); // cannot use abort stream 17 // } // for 18 18 return is; 19 19 } … … 32 32 OSTYPE_VOID_IMPL( E ) 33 33 } 34 35 forall( E, V | CfaEnum( E, V ) ) { // relational operators36 int ?==?( E l, E r ) { return posn( l ) == posn( r ); }37 int ?!=?( E l, E r ) { return posn( l ) != posn( r ); }38 int ?<?( E l, E r ) { return posn( l ) < posn( r ); }39 int ?<=?( E l, E r ) { return posn( l ) <= posn( r ); }40 int ?>?( E l, E r ) { return posn( l ) > posn( r ); }41 int ?>=?( E l, E r ) { return posn( l ) >= posn( r ); }42 43 E ++?( E & l ) {44 l = succ( l );45 return l;46 }47 48 E ?++( E & l ) {49 E ret = l;50 l = succ( l );51 return ret;52 }53 54 E --?( E & l ) {55 l = pred( l );56 return l;57 }58 59 E ?--( E & l ) {60 E ret = l;61 l = pred( l );62 return ret;63 }64 }
Note: See TracChangeset
for help on using the changeset viewer.