mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-03-21 09:51:41 +00:00
Rename ty_type_e to ty_meta_e and type_t.ty to type_t.meta
This commit is contained in:
parent
d4be914019
commit
9b62c8c126
7 changed files with 39 additions and 39 deletions
|
@ -59,13 +59,13 @@ typedef enum {
|
|||
ty_enum,
|
||||
ty_array,
|
||||
ty_class,
|
||||
} ty_type_e;
|
||||
} ty_meta_e;
|
||||
|
||||
typedef struct type_s {
|
||||
etype_t type; ///< ev_invalid means structure/array etc
|
||||
const char *name;
|
||||
/// function/pointer/array/struct types are more complex
|
||||
ty_type_e ty;
|
||||
ty_meta_e meta;
|
||||
union {
|
||||
ty_func_t func;
|
||||
ty_fldptr_t fldptr;
|
||||
|
|
|
@ -240,7 +240,7 @@ init_classes (void)
|
|||
{
|
||||
symbol_t *sym;
|
||||
|
||||
type_Class.ty = ty_class;
|
||||
type_Class.meta = ty_class;
|
||||
type_Class.t.class = &class_Class;
|
||||
chain_type (&type_Class);
|
||||
chain_type (&type_ClassPtr);
|
||||
|
@ -252,7 +252,7 @@ init_classes (void)
|
|||
class_Class.methods = new_methodlist ();
|
||||
symtab_addsymbol (pr.symtab, sym);
|
||||
|
||||
type_Protocol.ty = ty_class;
|
||||
type_Protocol.meta = ty_class;
|
||||
type_Protocol.t.class = &class_Protocol;
|
||||
chain_type (&type_Protocol);
|
||||
sym = make_structure (0, 's', protocol_ivars, &type_Protocol);
|
||||
|
|
|
@ -466,7 +466,7 @@ transfer_type (qfo_t *qfo, qfo_mspace_t *space, pointer_t type_offset)
|
|||
if (type->ty < 0)
|
||||
return type->t.class;
|
||||
type->encoding = linker_add_string (QFOSTR (qfo, type->encoding));
|
||||
switch ((ty_type_e) type->ty) {
|
||||
switch ((ty_meta_e) type->ty) {
|
||||
case ty_none:
|
||||
if (type->t.type == ev_func) {
|
||||
int count;
|
||||
|
|
|
@ -612,7 +612,7 @@ get_def_type (qfo_t *qfo, pointer_t type)
|
|||
if (type < 0 || type >= qfo->spaces[qfo_type_space].data_size)
|
||||
return ev_void;
|
||||
type_def = QFO_POINTER (qfo, qfo_type_space, qfot_type_t, type);
|
||||
switch ((ty_type_e)type_def->ty) {
|
||||
switch ((ty_meta_e)type_def->ty) {
|
||||
case ty_none:
|
||||
// field, pointer and function types store their basic type in
|
||||
// the same location.
|
||||
|
@ -637,7 +637,7 @@ get_type_size (qfo_t *qfo, pointer_t type)
|
|||
if (type < 0 || type >= qfo->spaces[qfo_type_space].data_size)
|
||||
return 1;
|
||||
type_def = QFO_POINTER (qfo, qfo_type_space, qfot_type_t, type);
|
||||
switch ((ty_type_e)type_def->ty) {
|
||||
switch ((ty_meta_e)type_def->ty) {
|
||||
case ty_none:
|
||||
// field, pointer and function types store their basic type in
|
||||
// the same location.
|
||||
|
|
|
@ -89,7 +89,7 @@ qfo_new_encoding (type_t *type, int size)
|
|||
def->offset = defspace_alloc_loc (pr.type_data, size);
|
||||
|
||||
enc = D_POINTER (qfot_type_t, def);
|
||||
enc->ty = type->ty;
|
||||
enc->ty = type->meta;
|
||||
enc->size = size;
|
||||
ENC_STR (enc->encoding, type->encoding);
|
||||
return def;
|
||||
|
@ -174,7 +174,7 @@ qfo_encode_struct (type_t *type)
|
|||
int offset;
|
||||
|
||||
sy = sy_var;
|
||||
if (type->ty == ty_enum)
|
||||
if (type->meta == ty_enum)
|
||||
sy = sy_const;
|
||||
if (!type->t.symtab) {
|
||||
def = new_def (type->encoding, 0, pr.type_data, st_extern);
|
||||
|
@ -185,7 +185,7 @@ qfo_encode_struct (type_t *type)
|
|||
continue;
|
||||
num_fields++;
|
||||
}
|
||||
if (type->ty != ty_enum) {
|
||||
if (type->meta != ty_enum) {
|
||||
field_types = alloca (num_fields * sizeof (def_t *));
|
||||
for (i = 0, sym = type->t.symtab->symbols; sym; sym = sym->next) {
|
||||
if (sym->sy_type != sy)
|
||||
|
@ -268,8 +268,8 @@ qfo_encode_type (type_t *type)
|
|||
}
|
||||
if (type->type_def)
|
||||
return type->type_def;
|
||||
if (type->ty < 0 || type->ty > ty_class)
|
||||
if (type->meta < 0 || type->meta > ty_class)
|
||||
internal_error (0, "bad type meta type");
|
||||
type->type_def = funcs[type->ty] (type);
|
||||
type->type_def = funcs[type->meta] (type);
|
||||
return type->type_def;
|
||||
}
|
||||
|
|
|
@ -64,7 +64,7 @@ static __attribute__ ((used)) const char rcsid[] =
|
|||
#include "type.h"
|
||||
|
||||
static symbol_t *
|
||||
find_tag (ty_type_e ty, symbol_t *tag, type_t *type)
|
||||
find_tag (ty_meta_e meta, symbol_t *tag, type_t *type)
|
||||
{
|
||||
const char *tag_name;
|
||||
symbol_t *sym;
|
||||
|
@ -80,9 +80,9 @@ find_tag (ty_type_e ty, symbol_t *tag, type_t *type)
|
|||
}
|
||||
sym = symtab_lookup (current_symtab, tag_name);
|
||||
if (sym) {
|
||||
if (sym->table == current_symtab && sym->type->ty != ty)
|
||||
if (sym->table == current_symtab && sym->type->meta != meta)
|
||||
error (0, "%s defined as wrong kind of tag", tag->name);
|
||||
if (sym->type->ty == ty)
|
||||
if (sym->type->meta == meta)
|
||||
return sym;
|
||||
}
|
||||
sym = new_symbol (tag_name);
|
||||
|
@ -92,7 +92,7 @@ find_tag (ty_type_e ty, symbol_t *tag, type_t *type)
|
|||
type->name = sym->name;
|
||||
sym->type = type;
|
||||
sym->type->type = ev_invalid;
|
||||
sym->type->ty = ty;
|
||||
sym->type->meta = meta;
|
||||
sym->sy_type = sy_type;
|
||||
return sym;
|
||||
}
|
||||
|
@ -100,12 +100,12 @@ find_tag (ty_type_e ty, symbol_t *tag, type_t *type)
|
|||
symbol_t *
|
||||
find_struct (int su, symbol_t *tag, type_t *type)
|
||||
{
|
||||
ty_type_e ty = ty_struct;
|
||||
ty_meta_e meta = ty_struct;
|
||||
|
||||
if (su == 'u')
|
||||
ty = ty_union;
|
||||
meta = ty_union;
|
||||
|
||||
return find_tag (ty, tag, type);
|
||||
return find_tag (meta, tag, type);
|
||||
}
|
||||
|
||||
symbol_t *
|
||||
|
@ -265,8 +265,8 @@ emit_structure (const char *name, int su, struct_def_t *defs, type_t *type,
|
|||
name = save_string (name);
|
||||
if (!type)
|
||||
type = make_structure (0, su, defs, 0)->type;
|
||||
if (!is_struct (type) || (su == 's' && type->ty != ty_struct)
|
||||
|| (su == 'u' && type->ty != ty_union))
|
||||
if (!is_struct (type) || (su == 's' && type->meta != ty_struct)
|
||||
|| (su == 'u' && type->meta != ty_union))
|
||||
internal_error (0, "structure %s type mismatch", name);
|
||||
for (i = 0, field_sym = type->t.symtab->symbols; field_sym;
|
||||
i++, field_sym = field_sym->next) {
|
||||
|
|
|
@ -164,7 +164,7 @@ free_type (type_t *type)
|
|||
free_type (type->t.func.type);
|
||||
break;
|
||||
case ev_invalid:
|
||||
if (type->ty == ty_array)
|
||||
if (type->meta == ty_array)
|
||||
free_type (type->t.array.type);
|
||||
break;
|
||||
}
|
||||
|
@ -198,7 +198,7 @@ append_type (type_t *type, type_t *new)
|
|||
t = &(*t)->t.func.type;
|
||||
break;
|
||||
case ev_invalid:
|
||||
if ((*t)->ty == ty_array)
|
||||
if ((*t)->meta == ty_array)
|
||||
t = &(*t)->t.array.type;
|
||||
else
|
||||
internal_error (0, "append to object type");
|
||||
|
@ -214,9 +214,9 @@ types_same (type_t *a, type_t *b)
|
|||
{
|
||||
int i, count;
|
||||
|
||||
if (a->type != b->type || a->ty != b->ty)
|
||||
if (a->type != b->type || a->meta != b->meta)
|
||||
return 0;
|
||||
switch (a->ty) {
|
||||
switch (a->meta) {
|
||||
case ty_none:
|
||||
switch (a->type) {
|
||||
case ev_field:
|
||||
|
@ -276,7 +276,7 @@ find_type (type_t *type)
|
|||
return 0;
|
||||
|
||||
if (type->freeable) {
|
||||
switch (type->ty) {
|
||||
switch (type->meta) {
|
||||
case ty_none:
|
||||
switch (type->type) {
|
||||
case ev_field:
|
||||
|
@ -368,7 +368,7 @@ array_type (type_t *aux, int size)
|
|||
else
|
||||
new = new_type ();
|
||||
new->type = ev_invalid;
|
||||
new->ty = ty_array;
|
||||
new->meta = ty_array;
|
||||
new->t.array.type = aux;
|
||||
new->t.array.size = size;
|
||||
if (aux)
|
||||
|
@ -387,7 +387,7 @@ based_array_type (type_t *aux, int base, int top)
|
|||
else
|
||||
new = new_type ();
|
||||
new->type = ev_invalid;
|
||||
new->ty = ty_array;
|
||||
new->meta = ty_array;
|
||||
new->t.array.type = aux;
|
||||
new->t.array.base = base;
|
||||
new->t.array.size = top - base + 1;
|
||||
|
@ -442,7 +442,7 @@ print_type_str (dstring_t *str, type_t *type)
|
|||
dasprintf (str, ")");
|
||||
break;
|
||||
case ev_invalid:
|
||||
switch (type->ty) {
|
||||
switch (type->meta) {
|
||||
case ty_class:
|
||||
dasprintf (str, " %s", type->t.class->name);
|
||||
break;
|
||||
|
@ -523,7 +523,7 @@ encode_struct (dstring_t *encoding, type_t *type)
|
|||
|
||||
if (type->name)
|
||||
name = type->name;
|
||||
if (type->ty == ty_union)
|
||||
if (type->meta == ty_union)
|
||||
su = '-';
|
||||
else
|
||||
su = '=';
|
||||
|
@ -597,7 +597,7 @@ encode_type (dstring_t *encoding, type_t *type)
|
|||
dasprintf (encoding, "s");
|
||||
break;
|
||||
case ev_invalid:
|
||||
switch (type->ty) {
|
||||
switch (type->meta) {
|
||||
case ty_class:
|
||||
encode_class (encoding, type);
|
||||
break;
|
||||
|
@ -631,7 +631,7 @@ encode_type (dstring_t *encoding, type_t *type)
|
|||
int
|
||||
is_enum (type_t *type)
|
||||
{
|
||||
if (type->type == ev_invalid && type->ty == ty_enum)
|
||||
if (type->type == ev_invalid && type->meta == ty_enum)
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
@ -670,7 +670,7 @@ int
|
|||
is_struct (type_t *type)
|
||||
{
|
||||
if (type->type == ev_invalid
|
||||
&& (type->ty == ty_struct || type->ty == ty_union))
|
||||
&& (type->meta == ty_struct || type->meta == ty_union))
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
@ -678,7 +678,7 @@ is_struct (type_t *type)
|
|||
int
|
||||
is_class (type_t *type)
|
||||
{
|
||||
if (type->type == ev_invalid && type->ty == ty_class)
|
||||
if (type->type == ev_invalid && type->meta == ty_class)
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
@ -686,7 +686,7 @@ is_class (type_t *type)
|
|||
int
|
||||
is_array (type_t *type)
|
||||
{
|
||||
if (type->type == ev_invalid && type->ty == ty_array)
|
||||
if (type->type == ev_invalid && type->meta == ty_array)
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
@ -709,7 +709,7 @@ type_assignable (type_t *dst, type_t *src)
|
|||
return 1;
|
||||
// pointer = array
|
||||
if (dst->type == ev_pointer
|
||||
&& src->type == ev_invalid && src->ty == ty_array) {
|
||||
&& src->type == ev_invalid && src->meta == ty_array) {
|
||||
if (dst->t.fldptr.type == src->t.array.type)
|
||||
return 1;
|
||||
return 0;
|
||||
|
@ -759,7 +759,7 @@ type_size (type_t *type)
|
|||
case ev_type_count:
|
||||
return pr_type_size[type->type];
|
||||
case ev_invalid:
|
||||
switch (type->ty) {
|
||||
switch (type->meta) {
|
||||
case ty_enum:
|
||||
if (!type->t.symtab)
|
||||
return 0;
|
||||
|
@ -846,14 +846,14 @@ init_types (void)
|
|||
make_structure (0, 'u', param_struct, &type_param);
|
||||
make_structure (0, 's', vector_struct, &type_vector);
|
||||
type_vector.type = ev_vector;
|
||||
type_vector.ty = ty_none;
|
||||
type_vector.meta = ty_none;
|
||||
|
||||
if (options.traditional)
|
||||
return;
|
||||
|
||||
make_structure (0, 's', quaternion_struct, &type_quaternion);
|
||||
type_quaternion.type = ev_quat;
|
||||
type_quaternion.ty = ty_none;
|
||||
type_quaternion.meta = ty_none;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
Loading…
Reference in a new issue