mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-26 06:10:56 +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;
|
int prefix_length;
|
||||||
}
|
}
|
||||||
|
-(void) writeForward;
|
||||||
-(void) writeTable;
|
-(void) writeTable;
|
||||||
-(void) writeSymtabInit;
|
-(void) writeSymtabInit;
|
||||||
-(void) writeSymtabEntry;
|
-(void) writeSymtabEntry;
|
||||||
|
|
|
@ -83,6 +83,11 @@ skip_value(string name)
|
||||||
return !num_values;
|
return !num_values;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
-(void) writeForward
|
||||||
|
{
|
||||||
|
fprintf (output_file, "static exprenum_t %s_enum;\n", [self name]);
|
||||||
|
}
|
||||||
|
|
||||||
-(void) writeTable
|
-(void) writeTable
|
||||||
{
|
{
|
||||||
int strip_bit = 0;
|
int strip_bit = 0;
|
||||||
|
@ -123,7 +128,7 @@ skip_value(string name)
|
||||||
}
|
}
|
||||||
fprintf (output_file, "};\n");
|
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++) {
|
for (int i = 0, index = 0; i < type.strct.num_fields; i++) {
|
||||||
qfot_var_t *var = &type.strct.fields[i];
|
qfot_var_t *var = &type.strct.fields[i];
|
||||||
if (skip_value (var.name)) {
|
if (skip_value (var.name)) {
|
||||||
|
@ -151,10 +156,10 @@ skip_value(string name)
|
||||||
}
|
}
|
||||||
fprintf (output_file, "\t{ }\n");
|
fprintf (output_file, "\t{ }\n");
|
||||||
fprintf (output_file, "};\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, "\t%s_symbols,\n", [self name]);
|
||||||
fprintf (output_file, "};\n");
|
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_type,\n", [self name]);
|
||||||
fprintf (output_file, "\t&%s_symtab,\n", [self name]);
|
fprintf (output_file, "\t&%s_symtab,\n", [self name]);
|
||||||
fprintf (output_file, "};\n");
|
fprintf (output_file, "};\n");
|
||||||
|
@ -177,10 +182,7 @@ skip_value(string name)
|
||||||
" const plitem_t *item, void *data, plitem_t *messages,"
|
" const plitem_t *item, void *data, plitem_t *messages,"
|
||||||
" void *context);\n",
|
" void *context);\n",
|
||||||
[self name]);
|
[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 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
|
-(void) writeSymtabInit
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
Type *ele_type;
|
Type *ele_type;
|
||||||
int ele_count;
|
int ele_count;
|
||||||
}
|
}
|
||||||
|
-(void) writeForward;
|
||||||
-(void) writeTable;
|
-(void) writeTable;
|
||||||
-(void) writeSymtabInit;
|
-(void) writeSymtabInit;
|
||||||
-(void) writeSymtabEntry;
|
-(void) writeSymtabEntry;
|
||||||
|
|
|
@ -37,6 +37,10 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
-(void) writeForward
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
-(void) writeTable
|
-(void) writeTable
|
||||||
{
|
{
|
||||||
fprintf (output_file, "static parse_fixed_array_t parse_%s_data = {\n",
|
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") {
|
if ([obj name] == "VkStructureType") {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if ([obj class] != [Enum class]) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
arp_start ();
|
arp_start ();
|
||||||
[obj writeTable];
|
[obj writeForward];
|
||||||
arp_end ();
|
arp_end ();
|
||||||
}
|
}
|
||||||
for (int i = [output_types count]; i-- > 0; ) {
|
for (int i = [output_types count]; i-- > 0; ) {
|
||||||
|
@ -236,22 +233,6 @@ main(int argc, string *argv)
|
||||||
if ([obj name] == "VkStructureType") {
|
if ([obj name] == "VkStructureType") {
|
||||||
continue;
|
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 ();
|
arp_start ();
|
||||||
[obj writeTable];
|
[obj writeTable];
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
}
|
}
|
||||||
-(void) queueFieldTypes;
|
-(void) queueFieldTypes;
|
||||||
-(qfot_var_t *)findField:(string) fieldName;
|
-(qfot_var_t *)findField:(string) fieldName;
|
||||||
|
-(void) writeForward;
|
||||||
-(void) writeTable;
|
-(void) writeTable;
|
||||||
-(void) writeSymtabInit;
|
-(void) writeSymtabInit;
|
||||||
-(void) writeSymtabEntry;
|
-(void) writeSymtabEntry;
|
||||||
|
|
|
@ -31,6 +31,11 @@
|
||||||
{
|
{
|
||||||
qfot_struct_t *strct =&type.strct;
|
qfot_struct_t *strct =&type.strct;
|
||||||
PLItem *field_dict = [parse getObjectForKey:[self name]];
|
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++) {
|
for (int i = 0; i < strct.num_fields; i++) {
|
||||||
qfot_var_t *var = &strct.fields[i];
|
qfot_var_t *var = &strct.fields[i];
|
||||||
|
@ -78,6 +83,18 @@
|
||||||
return str_upper (s);
|
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
|
-(void) writeTable
|
||||||
{
|
{
|
||||||
PLItem *field_dict = [parse getObjectForKey:[self name]];
|
PLItem *field_dict = [parse getObjectForKey:[self name]];
|
||||||
|
@ -85,6 +102,7 @@
|
||||||
Array *field_defs = [Array array];
|
Array *field_defs = [Array array];
|
||||||
int have_sType = 0;
|
int have_sType = 0;
|
||||||
int have_pNext = 0;
|
int have_pNext = 0;
|
||||||
|
int readonly = [field_dict string] == "readonly";
|
||||||
|
|
||||||
if ([parse string] == "skip") {
|
if ([parse string] == "skip") {
|
||||||
return;
|
return;
|
||||||
|
@ -138,6 +156,7 @@
|
||||||
FieldDef *field_def = [field_defs objectAtIndex:i];
|
FieldDef *field_def = [field_defs objectAtIndex:i];
|
||||||
[field_def writeParseData];
|
[field_def writeParseData];
|
||||||
}
|
}
|
||||||
|
if (!readonly) {
|
||||||
fprintf (output_file, "static plfield_t %s_fields[] = {\n", [self outname]);
|
fprintf (output_file, "static plfield_t %s_fields[] = {\n", [self outname]);
|
||||||
fprintf (output_file,
|
fprintf (output_file,
|
||||||
"\t{\"@inherit\", 0, QFString, parse_inherit, &%s_fields},\n",
|
"\t{\"@inherit\", 0, QFString, parse_inherit, &%s_fields},\n",
|
||||||
|
@ -154,33 +173,30 @@
|
||||||
fprintf (output_file, "\t{ }\n");
|
fprintf (output_file, "\t{ }\n");
|
||||||
fprintf (output_file, "};\n");
|
fprintf (output_file, "};\n");
|
||||||
|
|
||||||
fprintf (header_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, "int %s (const plfield_t *field,"
|
|
||||||
" const plitem_t *item, void *data, plitem_t *messages,"
|
" const plitem_t *item, void *data, plitem_t *messages,"
|
||||||
" void *context)\n",
|
" void *context)\n",
|
||||||
[self parseFunc]);
|
[self parseFunc]);
|
||||||
fprintf (output_file, "{\n");
|
fprintf (output_file, "{\n");
|
||||||
if (have_sType) {
|
if (have_sType) {
|
||||||
fprintf (output_file, "\t((%s *) data)->sType", [self outname]);
|
fprintf (output_file, "\t((%s *) data)->sType", [self outname]);
|
||||||
fprintf (output_file, " = %s;\n", [self sTypeName]);
|
fprintf (output_file, " = %s;\n", [self sTypeName]);
|
||||||
}
|
}
|
||||||
fprintf (output_file,
|
fprintf (output_file,
|
||||||
"\tif (PL_Type (item) == QFString\n"
|
"\tif (PL_Type (item) == QFString\n"
|
||||||
"\t\t&& !(item = parse_reference (item, \"%s\", messages, context))) {\n"
|
"\t\t&& !(item = parse_reference (item, \"%s\", messages, context))) {\n"
|
||||||
"\t\treturn 0;\n"
|
"\t\treturn 0;\n"
|
||||||
"\t}\n"
|
"\t}\n"
|
||||||
"\treturn PL_ParseStruct (%s_fields, item, data, messages,"
|
"\treturn PL_ParseStruct (%s_fields, item, data, messages,"
|
||||||
" context);\n",
|
" context);\n",
|
||||||
[self outname], [self outname]);
|
[self outname], [self outname]);
|
||||||
fprintf (output_file, "}\n");
|
fprintf (output_file, "}\n");
|
||||||
if (have_pNext) {
|
if (have_pNext) {
|
||||||
fprintf (output_file, "static parserref_t %s_parser = ",
|
fprintf (output_file, "static parserref_t %s_parser = ",
|
||||||
[self outname]);
|
[self outname]);
|
||||||
fprintf (output_file, "{\"%s\", %s, sizeof(%s)};\n",
|
fprintf (output_file, "{\"%s\", %s, sizeof(%s)};\n",
|
||||||
[self outname], [self parseFunc], [self outname]);
|
[self outname], [self parseFunc], [self outname]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf (output_file, "static exprsym_t %s_symbols[] = {\n", [self outname]);
|
fprintf (output_file, "static exprsym_t %s_symbols[] = {\n", [self outname]);
|
||||||
|
|
|
@ -74,6 +74,7 @@
|
||||||
values = pPreserveAttachments;
|
values = pPreserveAttachments;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
VkPhysicalDeviceLimits = readonly;
|
||||||
VkRenderPassCreateInfo = {
|
VkRenderPassCreateInfo = {
|
||||||
//flags = auto; reserved for future use (Bits enum does not exist)
|
//flags = auto; reserved for future use (Bits enum does not exist)
|
||||||
attachments = {
|
attachments = {
|
||||||
|
|
Loading…
Reference in a new issue