2023-02-27 09:44:21 +00:00
|
|
|
#include <string.h>
|
|
|
|
|
2020-12-23 13:13:50 +00:00
|
|
|
#include "vkfieldauto.h"
|
|
|
|
#include "vkgen.h"
|
|
|
|
#include "vkstruct.h"
|
|
|
|
|
|
|
|
@implementation AutoField
|
|
|
|
|
|
|
|
-init:(PLItem *) item struct:(Struct *)strct field:(string)fname
|
|
|
|
{
|
|
|
|
self = [super init:item struct:strct field:fname];
|
|
|
|
if (!self) {
|
|
|
|
return self;
|
|
|
|
}
|
2023-02-27 09:44:21 +00:00
|
|
|
string real_name = [[item getObjectForKey:"field"] string];
|
|
|
|
field = [strct findField:real_name ? real_name : field_name];
|
2020-12-23 13:13:50 +00:00
|
|
|
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
|
|
|
-writeParseData
|
|
|
|
{
|
2021-07-06 03:27:21 +00:00
|
|
|
//printf("FieldDef: '%s' '%s'\n", struct_name, field_name);
|
2020-12-23 13:13:50 +00:00
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
|
|
|
-writeField
|
|
|
|
{
|
|
|
|
Type *field_type = [Type findType: field.type];
|
|
|
|
fprintf (output_file, "\t{\"%s\", field_offset (%s, %s), %s, %s, %s},\n",
|
2023-02-27 09:44:21 +00:00
|
|
|
field_name, struct_name, field.name,
|
2020-12-23 13:13:50 +00:00
|
|
|
[field_type parseType], [field_type parseFunc],
|
|
|
|
[field_type parseData]);
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
|
|
|
-writeSymbol
|
|
|
|
{
|
|
|
|
Type *field_type = [Type findType: field.type];
|
|
|
|
fprintf (output_file,
|
|
|
|
"\t{\"%s\", &%s, (void *) field_offset (%s, %s)},\n",
|
2023-02-27 09:44:21 +00:00
|
|
|
field_name, [field_type cexprType], struct_name, field.name);
|
2020-12-23 13:13:50 +00:00
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
|
|
|
@end
|