quakeforge/libs/video/renderer/vulkan/vkgen/vkfieldreadonly.r
Bill Currie 7829ec3adb [vkgen] Add support for read-only values
This makes it possible to use the parser to read in certain fields, but
skip over others. The read-only is for cexpr parsing of the read-only
fields.
2022-11-26 22:15:15 +09:00

45 lines
884 B
R

#include <PropertyList.h>
#include "vkfieldreadonly.h"
#include "vkfieldtype.h"
#include "vkgen.h"
#include "vktype.h"
@implementation ReadOnlyField
-init:(PLItem *) item struct:(Struct *)strct field:(string)fname
{
self = [super init:item struct:strct field:fname];
if (!self) {
return self;
}
PLItem *desc = [item getObjectForKey:"type"];
type = [[FieldType fieldType:[desc getObjectAtIndex:1]] retain];
value_field = [[item getObjectForKey:"value"] string];
return self;
}
-writeParseData
{
return self;
}
-writeField
{
string parse_type = [FieldType anyType];
fprintf (output_file, "\t{\"%s\", 0, %s, parse_%s, 0},\n",
field_name, parse_type, "ignore");
return self;
}
-writeSymbol
{
fprintf (output_file,
"\t{\"%s\", %s, (void *) field_offset (%s, %s)},\n",
field_name, [type exprType], struct_name, value_field);
return self;
}
@end