clean out a bunch of unneeded code. this should take care of static linking

This commit is contained in:
Bill Currie 2001-11-13 20:34:21 +00:00
parent 645c400802
commit 68fb0a1147

View file

@ -197,67 +197,6 @@ ReuseString (const char *str)
return CopyString (str);
}
void
PrintStrings (void)
{
int i, l, j;
for (i = 0; i < strofs; i += l) {
l = strlen (strings + i) + 1;
printf ("%5i : ", i);
for (j = 0; j < l; j++) {
if (strings[i + j] == '\n') {
putchar ('\\');
putchar ('n');
} else {
putchar (strings[i + j]);
}
}
printf ("\n");
}
}
void
PrintFunctions (void)
{
int i, j;
dfunction_t *d;
for (i = 0; i < numfunctions; i++) {
d = &functions[i];
printf ("%s : %s : %i %i (", strings + d->s_file, strings + d->s_name,
d->first_statement, d->parm_start);
for (j = 0; j < d->numparms; j++)
printf ("%i ", d->parm_size[j]);
printf (")\n");
}
}
void
PrintFields (void)
{
int i;
ddef_t *d;
for (i = 0; i < numfielddefs; i++) {
d = &fields[i];
printf ("%5i : (%i) %s\n", d->ofs, d->type, strings + d->s_name);
}
}
void
PrintGlobals (void)
{
int i;
ddef_t *d;
for (i = 0; i < numglobaldefs; i++) {
d = &globals[i];
printf ("%5i : (%i) %s\n", d->ofs, d->type, strings + d->s_name);
}
}
void
InitData (void)
{
@ -506,177 +445,6 @@ PR_DefForFieldOfs (gofs_t ofs)
return NULL;
}
/*
PR_ValueString
Return a string describing *data in a type-specific manner
*/
char *
PR_ValueString (etype_t type, void *val)
{
static char line[256];
def_t *def;
dfunction_t *f;
switch (type) {
case ev_string:
sprintf (line, "%s", PR_String (strings + *(int *) val));
break;
case ev_entity:
sprintf (line, "entity %i", *(int *) val);
break;
case ev_func:
if (!(f = functions + *(int *) val))
sprintf (line, "undefined function");
else
sprintf (line, "%s()", strings + f->s_name);
break;
case ev_field:
def = PR_DefForFieldOfs (*(int *) val);
sprintf (line, ".%s", def->name);
break;
case ev_void:
sprintf (line, "void");
break;
case ev_float:
sprintf (line, "%5.1f", *(float *) val);
break;
case ev_vector:
sprintf (line, "'%5.1f %5.1f %5.1f'", ((float *) val)[0],
((float *) val)[1], ((float *) val)[2]);
break;
case ev_pointer:
sprintf (line, "pointer");
break;
default:
sprintf (line, "bad type %i", type);
break;
}
return line;
}
/*
PR_GlobalString
Return a string with a description and the contents of a global, padded
to 20 field width
*/
char *
PR_GlobalStringNoContents (gofs_t ofs)
{
int i;
def_t *def;
void *val;
static char line[128];
val = (void *) &pr_globals[ofs];
def = pr_global_defs[ofs];
if (!def) {
// Error ("PR_GlobalString: no def for %i", ofs);
sprintf (line, "%i(\?\?\?)", ofs);
} else {
sprintf (line, "%i(%s)", ofs, def->name);
}
for (i = strlen (line); i < 16; i++) {
strcat (line, " ");
}
strcat (line, " ");
return line;
}
char *
PR_GlobalString (gofs_t ofs)
{
char *s;
int i;
def_t *def;
void *val;
static char line[128];
val = (void *) &pr_globals[ofs];
if (!(def = pr_global_defs[ofs]))
return PR_GlobalStringNoContents (ofs);
if (def->constant && def->type->type != ev_func) {
s = PR_ValueString (def->type->type, &pr_globals[ofs]);
sprintf (line, "%i(%s)", ofs, s);
} else {
sprintf (line, "%i(%s)", ofs, def->name);
}
for (i = strlen (line); i < 16; i++) {
strcat (line, " ");
}
strcat (line, " ");
return line;
}
/*
============
PR_PrintOfs
============
*/
void
PR_PrintOfs (gofs_t ofs)
{
printf ("%s\n", PR_GlobalString (ofs));
}
/*
=================
PR_PrintStatement
=================
*/
void
PR_PrintStatement (dstatement_t *s)
{
int i;
opcode_t *op;
op = PR_Opcode (s->op);
printf ("%4i : %4i : %s ", (int) (s - statements),
statement_linenums[s - statements], op->opname);
for (i = strlen (op->opname); i < 10; i++) {
printf (" ");
}
if (s->op == OP_IF || s->op == OP_IFNOT) {
printf ("%sbranch %i", PR_GlobalString (s->a), s->b);
} else if (s->op == OP_GOTO) {
printf ("branch %i", s->a);
} else if ((unsigned) (s->op - OP_STORE_F) < 6) {
printf ("%s", PR_GlobalString (s->a));
printf ("%s", PR_GlobalStringNoContents (s->b));
} else {
if (s->a)
printf ("%s", PR_GlobalString (s->a));
if (s->b)
printf ("%s", PR_GlobalString (s->b));
if (s->c)
printf ("%s", PR_GlobalStringNoContents (s->c));
}
printf ("\n");
}
/*
PR_PrintDefs
*/
void
PR_PrintDefs (void)
{
def_t *d;
for (d = pr.def_head.def_next; d; d = d->def_next)
PR_PrintOfs (d->ofs);
}
/*
PR_BeginCompilation
@ -883,33 +651,6 @@ PR_WriteProgdefs (char *filename)
}
void
PrintFunction (const char *name)
{
int i;
dstatement_t *ds;
dfunction_t *df;
for (i = 0; i < numfunctions; i++)
if (!strcmp (name, strings + functions[i].s_name))
break;
if (i == numfunctions)
Error ("No function names \"%s\"", name);
df = functions + i;
printf ("Statements for %s:\n", name);
ds = statements + df->first_statement;
while (1) {
PR_PrintStatement (ds);
if (!ds->op)
break;
ds++;
}
}
void
PR_PrintFunction (def_t *def)
{