2022-11-26 13:15:15 +00:00
|
|
|
#include <PropertyList.h>
|
2023-03-12 09:30:21 +00:00
|
|
|
#include <string.h>
|
2022-11-26 13:15:15 +00:00
|
|
|
|
|
|
|
#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];
|
|
|
|
|
2023-03-12 09:30:21 +00:00
|
|
|
value_field = str_hold ([[item getObjectForKey:"value"] string]);
|
2022-11-26 13:15:15 +00:00
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
2023-03-12 09:30:21 +00:00
|
|
|
-(void) dealloc
|
|
|
|
{
|
|
|
|
[type release];
|
|
|
|
str_free (value_field);
|
|
|
|
[super dealloc];
|
|
|
|
}
|
|
|
|
|
2022-11-26 13:15:15 +00:00
|
|
|
-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
|