mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-04-24 18:50:14 +00:00
Remove some redundant fields from qfo objects.
This commit is contained in:
parent
c585a17db9
commit
a1ea492889
3 changed files with 24 additions and 46 deletions
|
@ -67,6 +67,7 @@ typedef struct qfo_header_s {
|
||||||
pr_int_t num_defs; ///< number of def records
|
pr_int_t num_defs; ///< number of def records
|
||||||
pr_int_t num_funcs; ///< number of function records
|
pr_int_t num_funcs; ///< number of function records
|
||||||
pr_int_t num_lines; ///< number of line records
|
pr_int_t num_lines; ///< number of line records
|
||||||
|
pr_int_t reserved[1];
|
||||||
} qfo_header_t;
|
} qfo_header_t;
|
||||||
|
|
||||||
typedef enum qfos_type_e {
|
typedef enum qfos_type_e {
|
||||||
|
@ -87,6 +88,7 @@ typedef struct qfo_space_s {
|
||||||
pr_int_t data; ///< byte offset in qfo
|
pr_int_t data; ///< byte offset in qfo
|
||||||
pr_int_t data_size; ///< in elements. zero for entity spaces
|
pr_int_t data_size; ///< in elements. zero for entity spaces
|
||||||
pr_int_t id;
|
pr_int_t id;
|
||||||
|
pr_int_t reserved[2];
|
||||||
} qfo_space_t;
|
} qfo_space_t;
|
||||||
|
|
||||||
/** Representation of a def in the object file.
|
/** Representation of a def in the object file.
|
||||||
|
@ -94,7 +96,6 @@ typedef struct qfo_space_s {
|
||||||
typedef struct qfo_def_s {
|
typedef struct qfo_def_s {
|
||||||
pointer_t type; ///< offset in type space
|
pointer_t type; ///< offset in type space
|
||||||
string_t name; ///< def name
|
string_t name; ///< def name
|
||||||
pr_int_t space; ///< index of space holding this def's data
|
|
||||||
pointer_t offset; ///< def offset (address)
|
pointer_t offset; ///< def offset (address)
|
||||||
|
|
||||||
pr_int_t relocs; ///< index of first reloc record
|
pr_int_t relocs; ///< index of first reloc record
|
||||||
|
@ -170,53 +171,29 @@ typedef struct qfo_def_s {
|
||||||
*/
|
*/
|
||||||
typedef struct qfo_func_s {
|
typedef struct qfo_func_s {
|
||||||
string_t name; ///< function name
|
string_t name; ///< function name
|
||||||
|
pointer_t type; ///< function type (in type data space)
|
||||||
string_t file; ///< source file name
|
string_t file; ///< source file name
|
||||||
pr_int_t line; ///< source line number
|
pr_int_t line; ///< source line number
|
||||||
|
|
||||||
/** \name Function code location.
|
/** \name Function code location.
|
||||||
If #code is 0, or #builtin is non-zero, then the function is a VM
|
If #code is negative, then the function is a VM builtin function.
|
||||||
builtin function.
|
If #code is 0, then the function is a VM builtin function and the
|
||||||
If both #code and #builtin are 0, then the function is a VM builtin
|
VM resolves the function number using the function name.
|
||||||
function and the VM resolves the function number using the function
|
If #code is positive, then the function is in progs and #code is
|
||||||
name.
|
the first statement of the function.
|
||||||
*/
|
*/
|
||||||
//@{
|
pr_int_t code;
|
||||||
pr_int_t builtin; ///< VM builtin function number
|
|
||||||
pr_int_t code; ///< Address in the code section of the first
|
|
||||||
///< instruction of the function.
|
|
||||||
//@}
|
|
||||||
|
|
||||||
pr_int_t def; ///< def that references this function. Index
|
pr_int_t def; ///< def that references this function. Index
|
||||||
///< to ::qfo_def_t. The data word pointed to
|
///< to ::qfo_def_t. The data word pointed to
|
||||||
///< by the def stores the index of this
|
///< by the def stores the index of this
|
||||||
///< function.
|
///< function.
|
||||||
|
|
||||||
/** \name Function local data.
|
pr_int_t locals_space; ///< space holding the function's local data
|
||||||
*/
|
|
||||||
//@{
|
|
||||||
pr_int_t locals_size; ///< Number of words of local data reqired by
|
|
||||||
///< the function.
|
|
||||||
pr_int_t local_defs; ///< Index to the first ::qfo_def_t def record
|
|
||||||
///< representing the functions local
|
|
||||||
///< variables.
|
|
||||||
pr_int_t num_local_defs; ///< Number of local def records.
|
|
||||||
//@}
|
|
||||||
|
|
||||||
pr_int_t line_info; ///< Index to first ::pr_lineno_t line record.
|
pr_int_t line_info; ///< Index to first ::pr_lineno_t line record.
|
||||||
///< Zero if there are no records.
|
///< Zero if there are no records.
|
||||||
|
|
||||||
/** \name Function parameters.
|
|
||||||
*/
|
|
||||||
//@{
|
|
||||||
pr_int_t num_parms; ///< Number of parameters this function
|
|
||||||
///< accepts. Maximum number is defined by
|
|
||||||
///< #MAX_PARMS. Negative numbers give the
|
|
||||||
///< minumum number of parameters by
|
|
||||||
///< \f$-num\_parms - 1\f$
|
|
||||||
byte parm_size[MAX_PARMS]; ///< Number of words used by each
|
|
||||||
///< parameter.
|
|
||||||
//@}
|
|
||||||
|
|
||||||
/** \name Function relocation records.
|
/** \name Function relocation records.
|
||||||
XXX not sure how these work
|
XXX not sure how these work
|
||||||
*/
|
*/
|
||||||
|
@ -224,6 +201,7 @@ typedef struct qfo_func_s {
|
||||||
pr_int_t relocs; ///< Index to first ::qfo_reloc_t reloc record.
|
pr_int_t relocs; ///< Index to first ::qfo_reloc_t reloc record.
|
||||||
pr_int_t num_relocs; ///< Number of reloc records.
|
pr_int_t num_relocs; ///< Number of reloc records.
|
||||||
//@}
|
//@}
|
||||||
|
pr_int_t reserved[2];
|
||||||
} qfo_func_t;
|
} qfo_func_t;
|
||||||
|
|
||||||
/** Evil source of many headaches. The whole reason I've started writing this
|
/** Evil source of many headaches. The whole reason I've started writing this
|
||||||
|
|
|
@ -347,10 +347,10 @@ qfo_functions (qfo_t *qfo)
|
||||||
// QFO_GETSTR (qfo, def->name));
|
// QFO_GETSTR (qfo, def->name));
|
||||||
// if (!(def->flags & QFOD_EXTERNAL))
|
// if (!(def->flags & QFOD_EXTERNAL))
|
||||||
// printf (" %d", qfo->data[def->offset].integer_var);
|
// printf (" %d", qfo->data[def->offset].integer_var);
|
||||||
if (func->code)
|
if (func->code > 0)
|
||||||
printf (" @ %x", func->code);
|
printf (" @ %x", func->code);
|
||||||
else
|
else
|
||||||
printf (" = #%d", func->builtin);
|
printf (" = #%d", -func->code);
|
||||||
puts ("");
|
puts ("");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -425,16 +425,16 @@ add_funcs (qfo_t *qfo)
|
||||||
// func->file = strpool_addstr (strings, qfo->strings + func->file);
|
// func->file = strpool_addstr (strings, qfo->strings + func->file);
|
||||||
if (func->code)
|
if (func->code)
|
||||||
func->code += code_base;
|
func->code += code_base;
|
||||||
if (func->num_local_defs) {
|
// if (func->num_local_defs) {
|
||||||
int def_num = local_defs.num_defs;
|
// int def_num = local_defs.num_defs;
|
||||||
qfo_def_t *d;
|
// qfo_def_t *d;
|
||||||
defgroup_add_defs (&local_defs, qfo->defs + func->local_defs,
|
// defgroup_add_defs (&local_defs, qfo->defs + func->local_defs,
|
||||||
func->num_local_defs);
|
// func->num_local_defs);
|
||||||
func->local_defs = def_num;
|
// func->local_defs = def_num;
|
||||||
for (d = local_defs.defs + def_num; def_num < local_defs.num_defs;
|
// for (d = local_defs.defs + def_num; def_num < local_defs.num_defs;
|
||||||
d++, def_num++)
|
// d++, def_num++)
|
||||||
fixup_def (qfo, d, def_num);
|
// fixup_def (qfo, d, def_num);
|
||||||
}
|
// }
|
||||||
if (func->line_info)
|
if (func->line_info)
|
||||||
func->line_info += line_base;
|
func->line_info += line_base;
|
||||||
func->relocs += reloc_base;
|
func->relocs += reloc_base;
|
||||||
|
@ -630,7 +630,7 @@ merge_defgroups (void)
|
||||||
for (i = 0; i < funcs.num_funcs; i++) {
|
for (i = 0; i < funcs.num_funcs; i++) {
|
||||||
int r = final_relocs.num_relocs;
|
int r = final_relocs.num_relocs;
|
||||||
func = funcs.funcs + i;
|
func = funcs.funcs + i;
|
||||||
func->local_defs += local_base;
|
// func->local_defs += local_base;
|
||||||
relocgroup_add_relocs (&final_relocs, relocs.relocs + func->relocs,
|
relocgroup_add_relocs (&final_relocs, relocs.relocs + func->relocs,
|
||||||
func->num_relocs);
|
func->num_relocs);
|
||||||
for (j = 0; j < func->num_relocs; j++)
|
for (j = 0; j < func->num_relocs; j++)
|
||||||
|
|
Loading…
Reference in a new issue