Changeset bc07190 for libcfa


Ignore:
Timestamp:
Jun 29, 2024, 7:33:28 AM (4 months ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
master
Children:
011c29e
Parents:
62a38e7 (diff), 115ac1ce (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' of plg.uwaterloo.ca:software/cfa/cfa-cc

Location:
libcfa/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/enum.cfa

    r62a38e7 rbc07190  
    44#pragma GCC visibility push(default)
    55
    6 forall(ostype & | basic_ostream(ostype), E, V| CfaEnum(E, V))
    7 ostype & ?|?(ostype& os, E e) {
    8     return os | type_name(e) | "." | label(e);
     6forall( ostype & | basic_ostream(ostype), E, V | CfaEnum(E, V) ) {
     7        ostype & ?|?( ostype& os, E e ) {
     8                return os | label( e );
     9        }
     10        OSTYPE_VOID_IMPL( E )
    911}
    1012
    11 forall(ostype & | basic_ostream(ostype), E| CfaEnum(E, quasi_void))
    12 ostype & ?|?(ostype& os, E e) {
    13     return os | type_name(e) | "." | label(e);
     13forall( ostype & | basic_ostream(ostype), E | CfaEnum(E, quasi_void) )
     14ostype & ?|?( ostype & os, E e ) {
     15    return os | label( e );
    1416}
    1517
    16 forall(ostype & | basic_ostream(ostype), E, V| CfaEnum(E, V)) {
     18forall( E, V | CfaEnum(E, V) ) {                                                // relational operators
    1719    int ?==?(E l, E r) { return posn(l) == posn(r); }
     20    int ?!=?(E l, E r) { return posn(l) != posn(r); }
     21    int ?<?(E l, E r) { return posn(l) < posn(r); }
    1822    int ?<=?(E l, E r) { return posn(l) <= posn(r); }
     23    int ?>?(E l, E r) { return posn(l) > posn(r); }
    1924    int ?>=?(E l, E r) { return posn(l) >= posn(r); }
    20     int ?<?(E l, E r) { return posn(l) < posn(r); }
    21     int ?>?(E l, E r) { return posn(l) > posn(r); }
    2225}
  • libcfa/src/enum.hfa

    r62a38e7 rbc07190  
    33#include "iostream.hfa"
    44
    5 forall(E) trait Bounded {
     5forall( E ) trait Bounded {
    66    E lowerBound();
    77    E upperBound();
    88};
    99
    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);
     10forall( 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 );
    1515};
    1616
    1717// 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);
     18forall( E, V | Serial(E) ) trait CfaEnum {
     19    char * label( E e );
     20    unsigned int posn( E e );
     21    V value( E e );
    2322};
    2423
    25 forall(ostype & | basic_ostream(ostype), E, V | CfaEnum(E, V))
    26 ostype & ?|?(ostype&, E);
     24// I/O
    2725
    28 forall(ostype & | basic_ostream(ostype), E| CfaEnum(E, quasi_void))
    29 ostype & ?|?(ostype&, E);
     26forall( ostype & | basic_ostream(ostype), E, V | CfaEnum(E, V) ) {
     27        ostype & ?|?( ostype &, E );
     28        OSTYPE_VOID( E );
     29}
     30
     31forall( ostype & | basic_ostream(ostype), E | CfaEnum(E, quasi_void) )
     32ostype & ?|?( ostype &, E );
    3033
    3134// Design two <- should go for this if we have change the cost model
     
    3942// };
    4043
    41 forall(ostype & | basic_ostream(ostype), E, V| CfaEnum(E, V)) {
     44forall( E, V | CfaEnum(E, V) ) {                                                // relational operators
    4245    int ?==?(E, E);
     46    int ?!=?(E, E);
     47    int ?<?(E, E);
    4348    int ?<=?(E, E);
     49    int ?>?(E, E);
    4450    int ?>=?(E, E);
    45     int ?<?(E, E);
    46     int ?>?(E, E);
    47 
    48         // E ++?( E & lhs );
    49         // E ?++( E & lhs );
    5051}
Note: See TracChangeset for help on using the changeset viewer.