move qfprogs in with qfcc (it's going to need to share code)

This commit is contained in:
Bill Currie 2004-01-28 05:23:43 +00:00
parent 0e6681a069
commit d3018dd79b
23 changed files with 33 additions and 364 deletions

View file

@ -1646,7 +1646,7 @@ QF_WITH_TARGETS(
QF_WITH_TARGETS(
tools,
[ --with-tools=<list> compile qf tools:],
[bsp2img,carne,pak,qfbsp,qfcc,qflight,qfmodelgen,qfprogs,qfvis,qwaq,wad,wav],dummy
[bsp2img,carne,pak,qfbsp,qfcc,qflight,qfmodelgen,qfvis,qwaq,wad,wav],dummy
)
unset CL_TARGETS
@ -1832,9 +1832,6 @@ fi
if test "x$ENABLE_tools_qfmodelgen" = xyes; then
TOOLS_TARGETS="$TOOLS_TARGETS qfmodelgen"
fi
if test "x$ENABLE_tools_qfprogs" = xyes; then
TOOLS_TARGETS="$TOOLS_TARGETS qfprogs"
fi
if test "x$ENABLE_tools_qfvis" = xyes; then
TOOLS_TARGETS="$TOOLS_TARGETS qfvis"
fi
@ -1855,7 +1852,6 @@ AM_CONDITIONAL(BUILD_QFBSP, test "$ENABLE_tools_qfbsp" = "yes")
AM_CONDITIONAL(BUILD_QFCC, test "$ENABLE_tools_qfcc" = "yes")
AM_CONDITIONAL(BUILD_QFLIGHT, test "$ENABLE_tools_qflight" = "yes")
AM_CONDITIONAL(BUILD_QFMODELGEN, test "$ENABLE_tools_qfmodelgen" = "yes")
AM_CONDITIONAL(BUILD_QFPROGS, test "$ENABLE_tools_qfprogs" = "yes")
AM_CONDITIONAL(BUILD_QFVIS, test "$ENABLE_tools_qfvis" = "yes")
AM_CONDITIONAL(BUILD_QWAQ, test "$ENABLE_tools_qwaq" = "yes" -a "$ENABLE_tools_qfcc" = "yes")
AM_CONDITIONAL(BUILD_WAD, test "$ENABLE_tools_wad" = "yes")
@ -2107,11 +2103,6 @@ QF_DEPS(QFVIS,
[$(top_builddir)/libs/util/libQFutil.la],
[$(WIN32_LIBS)],
)
QF_DEPS(QFPROGS,
[-I$(top_srcdir)/tools/qfprogs/include],
[$(top_builddir)/libs/gamecode/engine/libQFgamecode.la $(top_builddir)/libs/util/libQFutil.la],
[$(WIN32_LIBS)],
)
QF_DEPS(QWAQ,
[],
[$(top_builddir)/libs/ruamoko/libQFruamoko.la $(top_builddir)/libs/gamecode/engine/libQFgamecode.la $(top_builddir)/libs/util/libQFutil.la],
@ -2227,9 +2218,6 @@ AC_OUTPUT(
tools/qfmodelgen/Makefile
tools/qfmodelgen/include/Makefile
tools/qfmodelgen/source/Makefile
tools/qfprogs/Makefile
tools/qfprogs/include/Makefile
tools/qfprogs/source/Makefile
tools/qfvis/Makefile
tools/qfvis/include/Makefile
tools/qfvis/source/Makefile

View file

@ -1,2 +1,2 @@
SUBDIRS=bsp2img carne pak qfbsp qfcc qflight qfmodelgen qfprogs qfvis qwaq wad wav
SUBDIRS=bsp2img carne pak qfbsp qfcc qflight qfmodelgen qfvis qwaq wad wav
bin_SCRIPTS=zpak

View file

@ -0,0 +1,23 @@
#ifndef __qfprogs_h
#define __qfprogs_h
struct progs_s;
extern int sorted;
extern int verbosity;
void disassemble_progs (struct progs_s *pr);
void dump_globals (struct progs_s *pr);
void dump_fields (struct progs_s *pr);
void dump_functions (struct progs_s *pr);
void dump_lines (struct progs_s *pr);
void dump_modules (struct progs_s *pr);
struct dfunction_s *func_find (int st_num);
void dump_strings (struct progs_s *pr);
#endif//__qfprogs_h

View file

@ -37,15 +37,14 @@ YFLAGS = -d
if BUILD_QFCC
qfcc=qfcc
qfodump=qfodump
qfprogs=qfprogs
else
qfcc=
qfodump=
qfprogs=
endif
bin_PROGRAMS= $(qfcc)
noinst_PROGRAMS= $(qfodump)
EXTRA_PROGRAMS= qfcc qfodump
bin_PROGRAMS= $(qfcc) $(qfprogs)
EXTRA_PROGRAMS= qfcc qfprogs
qfcc_SOURCES= \
class.c constfold.c cpp.c debug.c def.c emit.c expr.c function.c \
@ -55,9 +54,10 @@ qfcc_SOURCES= \
qfcc_LDADD= $(QFCC_LIBS)
qfcc_DEPENDENCIES= $(QFCC_DEPS)
qfodump_SOURCES= obj_file.c qfodump.c strpool.c
qfodump_LDADD= $(QFCC_LIBS)
qfodump_DEPENDENCIES= $(QFCC_DEPS)
qfprogs_SOURCES= \
disassemble.c globals.c lines.c modules.c qfprogs.c strings.c
qfprogs_LDADD= $(QFCC_LIBS)
qfprogs_DEPENDENCIES= $(QFCC_DEPS)
constfold.$(OBJEXT) emit.$(OBJEXT) expr.$(OBJEXT) switch.$(OBJEXT) qc-lex.$(OBJEXT): qc-parse.h

View file

@ -50,17 +50,10 @@ static __attribute__ ((unused)) const char rcsid[] =
# include <sys/fcntl.h>
#endif
#include "QF/cmd.h"
#include "QF/cvar.h"
#include "QF/progs.h"
#include "QF/quakeio.h"
#include "QF/sys.h"
#include "QF/zone.h"
#include "QF/quakeio.h"
#include "qfprogs.h"
#include "disassemble.h"
void
disassemble_progs (progs_t *pr)

View file

@ -46,7 +46,6 @@ static __attribute__ ((unused)) const char rcsid[] =
#include "QF/va.h"
#include "qfprogs.h"
#include "globals.h"
static int
cmp (const void *_a, const void *_b)

View file

@ -46,7 +46,6 @@ static __attribute__ ((unused)) const char rcsid[] =
#include "QF/progs.h"
#include "qfprogs.h"
#include "lines.h"
void
dump_lines (progs_t *pr)

View file

@ -48,7 +48,6 @@ static __attribute__ ((unused)) const char rcsid[] =
#include "QF/va.h"
#include "qfprogs.h"
#include "modules.h"
static void
dump_methods (progs_t *pr, pr_method_list_t *methods, int class)

View file

@ -1,201 +0,0 @@
/*
qfodump.c
qfcc object file dumping
Copyright (C) 2002 Bill Currie <bill@taniwha.org>
Author: Bill Currie <bill@taniwha.org>
Date: 2002/07/12
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
static __attribute__ ((unused)) const char rcsid[] =
"$Id$";
#include <stdlib.h>
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#ifdef HAVE_IO_H
# include <io.h>
#endif
#include <getopt.h>
#include "QF/dstring.h"
#include "QF/quakeio.h"
#include "class.h"
#include "debug.h"
#include "def.h"
#include "emit.h"
#include "function.h"
#include "immediate.h"
#include "obj_file.h"
#include "options.h"
#include "qfcc.h"
#include "type.h"
options_t options;
int num_linenos;
pr_lineno_t *linenos;
pr_info_t pr;
defspace_t *new_defspace (void) {return 0;}
scope_t *new_scope (scope_type type, defspace_t *space, scope_t *parent) {return 0;}
string_t ReuseString (const char *str) {return 0;}
void encode_type (dstring_t *str, type_t *type) {}
codespace_t *codespace_new (void) {return 0;}
void codespace_addcode (codespace_t *codespace, struct statement_s *code, int size) {}
type_t *parse_type (const char *str) {return 0;}
int function_parms (function_t *f, byte *parm_size) {return 0;}
pr_auxfunction_t *new_auxfunction (void) {return 0;}
ddef_t *new_local (void) {return 0;}
void def_to_ddef (def_t *def, ddef_t *ddef, int aux) {}
static const struct option long_options[] = {
{NULL, 0, NULL, 0},
};
static void
dump_defs (qfo_t *qfo)
{
qfo_def_t *def;
qfo_func_t *func;
for (def = qfo->defs; def - qfo->defs < qfo->num_defs; def++) {
printf ("%5ld %4d %4x %d %s %s %d %d %s:%d\n",
(long) (def - qfo->defs),
def->ofs,
def->flags,
def->basic_type,
qfo->types + def->full_type,
qfo->strings + def->name,
def->relocs, def->num_relocs,
qfo->strings + def->file, def->line);
if (def->flags & (QFOD_LOCAL | QFOD_EXTERNAL))
continue;
#if 1
if (def->basic_type == ev_string) {
printf (" %4d %s\n", qfo->data[def->ofs].string_var,
qfo->strings + qfo->data[def->ofs].string_var);
} else if (def->basic_type == ev_func) {
if (qfo->data[def->ofs].func_var < 1
|| qfo->data[def->ofs].func_var - 1 > qfo->num_funcs)
func = 0;
else
func = qfo->funcs + qfo->data[def->ofs].func_var - 1;
printf (" %4d %s\n", qfo->data[def->ofs].func_var,
func ? qfo->strings + func->name : "BORKAGE");
} else if (def->basic_type == ev_field) {
printf (" %4d\n", qfo->data[def->ofs].integer_var);
} else {
// printf (" %4d\n", qfo->data[def->ofs].integer_var);
}
#endif
}
}
static void
dump_funcs (qfo_t *qfo)
{
qfo_func_t *func;
int i;
const char *str = qfo->strings;
for (i = 0; i < qfo->num_funcs; i++) {
func = qfo->funcs + i;
printf ("%5d %s %s:%d %d?%d %d %d,%d\n", i,
str + func->name, str + func->file, func->line,
func->builtin, func->code, func->def,
func->relocs, func->num_relocs);
}
}
const char *reloc_names[] = {
"none",
"op_a_def",
"op_b_def",
"op_c_def",
"op_a_op",
"op_b_op",
"op_c_op",
"def_op",
"def_def",
"def_func",
"def_string",
"def_field",
"op_a_def_ofs",
"op_b_def_ofs",
"op_c_def_ofs",
"def_def_ofs",
};
static void
dump_relocs (qfo_t *qfo)
{
qfo_reloc_t *reloc;
int i;
for (i = 0; i < qfo->num_relocs; i++) {
reloc = qfo->relocs + i;
printf ("%5d %5d %-10s %d\n", i, reloc->ofs, reloc_names[reloc->type],
reloc->def);
}
}
static void
dump_lines (qfo_t *qfo)
{
pr_lineno_t *line;
int i;
for (i = 0; i < qfo->num_lines; i++) {
line = qfo->lines + i;
printf ("%5d %5d %d\n", i, line->fa.addr, line->line);
}
}
int
main (int argc, char **argv)
{
int c;
qfo_t *qfo;
while ((c = getopt_long (argc, argv, "", long_options, 0)) != EOF) {
switch (c) {
default:
return 1;
}
}
while (optind < argc) {
qfo = qfo_open (argv[optind++]);
if (!qfo)
return 1;
dump_defs (qfo);
dump_funcs (qfo);
dump_relocs (qfo);
dump_lines (qfo);
}
return 0;
}

View file

@ -65,12 +65,7 @@ static __attribute__ ((unused)) const char rcsid[] =
#include "QF/va.h"
#include "QF/zone.h"
#include "disassemble.h"
#include "globals.h"
#include "lines.h"
#include "modules.h"
#include "qfprogs.h"
#include "strings.h"
int sorted = 0;
int verbosity = 0;

View file

@ -1,11 +0,0 @@
.vimrc
ChangeLog
Makefile
Makefile.in
aclocal.m4
confdefs.h
configure
config.log
config.cache
config.status
qfcc.lsm

View file

@ -1,24 +0,0 @@
AUTOMAKE_OPTIONS= foreign
SUBDIRS= include source
#EXTRA_DIST=qfcc.lsm.in
dist-zip: distdir
-chmod -R a+r $(distdir)
ZIP="-r9q" zip $(distdir).zip $(NOCONV_DIST)
ZIP="-r9ql" zip $(distdir).zip $(distdir) -x $(NOCONV_DIST)
-rm -rf $(distdir)
dist-bz2: distdir
-chmod -R a+r $(distdir)
BZIP2="-9" $(TAR) Ichof $(distdir).tar.bz2 $(distdir)
-rm -rf $(distdir)
dist-all-local: distdir
-chmod -R a+r $(distdir)
GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir)
BZIP2="-9" $(TAR) Ichof $(distdir).tar.bz2 $(distdir)
ZIP="-r9q" zip $(distdir).zip $(NOCONV_DIST)
ZIP="-r9ql" zip $(distdir).zip $(distdir) -x $(NOCONV_DIST)
-rm -rf $(distdir)

View file

@ -1,6 +0,0 @@
.vimrc
config.h.in
Makefile.in
Makefile
config.h
stamp-*

View file

@ -1,3 +0,0 @@
AUTOMAKE_OPTIONS= foreign
EXTRA_DIST= disassemble.h globals.h lines.h modules.h qfprogs.h strings.h

View file

@ -1,8 +0,0 @@
#ifndef __disassemble_h
#define __disassemble_h
struct progs_s;
void disassemble_progs (struct progs_s *pr);
#endif//__disassemble_h

View file

@ -1,10 +0,0 @@
#ifndef __globals_h
#define __globals_h
struct progs_s;
void dump_globals (struct progs_s *pr);
void dump_fields (struct progs_s *pr);
void dump_functions (struct progs_s *pr);
#endif//__globals_h

View file

@ -1,8 +0,0 @@
#ifndef __lines_h
#define __lines_h
struct progs_s;
void dump_lines (struct progs_s *pr);
#endif//__lines_h

View file

@ -1,8 +0,0 @@
#ifndef __modules_h
#define __modules_h
struct progs_s;
void dump_modules (struct progs_s *pr);
#endif//__modules_h

View file

@ -1,11 +0,0 @@
#ifndef __qfprogs_h
#define __qfprogs_h
struct progs_s;
struct dfunction_s *func_find (int st_num);
extern int sorted;
extern int verbosity;
#endif//__qfprogs_h

View file

@ -1,8 +0,0 @@
#ifndef __strings_h
#define __strings_h
struct progs_s;
void dump_strings (struct progs_s *pr);
#endif//__strings_h

View file

@ -1,6 +0,0 @@
.deps
.libs
.vimrc
Makefile.in
Makefile
qfprogs

View file

@ -1,23 +0,0 @@
AUTOMAKE_OPTIONS= foreign
QFPROGS_LIBS=@QFPROGS_LIBS@
QFPROGS_DEPS=@QFPROGS_DEPS@
QFPROGS_INCS=@QFPROGS_INCS@
INCLUDES= -I$(top_srcdir)/include $(QFPROGS_INCS)
if BUILD_QFPROGS
qfprogs=qfprogs
else
qfprogs=
endif
bin_PROGRAMS= $(qfprogs)
EXTRA_PROGRAMS= qfprogs
#man_MANS= qfprogs.1
qfprogs_SOURCES= \
disassemble.c globals.c lines.c modules.c qfprogs.c strings.c
qfprogs_LDADD= $(QFPROGS_LIBS)
qfprogs_DEPENDENCIES= $(QFPROGS_DEPS)