Fix missing enums in dbj files

This commit is contained in:
drmortalwombat 2023-05-11 09:39:00 +02:00
parent 556301366f
commit 30c602d468
2 changed files with 23 additions and 0 deletions

View File

@ -1167,6 +1167,25 @@ bool Compiler::WriteDbjFile(const char* filename)
case DT_TYPE_POINTER:
fprintf(file, "\t\t{\"name\": \"%s\", \"typeid\": %d, \"size\": %d, \"type\": \"ptr\", eid: %d}", dec->mIdent ? dec->mIdent->mString : "", i, dec->mSize, types.IndexOrPush(dec->mBase));
break;
case DT_TYPE_ENUM:
{
fprintf(file, "\t\t{\"name\": \"%s\", \"typeid\": %d, \"size\": %d, \"type\": \"enum\",\"members\": [\n", dec->mIdent ? dec->mIdent->mString : "", i, dec->mSize);
bool tfirst = true;
Declaration* mdec = dec->mParams;
while (mdec)
{
if (!tfirst)
fprintf(file, ",\n");
tfirst = false;
fprintf(file, "\t\t\t{\"name\": \"%s\", \"value\": %d}", mdec->mIdent->mString, int(mdec->mInteger));
mdec = mdec->mNext;
}
fprintf(file, "]}");
}
break;
break;
case DT_TYPE_STRUCT:
{
fprintf(file, "\t\t{\"name\": \"%s\", \"typeid\": %d, \"size\": %d, \"type\": \"struct\",\"members\": [\n", dec->mIdent ? dec->mIdent->mString : "", i, dec->mSize);

View File

@ -337,6 +337,9 @@ Declaration* Parser::ParseBaseTypeDeclaration(uint64 flags)
mScanner->NextToken();
else
break;
cdec->mNext = dec->mParams;
dec->mParams = cdec;
}
dec->mMinValue = minValue;
@ -350,6 +353,7 @@ Declaration* Parser::ParseBaseTypeDeclaration(uint64 flags)
}
else if (maxValue > 255)
dec->mSize = 2;
}
if (mScanner->mToken == TK_CLOSE_BRACE)