Changeset d5efcb7 for libcfa/src/enum.hfa
- Timestamp:
- Jun 25, 2024, 10:53:13 PM (4 months ago)
- Branches:
- master
- Children:
- 55ba259e, d3aa55e9
- Parents:
- 343c8be
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/enum.hfa
r343c8be rd5efcb7 3 3 #include "iostream.hfa" 4 4 5 forall( E) trait Bounded {5 forall( E ) trait Bounded { 6 6 E lowerBound(); 7 7 E upperBound(); 8 8 }; 9 9 10 forall( E | Bounded(E)) trait Serial {11 unsigned fromInstance( E e);12 E fromInt( unsigned i);13 E succ( E e);14 E pred( E e);10 forall( E | Bounded(E) ) trait Serial { 11 unsigned fromInstance( E e ); 12 E fromInt( unsigned i ); 13 E succ( E e ); 14 E pred( E e ); 15 15 }; 16 16 17 17 // Design one 18 forall(E, V | Serial(E)) trait CfaEnum { 19 char * label(E e); 20 unsigned int posn(E e); 21 V value(E e); 22 char * type_name(E e); 18 forall( E, V | Serial(E) ) trait CfaEnum { 19 char * label( E e ); 20 unsigned int posn( E e ); 21 V value( E e ); 22 char * type_name( E e ); 23 // bool scoped( E e ); 23 24 }; 24 25 25 forall(ostype & | basic_ostream(ostype), E, V | CfaEnum(E, V)) 26 ostype & ?|?(ostype&, E); 26 // I/O 27 27 28 forall(ostype & | basic_ostream(ostype), E| CfaEnum(E, quasi_void)) 29 ostype & ?|?(ostype&, E); 28 forall( ostype & | basic_ostream(ostype), E, V | CfaEnum(E, V) ) { 29 ostype & ?|?( ostype &, E ); 30 OSTYPE_VOID( E ); 31 } 32 33 //forall( ostype & | basic_ostream(ostype), E | CfaEnum(E, quasi_void) ) 34 //ostype & ?|?( ostype &, E ); 30 35 31 36 // Design two <- should go for this if we have change the cost model … … 39 44 // }; 40 45 41 forall( ostype & | basic_ostream(ostype), E, V| CfaEnum(E, V)) {46 forall( E, V | CfaEnum(E, V) ) { // relational operators 42 47 int ?==?(E, E); 48 int ?!=?(E, E); 49 int ?<?(E, E); 43 50 int ?<=?(E, E); 51 int ?>?(E, E); 44 52 int ?>=?(E, E); 45 int ?<?(E, E);46 int ?>?(E, E);47 48 // E ++?( E & lhs );49 // E ?++( E & lhs );50 53 }
Note: See TracChangeset
for help on using the changeset viewer.