mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-29 15:41:59 +00:00
[vkgen] Add support for array element data
While I wound up not needing it in the end, it's now possible to specify extra data for array element parsing.
This commit is contained in:
parent
9e050ebf9a
commit
061f90ab83
3 changed files with 19 additions and 2 deletions
|
@ -10,10 +10,12 @@
|
|||
string parse_type;
|
||||
string type;
|
||||
string parser;
|
||||
string data;
|
||||
}
|
||||
+fieldType:(PLItem *)item;
|
||||
-initWithItem:(PLItem *)item;
|
||||
-writeParseData;
|
||||
-(string)type;
|
||||
-(string)exprType;
|
||||
-(string)parseType;
|
||||
+(string)anyType;
|
||||
|
|
|
@ -31,6 +31,7 @@ parseItemType (PLItem *item)
|
|||
{
|
||||
str_free (type);
|
||||
str_free (parser);
|
||||
str_free (data);
|
||||
str_free (parse_type);
|
||||
[super dealloc];
|
||||
}
|
||||
|
@ -52,6 +53,7 @@ parseItemType (PLItem *item)
|
|||
parse_type = str_hold (parseItemType(typeItem));
|
||||
type = str_hold ([[item getObjectForKey:"type"] string]);
|
||||
parser = str_hold ([[item getObjectForKey:"parser"] string]);
|
||||
data = str_hold ([[item getObjectForKey:"data"] string]);
|
||||
}
|
||||
|
||||
return self;
|
||||
|
@ -62,9 +64,19 @@ parseItemType (PLItem *item)
|
|||
fprintf (output_file, "\t%s,\n", parse_type);
|
||||
fprintf (output_file, "\tsizeof (%s),\n", type);
|
||||
fprintf (output_file, "\t%s,\n", parser);
|
||||
if (data) {
|
||||
fprintf (output_file, "\t&%s,\n", data);
|
||||
} else {
|
||||
fprintf (output_file, "\t0,\n");
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
-(string) type
|
||||
{
|
||||
return type;
|
||||
}
|
||||
|
||||
-(string) exprType
|
||||
{
|
||||
return "&" + type + "_type";
|
||||
|
|
|
@ -115,6 +115,7 @@ typedef struct parse_single_s {
|
|||
pltype_t type;
|
||||
size_t stride;
|
||||
plparser_t parser;
|
||||
void *data;
|
||||
size_t value_offset;
|
||||
} parse_single_t;
|
||||
|
||||
|
@ -122,6 +123,7 @@ typedef struct parse_array_s {
|
|||
pltype_t type;
|
||||
size_t stride;
|
||||
plparser_t parser;
|
||||
void *data;
|
||||
size_t value_offset;
|
||||
size_t size_offset;
|
||||
} parse_array_t;
|
||||
|
@ -130,6 +132,7 @@ typedef struct parse_fixed_array_s {
|
|||
pltype_t type;
|
||||
size_t stride;
|
||||
plparser_t parser;
|
||||
void *data;
|
||||
size_t size;
|
||||
} parse_fixed_array_t;
|
||||
|
||||
|
@ -341,7 +344,7 @@ parse_array (const plfield_t *field, const plitem_t *item,
|
|||
array->stride,
|
||||
vkparse_alloc,
|
||||
array->parser,
|
||||
0,
|
||||
array->data,
|
||||
};
|
||||
plfield_t f = { 0, 0, 0, 0, &element };
|
||||
|
||||
|
@ -376,7 +379,7 @@ parse_fixed_array (const plfield_t *field, const plitem_t *item,
|
|||
array->stride,
|
||||
vkparse_alloc,
|
||||
array->parser,
|
||||
0,
|
||||
array->data,
|
||||
};
|
||||
plfield_t f = { 0, 0, 0, 0, &element };
|
||||
|
||||
|
|
Loading…
Reference in a new issue