source: libcfa/src/enum.cfa @ c333ed2

Last change on this file since c333ed2 was c333ed2, checked in by JiadaL <j82liang@…>, 2 months ago

Remove intermeidate type (enum attribute type); remove replacePseudoFunc (has been migrated to resolver)

  • Property mode set to 100644
File size: 746 bytes
Line 
1#include "enum.hfa"
2#include "fstream.hfa"
3
4forall(E, T| TypedEnum(E, T)) {
5    // constructors
6
7    // comparison
8    int ?==?(E l, E r) { return posE(l) == posE(r); }
9    int ?!=?(E l, E r) { return !(l == r); }
10    int ?!=?(E l, zero_t) { return !( posE(l) == 0 ); }
11    int ?<?(E l, E r) { return posE(l) < posE(r); }
12    int ?<=?(E l, E r) { return posE(l) <= posE(r); }
13    int ?>?(E l, E r) { return posE(l) > posE(r); }
14    int ?>=?(E l, E r) {  return posE(l) >= posE(r); }
15
16    // for testing; To be removed
17    // #include <string.h>
18    char * typeEnumString(E e) {
19        // char* out = malloc(sizeof(char) * (5 + strlen(labelE(e) + 1)));
20        // return strcat(strcat(out, "Enum "), labelE(e));
21        return labelE(e);
22    }
23}
Note: See TracBrowser for help on using the repository browser.