/* See {gmo.h}. */ /* Last edited on 2020-10-03 20:37:06 by jstolfi */ #define _GNU_SOURCE_ #include #include #include #include #include #include #include #include #include gmo_opto_kind_t gmo_opto_kind_from_char(char c) { if (c == 'A') { return gmo_opto_kind_ABSORB; } else if (c == 'E') { return gmo_opto_kind_EMIT; } else if (c == 'T') { return gmo_opto_kind_TRANSMIT; } else if (c == 'R') { return gmo_opto_kind_REFLECT; } else { affirm(FALSE, "bad gmo_opto_kind_t character"); return gmo_opto_kind_ABSORB; /* To pacify the compiler. */ } } char gmo_opto_kind_to_char(gmo_opto_kind_t oknd) { switch (oknd) { case gmo_opto_kind_ABSORB: return 'A'; case gmo_opto_kind_EMIT: return 'E'; case gmo_opto_kind_REFLECT: return 'R'; case gmo_opto_kind_TRANSMIT: return 'T'; default: affirm(FALSE, "bad gmo_opto_kind_t"); return '?'; } }