source: libcfa/src/enum.cfa@ 55ba259e

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

first attempt at updating enum auxiliary operations

  • Property mode set to 100644
File size: 881 bytes
RevLine 
[c333ed2]1#include "enum.hfa"
[85855b0]2#include "fstream.hfa"
[c333ed2]3
[03ac869]4#pragma GCC visibility push(default)
5
[d5efcb7]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 )
[85855b0]12}
[c333ed2]13
[d5efcb7]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// }
[525f7ad]19
[d5efcb7]20forall( E, V | CfaEnum(E, V) ) { // relational operators
[5eb3f65]21 int ?==?(E l, E r) { return posn(l) == posn(r); }
[d5efcb7]22 int ?!=?(E l, E r) { return posn(l) != posn(r); }
[5eb3f65]23 int ?<?(E l, E r) { return posn(l) < posn(r); }
[d5efcb7]24 int ?<=?(E l, E r) { return posn(l) <= posn(r); }
[5eb3f65]25 int ?>?(E l, E r) { return posn(l) > posn(r); }
[d5efcb7]26 int ?>=?(E l, E r) { return posn(l) >= posn(r); }
[525f7ad]27}
Note: See TracBrowser for help on using the repository browser.