mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-29 15:41:59 +00:00
[vkgen] Clean up most of the generated header
I'll probably completely remove it as only vkparse.c includes it, but this tidies things up a bit and even simplifies vkgen's loops a little.
This commit is contained in:
parent
7aa5470c68
commit
d34e6cffdf
8 changed files with 57 additions and 50 deletions
|
@ -9,6 +9,7 @@
|
|||
{
|
||||
int prefix_length;
|
||||
}
|
||||
-(void) writeForward;
|
||||
-(void) writeTable;
|
||||
-(void) writeSymtabInit;
|
||||
-(void) writeSymtabEntry;
|
||||
|
|
|
@ -83,6 +83,11 @@ skip_value(string name)
|
|||
return !num_values;
|
||||
}
|
||||
|
||||
-(void) writeForward
|
||||
{
|
||||
fprintf (output_file, "static exprenum_t %s_enum;\n", [self name]);
|
||||
}
|
||||
|
||||
-(void) writeTable
|
||||
{
|
||||
int strip_bit = 0;
|
||||
|
@ -123,7 +128,7 @@ skip_value(string name)
|
|||
}
|
||||
fprintf (output_file, "};\n");
|
||||
}
|
||||
fprintf (output_file, "exprsym_t %s_symbols[] = {\n", [self name]);
|
||||
fprintf (output_file, "static exprsym_t %s_symbols[] = {\n", [self name]);
|
||||
for (int i = 0, index = 0; i < type.strct.num_fields; i++) {
|
||||
qfot_var_t *var = &type.strct.fields[i];
|
||||
if (skip_value (var.name)) {
|
||||
|
@ -151,10 +156,10 @@ skip_value(string name)
|
|||
}
|
||||
fprintf (output_file, "\t{ }\n");
|
||||
fprintf (output_file, "};\n");
|
||||
fprintf (output_file, "exprtab_t %s_symtab = {\n", [self name]);
|
||||
fprintf (output_file, "static exprtab_t %s_symtab = {\n", [self name]);
|
||||
fprintf (output_file, "\t%s_symbols,\n", [self name]);
|
||||
fprintf (output_file, "};\n");
|
||||
fprintf (output_file, "exprenum_t %s_enum = {\n", [self name]);
|
||||
fprintf (output_file, "static exprenum_t %s_enum = {\n", [self name]);
|
||||
fprintf (output_file, "\t&%s_type,\n", [self name]);
|
||||
fprintf (output_file, "\t&%s_symtab,\n", [self name]);
|
||||
fprintf (output_file, "};\n");
|
||||
|
@ -177,10 +182,7 @@ skip_value(string name)
|
|||
" const plitem_t *item, void *data, plitem_t *messages,"
|
||||
" void *context);\n",
|
||||
[self name]);
|
||||
fprintf (header_file, "extern exprenum_t %s_enum;\n", [self name]);
|
||||
fprintf (header_file, "extern exprtype_t %s_type;\n", [self name]);
|
||||
fprintf (header_file, "extern exprtab_t %s_symtab;\n", [self name]);
|
||||
fprintf (header_file, "extern exprsym_t %s_symbols[];\n", [self name]);
|
||||
}
|
||||
|
||||
-(void) writeSymtabInit
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
Type *ele_type;
|
||||
int ele_count;
|
||||
}
|
||||
-(void) writeForward;
|
||||
-(void) writeTable;
|
||||
-(void) writeSymtabInit;
|
||||
-(void) writeSymtabEntry;
|
||||
|
|
|
@ -37,6 +37,10 @@
|
|||
}
|
||||
}
|
||||
|
||||
-(void) writeForward
|
||||
{
|
||||
}
|
||||
|
||||
-(void) writeTable
|
||||
{
|
||||
fprintf (output_file, "static parse_fixed_array_t parse_%s_data = {\n",
|
||||
|
|
|
@ -223,12 +223,9 @@ main(int argc, string *argv)
|
|||
if ([obj name] == "VkStructureType") {
|
||||
continue;
|
||||
}
|
||||
if ([obj class] != [Enum class]) {
|
||||
continue;
|
||||
}
|
||||
|
||||
arp_start ();
|
||||
[obj writeTable];
|
||||
[obj writeForward];
|
||||
arp_end ();
|
||||
}
|
||||
for (int i = [output_types count]; i-- > 0; ) {
|
||||
|
@ -236,22 +233,6 @@ main(int argc, string *argv)
|
|||
if ([obj name] == "VkStructureType") {
|
||||
continue;
|
||||
}
|
||||
if ([obj class] != [FixedArray class]) {
|
||||
continue;
|
||||
}
|
||||
|
||||
arp_start ();
|
||||
[obj writeTable];
|
||||
arp_end ();
|
||||
}
|
||||
for (int i = [output_types count]; i-- > 0; ) {
|
||||
id obj = [output_types objectAtIndex:i];
|
||||
if ([obj name] == "VkStructureType") {
|
||||
continue;
|
||||
}
|
||||
if ([obj class] != [Struct class]) {
|
||||
continue;
|
||||
}
|
||||
|
||||
arp_start ();
|
||||
[obj writeTable];
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
}
|
||||
-(void) queueFieldTypes;
|
||||
-(qfot_var_t *)findField:(string) fieldName;
|
||||
-(void) writeForward;
|
||||
-(void) writeTable;
|
||||
-(void) writeSymtabInit;
|
||||
-(void) writeSymtabEntry;
|
||||
|
|
|
@ -31,6 +31,11 @@
|
|||
{
|
||||
qfot_struct_t *strct =&type.strct;
|
||||
PLItem *field_dict = [parse getObjectForKey:[self name]];
|
||||
int readonly = [field_dict string] == "readonly";
|
||||
|
||||
if (readonly) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < strct.num_fields; i++) {
|
||||
qfot_var_t *var = &strct.fields[i];
|
||||
|
@ -78,6 +83,18 @@
|
|||
return str_upper (s);
|
||||
}
|
||||
|
||||
-(void) writeForward
|
||||
{
|
||||
PLItem *field_dict = [parse getObjectForKey:[self name]];
|
||||
int readonly = [field_dict string] == "readonly";
|
||||
if (!readonly) {
|
||||
fprintf (output_file, "static int %s (const plfield_t *field,"
|
||||
" const plitem_t *item, void *data, plitem_t *messages,"
|
||||
" void *context);\n",
|
||||
[self parseFunc]);
|
||||
}
|
||||
}
|
||||
|
||||
-(void) writeTable
|
||||
{
|
||||
PLItem *field_dict = [parse getObjectForKey:[self name]];
|
||||
|
@ -85,6 +102,7 @@
|
|||
Array *field_defs = [Array array];
|
||||
int have_sType = 0;
|
||||
int have_pNext = 0;
|
||||
int readonly = [field_dict string] == "readonly";
|
||||
|
||||
if ([parse string] == "skip") {
|
||||
return;
|
||||
|
@ -138,6 +156,7 @@
|
|||
FieldDef *field_def = [field_defs objectAtIndex:i];
|
||||
[field_def writeParseData];
|
||||
}
|
||||
if (!readonly) {
|
||||
fprintf (output_file, "static plfield_t %s_fields[] = {\n", [self outname]);
|
||||
fprintf (output_file,
|
||||
"\t{\"@inherit\", 0, QFString, parse_inherit, &%s_fields},\n",
|
||||
|
@ -154,33 +173,30 @@
|
|||
fprintf (output_file, "\t{ }\n");
|
||||
fprintf (output_file, "};\n");
|
||||
|
||||
fprintf (header_file, "int %s (const plfield_t *field,"
|
||||
" const plitem_t *item, void *data, plitem_t *messages,"
|
||||
" void *context);\n",
|
||||
[self parseFunc]);
|
||||
fprintf (output_file, "int %s (const plfield_t *field,"
|
||||
fprintf (output_file, "static int %s (const plfield_t *field,"
|
||||
" const plitem_t *item, void *data, plitem_t *messages,"
|
||||
" void *context)\n",
|
||||
[self parseFunc]);
|
||||
fprintf (output_file, "{\n");
|
||||
if (have_sType) {
|
||||
fprintf (output_file, "\t((%s *) data)->sType", [self outname]);
|
||||
fprintf (output_file, " = %s;\n", [self sTypeName]);
|
||||
}
|
||||
fprintf (output_file,
|
||||
"\tif (PL_Type (item) == QFString\n"
|
||||
"\t\t&& !(item = parse_reference (item, \"%s\", messages, context))) {\n"
|
||||
"\t\treturn 0;\n"
|
||||
"\t}\n"
|
||||
"\treturn PL_ParseStruct (%s_fields, item, data, messages,"
|
||||
" context);\n",
|
||||
[self outname], [self outname]);
|
||||
fprintf (output_file, "}\n");
|
||||
if (have_pNext) {
|
||||
fprintf (output_file, "static parserref_t %s_parser = ",
|
||||
[self outname]);
|
||||
fprintf (output_file, "{\"%s\", %s, sizeof(%s)};\n",
|
||||
[self outname], [self parseFunc], [self outname]);
|
||||
fprintf (output_file, "{\n");
|
||||
if (have_sType) {
|
||||
fprintf (output_file, "\t((%s *) data)->sType", [self outname]);
|
||||
fprintf (output_file, " = %s;\n", [self sTypeName]);
|
||||
}
|
||||
fprintf (output_file,
|
||||
"\tif (PL_Type (item) == QFString\n"
|
||||
"\t\t&& !(item = parse_reference (item, \"%s\", messages, context))) {\n"
|
||||
"\t\treturn 0;\n"
|
||||
"\t}\n"
|
||||
"\treturn PL_ParseStruct (%s_fields, item, data, messages,"
|
||||
" context);\n",
|
||||
[self outname], [self outname]);
|
||||
fprintf (output_file, "}\n");
|
||||
if (have_pNext) {
|
||||
fprintf (output_file, "static parserref_t %s_parser = ",
|
||||
[self outname]);
|
||||
fprintf (output_file, "{\"%s\", %s, sizeof(%s)};\n",
|
||||
[self outname], [self parseFunc], [self outname]);
|
||||
}
|
||||
}
|
||||
|
||||
fprintf (output_file, "static exprsym_t %s_symbols[] = {\n", [self outname]);
|
||||
|
|
|
@ -74,6 +74,7 @@
|
|||
values = pPreserveAttachments;
|
||||
};
|
||||
};
|
||||
VkPhysicalDeviceLimits = readonly;
|
||||
VkRenderPassCreateInfo = {
|
||||
//flags = auto; reserved for future use (Bits enum does not exist)
|
||||
attachments = {
|
||||
|
|
Loading…
Reference in a new issue