mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-22 20:41:20 +00:00
[vkgen] Support ignored fields
This allows having sections in a spec used for things like `properties` that have no corresponding fields in the actual struct: the field is ignored when parsing and no cexpr field symbol is emitted.
This commit is contained in:
parent
d34e6cffdf
commit
c3f8e5bcc5
4 changed files with 82 additions and 0 deletions
|
@ -11,6 +11,7 @@ vkgen_dat_src= \
|
|||
libs/video/renderer/vulkan/vkgen/vkfieldcustom.r \
|
||||
libs/video/renderer/vulkan/vkgen/vkfielddata.r \
|
||||
libs/video/renderer/vulkan/vkgen/vkfielddef.r \
|
||||
libs/video/renderer/vulkan/vkgen/vkfieldignore.r \
|
||||
libs/video/renderer/vulkan/vkgen/vkfieldreadonly.r \
|
||||
libs/video/renderer/vulkan/vkgen/vkfieldsingle.r \
|
||||
libs/video/renderer/vulkan/vkgen/vkfieldstring.r \
|
||||
|
@ -55,6 +56,7 @@ EXTRA_DIST += \
|
|||
libs/video/renderer/vulkan/vkgen/vkfieldcustom.h \
|
||||
libs/video/renderer/vulkan/vkgen/vkfielddata.h \
|
||||
libs/video/renderer/vulkan/vkgen/vkfielddef.h \
|
||||
libs/video/renderer/vulkan/vkgen/vkfieldignore.h \
|
||||
libs/video/renderer/vulkan/vkgen/vkfieldreadonly.h \
|
||||
libs/video/renderer/vulkan/vkgen/vkfieldsingle.h \
|
||||
libs/video/renderer/vulkan/vkgen/vkfieldstring.h \
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#include "vkfieldcustom.h"
|
||||
#include "vkfielddata.h"
|
||||
#include "vkfielddef.h"
|
||||
#include "vkfieldignore.h"
|
||||
#include "vkfieldreadonly.h"
|
||||
#include "vkfieldsingle.h"
|
||||
#include "vkfieldstring.h"
|
||||
|
@ -45,6 +46,8 @@
|
|||
return [[[ArrayField alloc] init:item struct:strct field:fname] autorelease];
|
||||
case "readonly":
|
||||
return [[[ReadOnlyField alloc] init:item struct:strct field:fname] autorelease];
|
||||
case "ignore":
|
||||
return [[[IgnoreField alloc] init:item struct:strct field:fname] autorelease];
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
|
|
14
libs/video/renderer/vulkan/vkgen/vkfieldignore.h
Normal file
14
libs/video/renderer/vulkan/vkgen/vkfieldignore.h
Normal file
|
@ -0,0 +1,14 @@
|
|||
#ifndef __renderer_vulkan_vkgen_vkfieldignore_h
|
||||
#define __renderer_vulkan_vkgen_vkfieldignore_h
|
||||
|
||||
#include "vkfielddef.h"
|
||||
|
||||
@class FieldType;
|
||||
|
||||
@interface IgnoreField: FieldDef
|
||||
{
|
||||
FieldType *type;
|
||||
}
|
||||
@end
|
||||
|
||||
#endif//__renderer_vulkan_vkgen_vkfieldignore_h
|
63
libs/video/renderer/vulkan/vkgen/vkfieldignore.r
Normal file
63
libs/video/renderer/vulkan/vkgen/vkfieldignore.r
Normal file
|
@ -0,0 +1,63 @@
|
|||
#include <string.h>
|
||||
#include <PropertyList.h>
|
||||
|
||||
#include "vkfieldignore.h"
|
||||
#include "vkfieldtype.h"
|
||||
#include "vkstruct.h"
|
||||
|
||||
@implementation IgnoreField
|
||||
|
||||
-init:(PLItem *)item struct:(Struct *)strct field:(string)fname
|
||||
{
|
||||
self = [super init];
|
||||
if (!self) {
|
||||
return self;
|
||||
}
|
||||
|
||||
line = [item line];
|
||||
struct_name = str_hold ([strct outname]);
|
||||
field_name = str_hold (fname);
|
||||
return self;
|
||||
}
|
||||
|
||||
-fromField:(qfot_var_t *)field struct:(Struct *)strct
|
||||
{
|
||||
return self;
|
||||
}
|
||||
|
||||
-(void)dealloc
|
||||
{
|
||||
str_free (struct_name);
|
||||
str_free (field_name);
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
-writeParseData
|
||||
{
|
||||
return self;
|
||||
}
|
||||
|
||||
-writeField
|
||||
{
|
||||
string parse_type = [FieldType anyType];
|
||||
fprintf (output_file, "\t{\"%s\", 0, %s, parse_%s, 0},\n",
|
||||
field_name, parse_type, "ignore");
|
||||
return self;
|
||||
}
|
||||
|
||||
-writeSymbol
|
||||
{
|
||||
return self;
|
||||
}
|
||||
|
||||
-(string) name
|
||||
{
|
||||
return field_name;
|
||||
}
|
||||
|
||||
-(int) searchType
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
@end
|
Loading…
Reference in a new issue