From d3018dd79b16e4285a83a368a380986c34898f34 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Wed, 28 Jan 2004 05:23:43 +0000 Subject: [PATCH] move qfprogs in with qfcc (it's going to need to share code) --- configure.ac | 14 +- tools/Makefile.am | 2 +- tools/qfcc/include/qfprogs.h | 23 +++ tools/qfcc/source/Makefile.am | 16 +- tools/{qfprogs => qfcc}/source/disassemble.c | 7 - tools/{qfprogs => qfcc}/source/globals.c | 1 - tools/{qfprogs => qfcc}/source/lines.c | 1 - tools/{qfprogs => qfcc}/source/modules.c | 1 - tools/qfcc/source/qfodump.c | 201 ------------------- tools/{qfprogs => qfcc}/source/qfprogs.c | 5 - tools/{qfprogs => qfcc}/source/strings.c | 0 tools/qfprogs/.gitignore | 11 - tools/qfprogs/Makefile.am | 24 --- tools/qfprogs/include/.gitignore | 6 - tools/qfprogs/include/Makefile.am | 3 - tools/qfprogs/include/disassemble.h | 8 - tools/qfprogs/include/globals.h | 10 - tools/qfprogs/include/lines.h | 8 - tools/qfprogs/include/modules.h | 8 - tools/qfprogs/include/qfprogs.h | 11 - tools/qfprogs/include/strings.h | 8 - tools/qfprogs/source/.gitignore | 6 - tools/qfprogs/source/Makefile.am | 23 --- 23 files changed, 33 insertions(+), 364 deletions(-) create mode 100644 tools/qfcc/include/qfprogs.h rename tools/{qfprogs => qfcc}/source/disassemble.c (91%) rename tools/{qfprogs => qfcc}/source/globals.c (99%) rename tools/{qfprogs => qfcc}/source/lines.c (99%) rename tools/{qfprogs => qfcc}/source/modules.c (99%) delete mode 100644 tools/qfcc/source/qfodump.c rename tools/{qfprogs => qfcc}/source/qfprogs.c (98%) rename tools/{qfprogs => qfcc}/source/strings.c (100%) delete mode 100644 tools/qfprogs/.gitignore delete mode 100644 tools/qfprogs/Makefile.am delete mode 100644 tools/qfprogs/include/.gitignore delete mode 100644 tools/qfprogs/include/Makefile.am delete mode 100644 tools/qfprogs/include/disassemble.h delete mode 100644 tools/qfprogs/include/globals.h delete mode 100644 tools/qfprogs/include/lines.h delete mode 100644 tools/qfprogs/include/modules.h delete mode 100644 tools/qfprogs/include/qfprogs.h delete mode 100644 tools/qfprogs/include/strings.h delete mode 100644 tools/qfprogs/source/.gitignore delete mode 100644 tools/qfprogs/source/Makefile.am diff --git a/configure.ac b/configure.ac index eb604037d..c13f91cfb 100644 --- a/configure.ac +++ b/configure.ac @@ -1646,7 +1646,7 @@ QF_WITH_TARGETS( QF_WITH_TARGETS( tools, [ --with-tools= 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 diff --git a/tools/Makefile.am b/tools/Makefile.am index 3d7f0fef9..a39d39b54 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -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 diff --git a/tools/qfcc/include/qfprogs.h b/tools/qfcc/include/qfprogs.h new file mode 100644 index 000000000..fdf491c94 --- /dev/null +++ b/tools/qfcc/include/qfprogs.h @@ -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 diff --git a/tools/qfcc/source/Makefile.am b/tools/qfcc/source/Makefile.am index bb25628aa..e5c0e3780 100644 --- a/tools/qfcc/source/Makefile.am +++ b/tools/qfcc/source/Makefile.am @@ -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 diff --git a/tools/qfprogs/source/disassemble.c b/tools/qfcc/source/disassemble.c similarity index 91% rename from tools/qfprogs/source/disassemble.c rename to tools/qfcc/source/disassemble.c index 07cf8c30e..06aa2ec4a 100644 --- a/tools/qfprogs/source/disassemble.c +++ b/tools/qfcc/source/disassemble.c @@ -50,17 +50,10 @@ static __attribute__ ((unused)) const char rcsid[] = # include #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) diff --git a/tools/qfprogs/source/globals.c b/tools/qfcc/source/globals.c similarity index 99% rename from tools/qfprogs/source/globals.c rename to tools/qfcc/source/globals.c index 7e58e25b3..567d1f38d 100644 --- a/tools/qfprogs/source/globals.c +++ b/tools/qfcc/source/globals.c @@ -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) diff --git a/tools/qfprogs/source/lines.c b/tools/qfcc/source/lines.c similarity index 99% rename from tools/qfprogs/source/lines.c rename to tools/qfcc/source/lines.c index d7dcfd14b..9963db225 100644 --- a/tools/qfprogs/source/lines.c +++ b/tools/qfcc/source/lines.c @@ -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) diff --git a/tools/qfprogs/source/modules.c b/tools/qfcc/source/modules.c similarity index 99% rename from tools/qfprogs/source/modules.c rename to tools/qfcc/source/modules.c index 23ce8bd03..e68279087 100644 --- a/tools/qfprogs/source/modules.c +++ b/tools/qfcc/source/modules.c @@ -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) diff --git a/tools/qfcc/source/qfodump.c b/tools/qfcc/source/qfodump.c deleted file mode 100644 index 2ff8e58a4..000000000 --- a/tools/qfcc/source/qfodump.c +++ /dev/null @@ -1,201 +0,0 @@ -/* - qfodump.c - - qfcc object file dumping - - Copyright (C) 2002 Bill Currie - - Author: Bill Currie - 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 -#ifdef HAVE_UNISTD_H -# include -#endif -#ifdef HAVE_IO_H -# include -#endif -#include - -#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; -} diff --git a/tools/qfprogs/source/qfprogs.c b/tools/qfcc/source/qfprogs.c similarity index 98% rename from tools/qfprogs/source/qfprogs.c rename to tools/qfcc/source/qfprogs.c index 779c847e3..b0d9aee9a 100644 --- a/tools/qfprogs/source/qfprogs.c +++ b/tools/qfcc/source/qfprogs.c @@ -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; diff --git a/tools/qfprogs/source/strings.c b/tools/qfcc/source/strings.c similarity index 100% rename from tools/qfprogs/source/strings.c rename to tools/qfcc/source/strings.c diff --git a/tools/qfprogs/.gitignore b/tools/qfprogs/.gitignore deleted file mode 100644 index c2d8f2564..000000000 --- a/tools/qfprogs/.gitignore +++ /dev/null @@ -1,11 +0,0 @@ -.vimrc -ChangeLog -Makefile -Makefile.in -aclocal.m4 -confdefs.h -configure -config.log -config.cache -config.status -qfcc.lsm diff --git a/tools/qfprogs/Makefile.am b/tools/qfprogs/Makefile.am deleted file mode 100644 index c894f9959..000000000 --- a/tools/qfprogs/Makefile.am +++ /dev/null @@ -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) diff --git a/tools/qfprogs/include/.gitignore b/tools/qfprogs/include/.gitignore deleted file mode 100644 index dd54fd6f5..000000000 --- a/tools/qfprogs/include/.gitignore +++ /dev/null @@ -1,6 +0,0 @@ -.vimrc -config.h.in -Makefile.in -Makefile -config.h -stamp-* diff --git a/tools/qfprogs/include/Makefile.am b/tools/qfprogs/include/Makefile.am deleted file mode 100644 index a40b5e35c..000000000 --- a/tools/qfprogs/include/Makefile.am +++ /dev/null @@ -1,3 +0,0 @@ -AUTOMAKE_OPTIONS= foreign - -EXTRA_DIST= disassemble.h globals.h lines.h modules.h qfprogs.h strings.h diff --git a/tools/qfprogs/include/disassemble.h b/tools/qfprogs/include/disassemble.h deleted file mode 100644 index 4b1165890..000000000 --- a/tools/qfprogs/include/disassemble.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef __disassemble_h -#define __disassemble_h - -struct progs_s; - -void disassemble_progs (struct progs_s *pr); - -#endif//__disassemble_h diff --git a/tools/qfprogs/include/globals.h b/tools/qfprogs/include/globals.h deleted file mode 100644 index c859a6969..000000000 --- a/tools/qfprogs/include/globals.h +++ /dev/null @@ -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 diff --git a/tools/qfprogs/include/lines.h b/tools/qfprogs/include/lines.h deleted file mode 100644 index 4bf71c99d..000000000 --- a/tools/qfprogs/include/lines.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef __lines_h -#define __lines_h - -struct progs_s; - -void dump_lines (struct progs_s *pr); - -#endif//__lines_h diff --git a/tools/qfprogs/include/modules.h b/tools/qfprogs/include/modules.h deleted file mode 100644 index 73c867189..000000000 --- a/tools/qfprogs/include/modules.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef __modules_h -#define __modules_h - -struct progs_s; - -void dump_modules (struct progs_s *pr); - -#endif//__modules_h diff --git a/tools/qfprogs/include/qfprogs.h b/tools/qfprogs/include/qfprogs.h deleted file mode 100644 index 15bf66fc7..000000000 --- a/tools/qfprogs/include/qfprogs.h +++ /dev/null @@ -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 diff --git a/tools/qfprogs/include/strings.h b/tools/qfprogs/include/strings.h deleted file mode 100644 index dd3ed97db..000000000 --- a/tools/qfprogs/include/strings.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef __strings_h -#define __strings_h - -struct progs_s; - -void dump_strings (struct progs_s *pr); - -#endif//__strings_h diff --git a/tools/qfprogs/source/.gitignore b/tools/qfprogs/source/.gitignore deleted file mode 100644 index 0a4e14382..000000000 --- a/tools/qfprogs/source/.gitignore +++ /dev/null @@ -1,6 +0,0 @@ -.deps -.libs -.vimrc -Makefile.in -Makefile -qfprogs diff --git a/tools/qfprogs/source/Makefile.am b/tools/qfprogs/source/Makefile.am deleted file mode 100644 index 6a3e64cd3..000000000 --- a/tools/qfprogs/source/Makefile.am +++ /dev/null @@ -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)