mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-03-23 19:01:06 +00:00
[vulkan] Fix a few code generation issues
QC's int type is named "integer" (didn't feel like changing that right now), so special case it to be "int". Output the parse func name (instead of "fix me"). Output a parse func for enums (needed for arrays of enums (VkDynamicState)).
This commit is contained in:
parent
9db80259d1
commit
c0c728b188
3 changed files with 26 additions and 2 deletions
|
@ -120,6 +120,24 @@ skip_value(string name)
|
|||
fprintf (output_file, "\t&%s_symtab,\n", [self name]);
|
||||
fprintf (output_file, "};\n");
|
||||
|
||||
fprintf (output_file, "static plfield_t %s_field = { 0, 0, QFString,"
|
||||
" parse_enum, &%s_enum};\n",
|
||||
[self name], [self name]);
|
||||
fprintf (output_file, "int parse_%s (const plfield_t *field,"
|
||||
" const plitem_t *item, void *data, plitem_t *messages,"
|
||||
" void *context)\n",
|
||||
[self name]);
|
||||
fprintf (output_file, "{\n");
|
||||
fprintf (output_file,
|
||||
"\treturn parse_enum (&%s_field, item, data, messages,"
|
||||
" context);\n",
|
||||
[self name]);
|
||||
fprintf (output_file, "}\n");
|
||||
|
||||
fprintf (header_file, "int parse_%s (const plfield_t *field,"
|
||||
" 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]);
|
||||
}
|
||||
|
||||
|
|
|
@ -175,7 +175,7 @@
|
|||
|
||||
-(string) cexprType
|
||||
{
|
||||
return [self name] + "_type";
|
||||
return [self outname] + "_type";
|
||||
}
|
||||
|
||||
-(string) parseType
|
||||
|
@ -185,7 +185,7 @@
|
|||
|
||||
-(string) parseFunc
|
||||
{
|
||||
return "fix me";
|
||||
return "parse_" + [self outname];
|
||||
}
|
||||
|
||||
-(string) parseData
|
||||
|
|
|
@ -75,6 +75,9 @@ static string get_type_key (void *type, void *unused)
|
|||
-(string) name
|
||||
{
|
||||
if (type.meta == ty_basic) {
|
||||
if (type.type == ev_integer) {
|
||||
return "int";
|
||||
}
|
||||
return pr_type_name[type.type];
|
||||
}
|
||||
//FIXME extract alias name and return proper type name
|
||||
|
@ -118,6 +121,9 @@ static string get_type_key (void *type, void *unused)
|
|||
-(string) parseData
|
||||
{
|
||||
if (type.meta == ty_basic) {
|
||||
if (type.type == ev_integer) {
|
||||
return "&cexpr_int";
|
||||
}
|
||||
return "&cexpr_" + pr_type_name[type.type];
|
||||
}
|
||||
return "0";
|
||||
|
|
Loading…
Reference in a new issue