2002-05-13 19:37:36 +00:00
|
|
|
/*
|
2011-01-24 23:54:02 +00:00
|
|
|
disassemble.c
|
2002-05-13 19:37:36 +00:00
|
|
|
|
2011-01-24 23:54:02 +00:00
|
|
|
Dump progs disassembly.
|
2002-05-13 19:37:36 +00:00
|
|
|
|
2011-01-24 23:54:02 +00:00
|
|
|
Copyright (C) 2002 Bill Currie <bill@taniwha.org>
|
2002-05-13 19:37:36 +00:00
|
|
|
|
2011-01-24 23:54:02 +00:00
|
|
|
Author: Bill Currie <bill@taniwha.org>
|
|
|
|
Date: 2002/05/13
|
2002-05-13 19:37:36 +00:00
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU General Public License
|
|
|
|
as published by the Free Software Foundation; either version 2
|
|
|
|
of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
|
|
|
|
See the GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to:
|
|
|
|
|
|
|
|
Free Software Foundation, Inc.
|
|
|
|
59 Temple Place - Suite 330
|
|
|
|
Boston, MA 02111-1307, USA
|
|
|
|
|
|
|
|
*/
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include "config.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <getopt.h>
|
|
|
|
#include <stdlib.h>
|
2007-04-07 01:41:23 +00:00
|
|
|
#ifdef HAVE_STRING_H
|
|
|
|
# include <string.h>
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_STRINGS_H
|
|
|
|
# include <strings.h>
|
|
|
|
#endif
|
2002-05-13 19:37:36 +00:00
|
|
|
#ifdef HAVE_UNISTD_H
|
|
|
|
# include <unistd.h>
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_IO_H
|
|
|
|
# include <io.h>
|
|
|
|
#endif
|
|
|
|
#include <sys/types.h>
|
2004-01-20 05:57:39 +00:00
|
|
|
|
|
|
|
#ifdef HAVE_FCNTL_H
|
|
|
|
# include <fcntl.h>
|
|
|
|
#else
|
|
|
|
# include <sys/fcntl.h>
|
|
|
|
#endif
|
2002-05-13 19:37:36 +00:00
|
|
|
|
|
|
|
#include "QF/progs.h"
|
|
|
|
#include "QF/sys.h"
|
|
|
|
|
2020-06-21 14:15:17 +00:00
|
|
|
#include "tools/qfcc/include/qfprogs.h"
|
2002-05-13 19:37:36 +00:00
|
|
|
|
|
|
|
void
|
|
|
|
disassemble_progs (progs_t *pr)
|
|
|
|
{
|
2003-04-17 00:01:48 +00:00
|
|
|
unsigned int i;
|
2002-05-13 19:37:36 +00:00
|
|
|
|
2022-01-26 10:30:25 +00:00
|
|
|
for (i = 0; i < pr->progs->statements.count; i++) {
|
2007-04-07 01:41:23 +00:00
|
|
|
dfunction_t *desc = func_find (i);
|
|
|
|
|
|
|
|
if (desc) {
|
|
|
|
bfunction_t func;
|
|
|
|
|
|
|
|
func.first_statement = desc->first_statement;
|
2022-01-27 01:55:06 +00:00
|
|
|
func.params_start = desc->params_start;
|
2007-04-07 01:41:23 +00:00
|
|
|
func.locals = desc->locals;
|
2022-01-27 01:55:06 +00:00
|
|
|
func.numparams = desc->numparams;
|
|
|
|
memcpy (func.param_size, desc->param_size,
|
|
|
|
sizeof (func.param_size));
|
2007-04-07 01:41:23 +00:00
|
|
|
func.descriptor = desc;
|
|
|
|
|
2021-12-31 06:02:31 +00:00
|
|
|
Sys_Printf ("%s:\n", PR_GetString (pr, desc->name));
|
2007-04-07 01:41:23 +00:00
|
|
|
pr->pr_xfunction = &func;
|
2002-06-11 17:24:37 +00:00
|
|
|
}
|
2012-12-12 07:20:45 +00:00
|
|
|
PR_PrintStatement (pr, &pr->pr_statements[i], 2 | (verbosity > 1));
|
2002-05-13 19:37:36 +00:00
|
|
|
}
|
|
|
|
}
|