34 if (name->value == value) {
43 if ((name->value & value) == name->value) {
45 string = $$(
String,
string);
61 const char *c = chars;
63 const size_t size = strcspn(c,
" |");
66 for (en = names; en->
name; en++) {
67 if (strncmp(en->
name, c, size) == 0) {
71 if (en->
alias && strncmp(en->
alias, c, size) == 0) {
76 if (en->
name == NULL) {
77 fprintf(stderr,
"%s: Unknown character sequence: %s\n", __func__, c);
int valueof(const EnumName *names, const char *chars)
Parse string, returning the corresponding enum value.
String * nameof(const EnumName *names, int value)
Marshal value, returning a String of OR'ed EnumNames for the given enum value.
static String * string(void)
static void appendCharacters(String *self, const char *chars)
static String * stringWithCharacters(const char *chars)