Last change
on this file since c333ed2 was
c333ed2,
checked in by JiadaL <j82liang@…>, 5 months ago
|
Remove intermeidate type (enum attribute type); remove replacePseudoFunc (has been migrated to resolver)
|
-
Property mode set to
100644
|
File size:
706 bytes
|
Rev | Line | |
---|
[72713e5] | 1 | #pragma once |
---|
| 2 | |
---|
| 3 | forall(E) trait Bounded { |
---|
| 4 | E lowerBound(); |
---|
| 5 | E upperBound(); |
---|
| 6 | }; |
---|
| 7 | |
---|
[c333ed2] | 8 | forall(E, T| Bounded(E)) trait Serial { |
---|
[72713e5] | 9 | unsigned fromInstance(E e); |
---|
| 10 | E fromInt(unsigned i); |
---|
| 11 | E succ(E e); |
---|
| 12 | E pred(E e); |
---|
| 13 | }; |
---|
| 14 | |
---|
[c333ed2] | 15 | // Opague Enum + TypedEnum |
---|
| 16 | forall(E, T | Serial(E, T)) trait CfaEnum { |
---|
[72713e5] | 17 | char * labelE(E e); |
---|
| 18 | unsigned int posE(E e); |
---|
| 19 | }; |
---|
| 20 | |
---|
[c333ed2] | 21 | forall(E, T | CfaEnum(E, T)) trait TypedEnum { |
---|
| 22 | T valueE(E e); |
---|
| 23 | }; |
---|
| 24 | |
---|
[72713e5] | 25 | forall(E, T| TypedEnum(E, T)) { |
---|
| 26 | // comparison |
---|
| 27 | int ?==?(E l, E r); |
---|
| 28 | int ?!=?(E l, E r); |
---|
| 29 | int ?!=?(E l, zero_t); |
---|
| 30 | int ?<?(E l, E r); |
---|
| 31 | int ?<=?(E l, E r); |
---|
| 32 | int ?>?(E l, E r); |
---|
| 33 | int ?>=?(E l, E r); |
---|
[c333ed2] | 34 | |
---|
| 35 | // for testing; To be removed |
---|
| 36 | char * typeEnumString(E e); |
---|
[72713e5] | 37 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.