[vkgen] Support renaming of auto fields

This commit is contained in:
Bill Currie 2023-02-27 18:44:21 +09:00
parent 9133c0ea3f
commit 3b9e0a786e

View file

@ -1,3 +1,5 @@
#include <string.h>
#include "vkfieldauto.h" #include "vkfieldauto.h"
#include "vkgen.h" #include "vkgen.h"
#include "vkstruct.h" #include "vkstruct.h"
@ -10,7 +12,8 @@
if (!self) { if (!self) {
return self; return self;
} }
field = [strct findField:field_name]; string real_name = [[item getObjectForKey:"field"] string];
field = [strct findField:real_name ? real_name : field_name];
return self; return self;
} }
@ -25,7 +28,7 @@
{ {
Type *field_type = [Type findType: field.type]; Type *field_type = [Type findType: field.type];
fprintf (output_file, "\t{\"%s\", field_offset (%s, %s), %s, %s, %s},\n", fprintf (output_file, "\t{\"%s\", field_offset (%s, %s), %s, %s, %s},\n",
field_name, struct_name, field_name, field_name, struct_name, field.name,
[field_type parseType], [field_type parseFunc], [field_type parseType], [field_type parseFunc],
[field_type parseData]); [field_type parseData]);
return self; return self;
@ -36,7 +39,7 @@
Type *field_type = [Type findType: field.type]; Type *field_type = [Type findType: field.type];
fprintf (output_file, fprintf (output_file,
"\t{\"%s\", &%s, (void *) field_offset (%s, %s)},\n", "\t{\"%s\", &%s, (void *) field_offset (%s, %s)},\n",
field_name, [field_type cexprType], struct_name, field_name); field_name, [field_type cexprType], struct_name, field.name);
return self; return self;
} }