mirror of https://gitlab.com/nakst/essence
header generator: fix bitsets in odin 3
This commit is contained in:
parent
e2c8dc3783
commit
7444967ece
|
@ -922,6 +922,7 @@ void OutputOdinFunction(Entry *entry, Entry *root) {
|
||||||
// FilePrintFormat(stderr, "initial value: %s\n", variable->variable.initialValue);
|
// FilePrintFormat(stderr, "initial value: %s\n", variable->variable.initialValue);
|
||||||
|
|
||||||
const char *initialValue = TrimPrefix(variable->variable.initialValue);
|
const char *initialValue = TrimPrefix(variable->variable.initialValue);
|
||||||
|
bool needLeadingDot = false;
|
||||||
|
|
||||||
if (0 == strcmp(initialValue, "NULL")) {
|
if (0 == strcmp(initialValue, "NULL")) {
|
||||||
initialValue = "nil";
|
initialValue = "nil";
|
||||||
|
@ -929,29 +930,27 @@ void OutputOdinFunction(Entry *entry, Entry *root) {
|
||||||
initialValue = "\"\"";
|
initialValue = "\"\"";
|
||||||
} else if (0 == strcmp(initialValue, "FLAGS_DEFAULT")) {
|
} else if (0 == strcmp(initialValue, "FLAGS_DEFAULT")) {
|
||||||
initialValue = "{}";
|
initialValue = "{}";
|
||||||
}
|
} else {
|
||||||
|
for (int i = 0; i < arrlen(root->children); i++) {
|
||||||
|
Entry *entry = root->children + i;
|
||||||
|
|
||||||
bool needLeadingDot = false;
|
if (entry->type == ENTRY_ENUM && 0 == strcmp(variable->variable.type, entry->name)) {
|
||||||
|
|
||||||
for (int i = 0; i < arrlen(root->children); i++) {
|
|
||||||
Entry *entry = root->children + i;
|
|
||||||
|
|
||||||
if (entry->type == ENTRY_ENUM && 0 == strcmp(variable->variable.type, entry->name)) {
|
|
||||||
needLeadingDot = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int i = 0; i < arrlen(root->children); i++) {
|
|
||||||
Entry *entry = root->children + i;
|
|
||||||
|
|
||||||
if (entry->type == ENTRY_BITSET && 0 == strcmp(variable->variable.type, entry->name)) {
|
|
||||||
if (0 == memcmp(initialValue, entry->bitset.definePrefix + 3, strlen(entry->bitset.definePrefix) - 3)) {
|
|
||||||
needLeadingDot = true;
|
needLeadingDot = true;
|
||||||
initialValue += strlen(entry->bitset.definePrefix) - 3;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
for (int i = 0; i < arrlen(root->children); i++) {
|
||||||
|
Entry *entry = root->children + i;
|
||||||
|
|
||||||
|
if (entry->type == ENTRY_BITSET && 0 == strcmp(variable->variable.type, entry->name)) {
|
||||||
|
if (0 == memcmp(initialValue, entry->bitset.definePrefix + 3, strlen(entry->bitset.definePrefix) - 3)) {
|
||||||
|
needLeadingDot = true;
|
||||||
|
initialValue += strlen(entry->bitset.definePrefix) - 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue