Changes in / [10a9479d:de7b7a5]


Ignore:
Location:
libcfa
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • libcfa/prelude/builtins.c

    r10a9479d rde7b7a5  
    185185static inline quasi_void ?=?(quasi_void &, quasi_void & _src) { return _src; }
    186186
    187 forall( E ) trait Bounded {
    188         E lowerBound(void);
    189         E upperBound(void);
    190 };
    191 
    192 forall( E | Bounded( E ) ) trait Serial {
    193         int fromInstance( E e );
    194         E fromInt_unsafe( int i );
    195         E succ_unsafe( E e );
    196         E pred_unsafe( E e );
    197 };
    198 
    199 forall( E | Serial( E ) ) {
    200         E fromInt( int i );
    201         E succ( E e );
    202         E pred( E e );
    203         int Countof( E );
    204 }
    205 
    206 
    207 forall( E ) trait CfaEnum {
    208         const char * label( E e );
    209         int posn( E e );
    210 };
    211 
    212 forall( E, V | CfaEnum( E ) ) trait TypedEnum {
    213         V value( E e );
    214 };
    215 
    216187// Local Variables: //
    217188// mode: c //
  • libcfa/src/enum.hfa

    r10a9479d rde7b7a5  
    22
    33#include "iostream.hfa"
     4
     5forall( E ) trait Bounded {
     6        E lowerBound(void);
     7        E upperBound(void);
     8};
     9
     10forall( E | Bounded( E ) ) trait Serial {
     11        int fromInstance( E e );
     12        E fromInt_unsafe( int i );
     13        E succ_unsafe( E e );
     14        E pred_unsafe( E e );
     15};
     16
     17forall( E | Serial( E ) ) {
     18        E fromInt( int i );
     19        E succ( E e );
     20        E pred( E e );
     21        int Countof( E );
     22}
     23
     24// forall( E | Bounded(E) ) trait SafeSerial {
     25//       // unsigned fromInstance( E e );
     26//       E fromInt_unsafe( unsigned i );
     27//       // E succ_unsafe( E e );
     28//       //E pred_unsafe( E e );
     29
     30//       unsigned fromInstance( E e );
     31//       E fromInt( unsigned i );
     32//       E succ( E e );
     33//       E pred( E e );
     34// };
     35
     36forall( E ) trait CfaEnum {
     37        const char * label( E e );
     38        int posn( E e );
     39};
     40
     41forall( E, V | CfaEnum( E ) ) trait TypedEnum {
     42        V value( E e );
     43};
     44
     45// I/O
    446
    547forall( istype & | istream( istype ), E | CfaEnum( E ) | Serial(E) )
Note: See TracChangeset for help on using the changeset viewer.