mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-29 15:41:59 +00:00
[vkgen] Use typedef name for structs
Using the typedef name makes using structs declared as typedef struct foo_s { ... } foo_t; easier and cleaner. Sure, I could have written the "struct foo_s" for the output name, but I'm much more likely to look for foo_t than foo_s when checking the generated code.
This commit is contained in:
parent
7c1aff6736
commit
d5cd4f6ede
4 changed files with 21 additions and 0 deletions
|
@ -6,6 +6,15 @@
|
||||||
#include "vkstruct.h"
|
#include "vkstruct.h"
|
||||||
|
|
||||||
@implementation Alias
|
@implementation Alias
|
||||||
|
-initWithType: (qfot_type_t *) type
|
||||||
|
{
|
||||||
|
if (!(self = [super initWithType: type])) {
|
||||||
|
return nil;
|
||||||
|
}
|
||||||
|
[[self resolveType] setAlias: self];
|
||||||
|
return self;
|
||||||
|
}
|
||||||
|
|
||||||
-(string) name
|
-(string) name
|
||||||
{
|
{
|
||||||
return type.alias.name;
|
return type.alias.name;
|
||||||
|
|
|
@ -245,6 +245,9 @@
|
||||||
if (outname) {
|
if (outname) {
|
||||||
return outname;
|
return outname;
|
||||||
}
|
}
|
||||||
|
if (alias) {
|
||||||
|
return [alias name];
|
||||||
|
}
|
||||||
return [self name];
|
return [self name];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
@interface Type: Object
|
@interface Type: Object
|
||||||
{
|
{
|
||||||
qfot_type_t *type;
|
qfot_type_t *type;
|
||||||
|
Type *alias;
|
||||||
}
|
}
|
||||||
+fromType: (qfot_type_t *) type;
|
+fromType: (qfot_type_t *) type;
|
||||||
/** \warning returned string is ephemeral
|
/** \warning returned string is ephemeral
|
||||||
|
@ -15,6 +16,7 @@
|
||||||
/** \warning returned string is ephemeral
|
/** \warning returned string is ephemeral
|
||||||
*/
|
*/
|
||||||
-(string) name;
|
-(string) name;
|
||||||
|
-(void) setAlias: (Type *) alias;
|
||||||
-(void) addToQueue;
|
-(void) addToQueue;
|
||||||
-(Type *) resolveType;
|
-(Type *) resolveType;
|
||||||
+(Type *) findType: (qfot_type_t *) type;
|
+(Type *) findType: (qfot_type_t *) type;
|
||||||
|
|
|
@ -86,6 +86,13 @@ static string get_type_key (void *type, void *unused)
|
||||||
return type.encoding;
|
return type.encoding;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
-(void) setAlias: (Type *) alias
|
||||||
|
{
|
||||||
|
if (!self.alias) {
|
||||||
|
self.alias = alias;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
-(void) addToQueue
|
-(void) addToQueue
|
||||||
{
|
{
|
||||||
string name = [self name];
|
string name = [self name];
|
||||||
|
|
Loading…
Reference in a new issue