Ignore:
Timestamp:
Jun 10, 2024, 2:43:13 AM (4 weeks ago)
Author:
JiadaL <j82liang@…>
Branches:
master
Children:
42cdd07d
Parents:
d68de59
Message:
  1. Implement enum cast; 2. Change valueE so that opague enum returns quasi_void; 3. change enum hiding interpretation and pass visiting scheme
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/enum.cfa

    rd68de59 r85855b0  
    11#include "enum.hfa"
     2#include "fstream.hfa"
    23
    34#pragma GCC visibility push(default)
    45
    5 forall(T, E| TypedEnum(T, E)) {
    6     // constructors
     6forall(ostype & | basic_ostream(ostype), E, V| CfaEnum(E, V))
     7ostype & ?|?(ostype& os, E e) {
     8    return os | type_name(e) | "." | labelE(e);
     9}
    710
    8     // comparison
    9     int ?==?(E l, E r) { return posE(l) == posE(r); }
    10     int ?!=?(E l, E r) { return posE(l) != posE(r); }
    11     int ?!=?(E l, zero_t) { return !( posE(l) == 0 ); }
    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     int ?>=?(E l, E r) {  return posE(l) >= posE(r); }
     11forall(ostype & | basic_ostream(ostype), E| CfaEnum(E, quasi_void))
     12ostype & ?|?(ostype& os, E e) {
     13    return os | type_name(e) | "." | labelE(e);
    1614}
Note: See TracChangeset for help on using the changeset viewer.