source: libcfa/src/enum.cfa @ d5efcb7

Last change on this file since d5efcb7 was d5efcb7, checked in by Peter A. Buhr <pabuhr@…>, 5 months ago

first attempt at updating enum auxiliary operations

  • Property mode set to 100644
File size: 881 bytes
Line 
1#include "enum.hfa"
2#include "fstream.hfa"
3
4#pragma GCC visibility push(default)
5
6forall( ostype & | basic_ostream(ostype), E, V | CfaEnum(E, V) ) {
7        ostype & ?|?( ostype& os, E e ) {
8//              if ( scoped( e ) ) os | type_name( e ) | '.' | nonl;
9                return os | label( e );
10        }
11        OSTYPE_VOID_IMPL( E )
12}
13
14// forall( ostype & | basic_ostream(ostype), E | CfaEnum(E, quasi_void) )
15// ostype & ?|?( ostype & os, E e ) {
16// //    return os | type_name(e) | "." | label(e);
17//     return os | label( e );
18// }
19
20forall( E, V | CfaEnum(E, V) ) {                                                // relational operators
21    int ?==?(E l, E r) { return posn(l) == posn(r); }
22    int ?!=?(E l, E r) { return posn(l) != posn(r); }
23    int ?<?(E l, E r) { return posn(l) < posn(r); }
24    int ?<=?(E l, E r) { return posn(l) <= posn(r); }
25    int ?>?(E l, E r) { return posn(l) > posn(r); }
26    int ?>=?(E l, E r) { return posn(l) >= posn(r); }
27}
Note: See TracBrowser for help on using the repository browser.