mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-10 23:32:09 +00:00
Encode types to string and qfo representation on creation.
This commit is contained in:
parent
a07cd17f38
commit
64cf07351f
3 changed files with 23 additions and 0 deletions
|
@ -174,6 +174,10 @@ qfo_encode_struct (type_t *type)
|
||||||
sy = sy_var;
|
sy = sy_var;
|
||||||
if (type->ty == ty_enum)
|
if (type->ty == ty_enum)
|
||||||
sy = sy_const;
|
sy = sy_const;
|
||||||
|
if (!type->t.symtab) {
|
||||||
|
def = new_def (type->encoding, 0, pr.type_data, st_extern);
|
||||||
|
return def;
|
||||||
|
}
|
||||||
for (num_fields = 0, sym = type->t.symtab->symbols; sym; sym = sym->next) {
|
for (num_fields = 0, sym = type->t.symtab->symbols; sym; sym = sym->next) {
|
||||||
if (sym->sy_type != sy)
|
if (sym->sy_type != sy)
|
||||||
continue;
|
continue;
|
||||||
|
@ -253,6 +257,10 @@ qfo_encode_type (type_t *type)
|
||||||
qfo_encode_class, // ty_class
|
qfo_encode_class, // ty_class
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (type->type_def && type->type_def->external) {
|
||||||
|
free_def (type->type_def);
|
||||||
|
type->type_def = 0;
|
||||||
|
}
|
||||||
if (type->type_def)
|
if (type->type_def)
|
||||||
return type->type_def;
|
return type->type_def;
|
||||||
if (type->ty < 0 || type->ty > ty_class)
|
if (type->ty < 0 || type->ty > ty_class)
|
||||||
|
|
|
@ -145,6 +145,8 @@ InitData (void)
|
||||||
pr.near_data->max_size = 65536;
|
pr.near_data->max_size = 65536;
|
||||||
pr.near_data->grow = 0;
|
pr.near_data->grow = 0;
|
||||||
|
|
||||||
|
pr.type_data = new_defspace ();
|
||||||
|
|
||||||
pr.symtab = new_symtab (0, stab_global);
|
pr.symtab = new_symtab (0, stab_global);
|
||||||
pr.symtab->space = pr.near_data;
|
pr.symtab->space = pr.near_data;
|
||||||
|
|
||||||
|
|
|
@ -53,6 +53,7 @@ static __attribute__ ((used)) const char rcsid[] =
|
||||||
#include "diagnostic.h"
|
#include "diagnostic.h"
|
||||||
#include "expr.h"
|
#include "expr.h"
|
||||||
#include "function.h"
|
#include "function.h"
|
||||||
|
#include "obj_type.h"
|
||||||
#include "options.h"
|
#include "options.h"
|
||||||
#include "qfcc.h"
|
#include "qfcc.h"
|
||||||
#include "strpool.h"
|
#include "strpool.h"
|
||||||
|
@ -116,6 +117,18 @@ chain_type (type_t *type)
|
||||||
{
|
{
|
||||||
type->next = pr.types;
|
type->next = pr.types;
|
||||||
pr.types = type;
|
pr.types = type;
|
||||||
|
if (!type->encoding) {
|
||||||
|
static dstring_t *encoding;
|
||||||
|
|
||||||
|
if (!encoding)
|
||||||
|
encoding = dstring_newstr();
|
||||||
|
else
|
||||||
|
dstring_clearstr (encoding);
|
||||||
|
encode_type (encoding, type);
|
||||||
|
type->encoding = save_string (encoding->str);
|
||||||
|
}
|
||||||
|
if (!type->type_def)
|
||||||
|
type->type_def = qfo_encode_type (type);
|
||||||
}
|
}
|
||||||
|
|
||||||
type_t *
|
type_t *
|
||||||
|
|
Loading…
Reference in a new issue