qtypes.h:

remove includes of qdefs.h and compat.h
pr_comp.h:
	merge pr_comp.h from quake and qfcc, removing the copy in qfcc
cmdlib.[ch]:
	nuke the endian code.
qendian.c:
	initialise the LittleLong etc pointers at compile time rather than run
	time
com.c (both nq and qw):
	nuke the LittleLong etc init code
everything else:
	fix up after the qtypes.h cleanup
This commit is contained in:
Bill Currie 2001-03-28 17:17:56 +00:00
parent 5a48f987a5
commit cb5c262ffc
65 changed files with 151 additions and 431 deletions

View file

@ -1,38 +1,31 @@
/* /* Copyright (C) 1996-1997 Id Software, Inc.
pr_comp.h
(description) 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.
Copyright (C) 1996-1997 Id Software, Inc. 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.
This program is free software; you can redistribute it and/or You should have received a copy of the GNU General Public License
modify it under the terms of the GNU General Public License along with this program; if not, write to the Free Software
as published by the Free Software Foundation; either version 2 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, See file, 'COPYING', for details.
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
$Id$
*/ */
// this file is shared by quake and qcc // this file is shared by QuakeForge and qfcc
#ifndef __pr_comp_h
#ifndef _PR_COMP_H #define __pr_comp_h
#define _PR_COMP_H
#include "QF/qtypes.h" #include "QF/qtypes.h"
typedef int func_t;
typedef int string_t;
typedef enum { typedef enum {
ev_void, ev_void,
ev_string, ev_string,
@ -44,6 +37,7 @@ typedef enum {
ev_pointer ev_pointer
} etype_t; } etype_t;
#define OFS_NULL 0 #define OFS_NULL 0
#define OFS_RETURN 1 #define OFS_RETURN 1
#define OFS_PARM0 4 // leave 3 ofs for each parm to hold vectors #define OFS_PARM0 4 // leave 3 ofs for each parm to hold vectors
@ -56,6 +50,7 @@ typedef enum {
#define OFS_PARM7 25 #define OFS_PARM7 25
#define RESERVED_OFS 28 #define RESERVED_OFS 28
enum { enum {
OP_DONE, OP_DONE,
OP_MUL_F, OP_MUL_F,
@ -134,6 +129,7 @@ enum {
OP_BITOR OP_BITOR
}; };
typedef struct statement_s typedef struct statement_s
{ {
unsigned short op; unsigned short op;
@ -167,8 +163,8 @@ typedef struct
byte parm_size[MAX_PARMS]; byte parm_size[MAX_PARMS];
} dfunction_t; } dfunction_t;
#define PROG_VERSION 6
#define PROG_VERSION 6
typedef struct typedef struct
{ {
int version; int version;
@ -195,4 +191,4 @@ typedef struct
int entityfields; int entityfields;
} dprograms_t; } dprograms_t;
#endif // _PR_COMP_H #endif // __pr_comp_h

View file

@ -34,8 +34,8 @@
#include <stdio.h> #include <stdio.h>
#include <sys/types.h> #include <sys/types.h>
#include "QF/qdefs.h" //#include "QF/qdefs.h"
#include "QF/compat.h" //#include "QF/compat.h"
#define MAX_QPATH 64 #define MAX_QPATH 64
@ -44,10 +44,13 @@
typedef unsigned char byte; typedef unsigned char byte;
#endif #endif
#ifndef _DEF_BOOL_
# define _DEF_BOOL_
// KJB Undefined true and false defined in SciTech's DEBUG.H header // KJB Undefined true and false defined in SciTech's DEBUG.H header
#undef true #undef true
#undef false #undef false
typedef enum {false, true} qboolean; typedef enum {false, true} qboolean;
#endif
// From mathlib... // From mathlib...
typedef float vec_t; typedef float vec_t;
@ -58,8 +61,6 @@ typedef int fixed8_t;
typedef int fixed16_t; typedef int fixed16_t;
typedef int func_t;
typedef int string_t;
typedef byte pixel_t; typedef byte pixel_t;
#endif // __qtypes_h #endif // __qtypes_h

View file

@ -35,6 +35,7 @@
#ifdef HAVE_STRINGS_H #ifdef HAVE_STRINGS_H
# include <strings.h> # include <strings.h>
#endif #endif
#include <stdarg.h>
#include "QF/cmd.h" #include "QF/cmd.h"
#include "QF/console.h" #include "QF/console.h"

View file

@ -40,6 +40,7 @@
#include "QF/cvar.h" #include "QF/cvar.h"
#include "QF/cmd.h" #include "QF/cmd.h"
#include "QF/compat.h"
#include "QF/console.h" #include "QF/console.h"
#include "QF/hash.h" #include "QF/hash.h"
#include "QF/qargs.h" #include "QF/qargs.h"

View file

@ -42,6 +42,7 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include "QF/compat.h"
#include "QF/console.h" #include "QF/console.h"
#include "QF/cmd.h" #include "QF/cmd.h"
#include "QF/cvar.h" #include "QF/cvar.h"

View file

@ -39,6 +39,7 @@
#include <stdio.h> #include <stdio.h>
#include <ctype.h> #include <ctype.h>
#include "QF/compat.h"
#include "QF/console.h" #include "QF/console.h"
#include "QF/info.h" #include "QF/info.h"

View file

@ -34,19 +34,30 @@
#include <ctype.h> #include <ctype.h>
#include "QF/qendian.h"
#include "QF/qtypes.h" #include "QF/qtypes.h"
/* /*
BYTE ORDER FUNCTIONS BYTE ORDER FUNCTIONS
*/ */
qboolean bigendien; #ifndef WORDS_BIGENDIAN
short (*BigShort) (short l); qboolean bigendien = false;;
short (*LittleShort) (short l); short (*BigShort) (short l) = ShortSwap;
int (*BigLong) (int l); short (*LittleShort) (short l) = ShortNoSwap;
int (*LittleLong) (int l); int (*BigLong) (int l) = LongSwap;
float (*BigFloat) (float l); int (*LittleLong) (int l) = LongNoSwap;
float (*LittleFloat) (float l); float (*BigFloat) (float l) = FloatSwap;
float (*LittleFloat) (float l) = FloatNoSwap;
#else
qboolean bigendien = true;;
short (*BigShort) (short l) = ShortNoSwap;
short (*LittleShort) (short l) = ShortSwap;
int (*BigLong) (int l) = LongNoSwap;
int (*LittleLong) (int l) = LongSwap;
float (*BigFloat) (float l) = FloatNoSwap;
float (*LittleFloat) (float l) = FloatSwap;
#endif
short short
ShortSwap (short l) ShortSwap (short l)

View file

@ -30,7 +30,6 @@
# include "config.h" # include "config.h"
#endif #endif
#include "QF/qendian.h"
#include "QF/cvar.h" #include "QF/cvar.h"
#include "QF/quakefs.h" #include "QF/quakefs.h"
#include "QF/console.h" #include "QF/console.h"
@ -81,24 +80,6 @@ COM_Init
void void
COM_Init () COM_Init ()
{ {
#ifndef WORDS_BIGENDIAN
bigendien = false;
BigShort = ShortSwap;
LittleShort = ShortNoSwap;
BigLong = LongSwap;
LittleLong = LongNoSwap;
BigFloat = FloatSwap;
LittleFloat = FloatNoSwap;
#else
bigendien = true;
BigShort = ShortNoSwap;
LittleShort = ShortSwap;
BigLong = LongNoSwap;
LittleLong = LongSwap;
BigFloat = FloatNoSwap;
LittleFloat = FloatSwap;
#endif
registered = Cvar_Get ("registered", "0", CVAR_NONE, "None"); registered = Cvar_Get ("registered", "0", CVAR_NONE, "None");
cmdline = Cvar_Get ("cmdline", "0", CVAR_SERVERINFO, "None"); cmdline = Cvar_Get ("cmdline", "0", CVAR_SERVERINFO, "None");
Cmd_AddCommand ("path", COM_Path_f, "No Description"); Cmd_AddCommand ("path", COM_Path_f, "No Description");

View file

@ -33,6 +33,7 @@
#include <SDL.h> #include <SDL.h>
#include "client.h" #include "client.h"
#include "QF/compat.h"
#include "QF/console.h" #include "QF/console.h"
#include "QF/cvar.h" #include "QF/cvar.h"
#include "draw.h" #include "draw.h"

View file

@ -45,6 +45,7 @@
#include "client.h" #include "client.h"
#include "QF/cmd.h" #include "QF/cmd.h"
#include "QF/compat.h"
#include "QF/console.h" #include "QF/console.h"
#include "QF/cvar.h" #include "QF/cvar.h"
#include "host.h" #include "host.h"

View file

@ -57,6 +57,7 @@
#endif #endif
#include "client.h" #include "client.h"
#include "QF/compat.h"
#include "QF/console.h" #include "QF/console.h"
#include "context_x11.h" #include "context_x11.h"
#include "QF/cmd.h" #include "QF/cmd.h"

View file

@ -36,6 +36,7 @@
#include <fcntl.h> #include <fcntl.h>
#include <unistd.h> #include <unistd.h>
#include "QF/compat.h"
#include "QF/console.h" #include "QF/console.h"
#include "client.h" #include "client.h"
#include "QF/cvar.h" #include "QF/cvar.h"

View file

@ -62,6 +62,7 @@
#include <limits.h> #include <limits.h>
#include "QF/cmd.h" #include "QF/cmd.h"
#include "QF/compat.h"
#include "QF/console.h" #include "QF/console.h"
#include "QF/cvar.h" #include "QF/cvar.h"
#include "draw.h" #include "draw.h"

View file

@ -36,6 +36,7 @@
# include <strings.h> # include <strings.h>
#endif #endif
#include "QF/compat.h"
#include "QF/console.h" #include "QF/console.h"
#include "sound.h" #include "sound.h"

View file

@ -40,11 +40,12 @@
#include "QF/cmd.h" #include "QF/cmd.h"
#include "QF/console.h" #include "QF/console.h"
#include "host.h" #include "host.h"
#include "progdefs.h"
#include "server.h" #include "server.h"
#include "sv_progs.h" #include "sv_progs.h"
#include "world.h" #include "world.h"
#include "progdefs.h"
progs_t sv_pr_state; progs_t sv_pr_state;
sv_globals_t sv_globals; sv_globals_t sv_globals;
sv_funcs_t sv_funcs; sv_funcs_t sv_funcs;

View file

@ -30,8 +30,9 @@
#define _NET_H #define _NET_H
#include "QF/gcc_attr.h" #include "QF/gcc_attr.h"
#include "QF/sizebuf.h"
#include "QF/cvar.h" #include "QF/cvar.h"
#include "QF/qdefs.h"
#include "QF/sizebuf.h"
#define PORT_ANY -1 #define PORT_ANY -1

View file

@ -41,6 +41,7 @@
#ifdef HAVE_STRINGS_H #ifdef HAVE_STRINGS_H
# include <strings.h> # include <strings.h>
#endif #endif
#include <stdlib.h>
#include <errno.h> #include <errno.h>

View file

@ -41,6 +41,7 @@
#include "cl_main.h" #include "cl_main.h"
#include "cl_pred.h" #include "cl_pred.h"
#include "cl_tent.h" #include "cl_tent.h"
#include "QF/compat.h"
#include "QF/console.h" #include "QF/console.h"
#include "d_iface.h" #include "d_iface.h"
#include "host.h" #include "host.h"

View file

@ -72,6 +72,7 @@
#include "cl_tent.h" #include "cl_tent.h"
#include "client.h" #include "client.h"
#include "QF/cmd.h" #include "QF/cmd.h"
#include "QF/compat.h"
#include "QF/console.h" #include "QF/console.h"
#include "QF/cvar.h" #include "QF/cvar.h"
#include "draw.h" #include "draw.h"

View file

@ -52,6 +52,7 @@
#include "cl_tent.h" #include "cl_tent.h"
#include "client.h" #include "client.h"
#include "QF/cmd.h" #include "QF/cmd.h"
#include "QF/compat.h"
#include "QF/console.h" #include "QF/console.h"
#include "host.h" #include "host.h"
#include "QF/msg.h" #include "QF/msg.h"

View file

@ -44,6 +44,7 @@
#ifdef HAVE_UNISTD_H #ifdef HAVE_UNISTD_H
# include <unistd.h> # include <unistd.h>
#endif #endif
#include <stdlib.h>
#include "bothdefs.h" #include "bothdefs.h"
#include "cl_slist.h" #include "cl_slist.h"

View file

@ -35,7 +35,6 @@
#include "QF/cmd.h" #include "QF/cmd.h"
#include "QF/console.h" #include "QF/console.h"
#include "QF/cvar.h" #include "QF/cvar.h"
#include "QF/qendian.h"
#include "QF/quakefs.h" #include "QF/quakefs.h"
#include "QF/sys.h" #include "QF/sys.h"
@ -86,24 +85,6 @@ COM_CheckRegistered (void)
void void
COM_Init (void) COM_Init (void)
{ {
#ifndef WORDS_BIGENDIAN
bigendien = false;
BigShort = ShortSwap;
LittleShort = ShortNoSwap;
BigLong = LongSwap;
LittleLong = LongNoSwap;
BigFloat = FloatSwap;
LittleFloat = FloatNoSwap;
#else
bigendien = true;
BigShort = ShortNoSwap;
LittleShort = ShortSwap;
BigLong = LongNoSwap;
LittleLong = LongSwap;
BigFloat = FloatNoSwap;
LittleFloat = FloatSwap;
#endif
Cmd_AddCommand ("path", COM_Path_f, "Show what paths Quake is using"); Cmd_AddCommand ("path", COM_Path_f, "Show what paths Quake is using");
COM_Filesystem_Init (); COM_Filesystem_Init ();

View file

@ -30,6 +30,7 @@
# include "config.h" # include "config.h"
#endif #endif
#include "QF/compat.h"
#include "bothdefs.h" #include "bothdefs.h"
#include "d_local.h" #include "d_local.h"

View file

@ -39,6 +39,7 @@
#include <stdlib.h> #include <stdlib.h>
#include "QF/cmd.h" #include "QF/cmd.h"
#include "QF/compat.h"
#include "QF/console.h" #include "QF/console.h"
#include "glquake.h" #include "glquake.h"
#include "host.h" #include "host.h"

View file

@ -45,6 +45,7 @@
#include "cl_main.h" #include "cl_main.h"
#include "cl_parse.h" //FIXME CL_NewTranslation #include "cl_parse.h" //FIXME CL_NewTranslation
#include "commdef.h" #include "commdef.h"
#include "QF/compat.h"
#include "QF/console.h" #include "QF/console.h"
#include "locs.h" #include "locs.h"
#include "glquake.h" #include "glquake.h"

View file

@ -41,6 +41,7 @@
#include <stdio.h> #include <stdio.h>
#include "glquake.h" #include "glquake.h"
#include "QF/compat.h"
#include "QF/sys.h" #include "QF/sys.h"
qboolean r_cache_thrash; qboolean r_cache_thrash;

View file

@ -40,6 +40,7 @@
#include "cl_parse.h" #include "cl_parse.h"
#include "QF/cmd.h" #include "QF/cmd.h"
#include "QF/compat.h"
#include "QF/console.h" #include "QF/console.h"
#include "draw.h" #include "draw.h"
#include "glquake.h" #include "glquake.h"

View file

@ -34,6 +34,7 @@
#include "host.h" #include "host.h"
#include "protocol.h" #include "protocol.h"
#include "skin.h" #include "skin.h"
#include "QF/compat.h"
#include "QF/sys.h" #include "QF/sys.h"
#include "texture.h" #include "texture.h"

View file

@ -40,6 +40,7 @@
#include <stdio.h> #include <stdio.h>
#include "QF/cmd.h" #include "QF/cmd.h"
#include "QF/compat.h"
#include "QF/console.h" #include "QF/console.h"
#include "QF/crc.h" #include "QF/crc.h"
#include "draw.h" #include "draw.h"

View file

@ -41,6 +41,7 @@
#include "bothdefs.h" #include "bothdefs.h"
#include "glquake.h" #include "glquake.h"
#include "view.h" #include "view.h"
#include "QF/compat.h"
extern byte *host_basepal; extern byte *host_basepal;

View file

@ -34,6 +34,7 @@
#include "client.h" #include "client.h"
#include "cl_input.h" #include "cl_input.h"
#include "cl_main.h" #include "cl_main.h"
#include "QF/compat.h"
#include "QF/console.h" #include "QF/console.h"
#include "QF/cvar.h" #include "QF/cvar.h"
#include "draw.h" #include "draw.h"

View file

@ -45,6 +45,7 @@
#include "cl_input.h" #include "cl_input.h"
#include "client.h" #include "client.h"
#include "QF/cmd.h" #include "QF/cmd.h"
#include "QF/compat.h"
#include "QF/console.h" #include "QF/console.h"
#include "QF/cvar.h" #include "QF/cvar.h"
#include "host.h" #include "host.h"

View file

@ -57,6 +57,7 @@
#include "cl_input.h" #include "cl_input.h"
#include "client.h" #include "client.h"
#include "QF/compat.h"
#include "QF/console.h" #include "QF/console.h"
#include "context_x11.h" #include "context_x11.h"
#include "QF/cmd.h" #include "QF/cmd.h"

View file

@ -35,6 +35,7 @@
#include <fcntl.h> #include <fcntl.h>
#include <unistd.h> #include <unistd.h>
#include "QF/compat.h"
#include "QF/console.h" #include "QF/console.h"
#include "client.h" #include "client.h"
#include "QF/cvar.h" #include "QF/cvar.h"

View file

@ -36,6 +36,7 @@
# include <strings.h> # include <strings.h>
#endif #endif
#include "QF/compat.h"
#include "QF/console.h" #include "QF/console.h"
#include "model.h" #include "model.h"
#include "pmove.h" #include "pmove.h"

View file

@ -63,6 +63,7 @@
#include "QF/cmd.h" #include "QF/cmd.h"
#include "commdef.h" #include "commdef.h"
#include "QF/compat.h"
#include "QF/console.h" #include "QF/console.h"
#include "QF/cvar.h" #include "QF/cvar.h"
#include "draw.h" #include "draw.h"

View file

@ -30,6 +30,7 @@
# include "config.h" # include "config.h"
#endif #endif
#include "QF/compat.h"
#include "QF/console.h" #include "QF/console.h"
#include "QF/cmd.h" #include "QF/cmd.h"
#include "cl_parse.h" #include "cl_parse.h"

View file

@ -32,6 +32,7 @@
#include <stdlib.h> #include <stdlib.h>
#include "QF/compat.h"
#include "QF/console.h" #include "QF/console.h"
#include "host.h" #include "host.h"
#include "QF/qargs.h" #include "QF/qargs.h"

View file

@ -36,6 +36,7 @@
#include "bothdefs.h" #include "bothdefs.h"
#include "client.h" #include "client.h"
#include "QF/cmd.h" #include "QF/cmd.h"
#include "QF/compat.h"
#include "QF/cvar.h" #include "QF/cvar.h"
#include "host.h" #include "host.h"
#include "QF/msg.h" #include "QF/msg.h"

View file

@ -42,6 +42,7 @@
#include "cl_cam.h" #include "cl_cam.h"
#include "client.h" #include "client.h"
#include "QF/cmd.h" #include "QF/cmd.h"
#include "QF/compat.h"
#include "commdef.h" #include "commdef.h"
#include "draw.h" #include "draw.h"
#include "QF/msg.h" #include "QF/msg.h"

View file

@ -41,6 +41,7 @@
#include "cl_parse.h" #include "cl_parse.h"
#include "client.h" #include "client.h"
#include "QF/cmd.h" #include "QF/cmd.h"
#include "QF/compat.h"
#include "QF/console.h" #include "QF/console.h"
#include "d_iface.h" #include "d_iface.h"
#include "draw.h" #include "draw.h"

View file

@ -38,6 +38,7 @@
#include "cl_parse.h" #include "cl_parse.h"
#include "client.h" #include "client.h"
#include "QF/compat.h"
#include "QF/console.h" #include "QF/console.h"
#include "QF/cmd.h" #include "QF/cmd.h"
#include "host.h" #include "host.h"

View file

@ -36,6 +36,7 @@
# include <strings.h> # include <strings.h>
#endif #endif
#include "QF/compat.h"
#include "QF/console.h" #include "QF/console.h"
#include "sound.h" #include "sound.h"

View file

@ -40,6 +40,7 @@
#include "bothdefs.h" #include "bothdefs.h"
#include "QF/cmd.h" #include "QF/cmd.h"
#include "QF/compat.h"
#include "QF/msg.h" #include "QF/msg.h"
#include "QF/qargs.h" #include "QF/qargs.h"
#include "QF/qendian.h" #include "QF/qendian.h"

View file

@ -36,6 +36,7 @@
# include <strings.h> # include <strings.h>
#endif #endif
#include "QF/compat.h"
#include "QF/msg.h" #include "QF/msg.h"
#include "msg_ucmd.h" #include "msg_ucmd.h"
#include "server.h" #include "server.h"

View file

@ -42,6 +42,7 @@
#include "bothdefs.h" #include "bothdefs.h"
#include "buildnum.h" #include "buildnum.h"
#include "QF/cmd.h" #include "QF/cmd.h"
#include "QF/compat.h"
#include "model.h" #include "model.h"
#include "net.h" #include "net.h"
#include "QF/msg.h" #include "QF/msg.h"

View file

@ -38,6 +38,7 @@
#endif #endif
#include "QF/cmd.h" #include "QF/cmd.h"
#include "QF/compat.h"
#include "server.h" #include "server.h"
#include "progdefs.h" #include "progdefs.h"
#include "sv_progs.h" #include "sv_progs.h"

View file

@ -44,6 +44,7 @@
#include "bothdefs.h" #include "bothdefs.h"
#include "QF/checksum.h" #include "QF/checksum.h"
#include "QF/cmd.h" #include "QF/cmd.h"
#include "QF/compat.h"
#include "QF/cvar.h" #include "QF/cvar.h"
#include "QF/msg.h" #include "QF/msg.h"
#include "msg_ucmd.h" #include "msg_ucmd.h"

View file

@ -40,6 +40,7 @@
#include "client.h" #include "client.h"
#include "host.h" #include "host.h"
#include "skin.h" #include "skin.h"
#include "QF/compat.h"
#include "QF/sys.h" #include "QF/sys.h"
#include "vid.h" #include "vid.h"

View file

@ -34,6 +34,7 @@
#include "host.h" #include "host.h"
#include "r_local.h" #include "r_local.h"
#include "view.h" #include "view.h"
#include "QF/compat.h"
extern cvar_t *cl_cshift_powerup; extern cvar_t *cl_cshift_powerup;

View file

@ -32,6 +32,7 @@
#endif #endif
#include <stdio.h> #include <stdio.h>
#include <stdarg.h>
#include <stdlib.h> #include <stdlib.h>
#include <errno.h> #include <errno.h>
#include <unistd.h> #include <unistd.h>

View file

@ -46,6 +46,7 @@
# include <X11/extensions/xf86dga.h> # include <X11/extensions/xf86dga.h>
#endif #endif
#include "QF/compat.h"
#include "QF/console.h" #include "QF/console.h"
#include "context_x11.h" #include "context_x11.h"
#include "glquake.h" #include "glquake.h"

View file

@ -35,6 +35,7 @@
#ifdef HAVE_STRINGS_H #ifdef HAVE_STRINGS_H
# include <strings.h> # include <strings.h>
#endif #endif
#include <stdlib.h>
#include <SDL.h> #include <SDL.h>

View file

@ -41,6 +41,7 @@
#include <SDL.h> #include <SDL.h>
#include "QF/compat.h"
#include "QF/console.h" #include "QF/console.h"
#include "glquake.h" #include "glquake.h"
#include "host.h" #include "host.h"

View file

@ -47,6 +47,7 @@
#include <vga.h> #include <vga.h>
#include "QF/cmd.h" #include "QF/cmd.h"
#include "QF/compat.h"
#include "QF/console.h" #include "QF/console.h"
#include "QF/cvar.h" #include "QF/cvar.h"
#include "d_local.h" #include "d_local.h"

View file

@ -67,6 +67,7 @@
#include "client.h" #include "client.h"
#include "QF/cmd.h" #include "QF/cmd.h"
#include "QF/compat.h"
#include "QF/console.h" #include "QF/console.h"
#include "context_x11.h" #include "context_x11.h"
#include "QF/cvar.h" #include "QF/cvar.h"

View file

@ -37,6 +37,13 @@ if test "$1" = gcc; then
fi fi
fi fi
dnl We want warnings, lots of warnings...
if test "x$GCC" = xyes; then
CFLAGS="$CFLAGS -Wall -Werror"
# CFLAGS="$CFLAGS -Wall -pedantic"
fi
dnl Checks for libraries. dnl Checks for libraries.
dnl Checks for header files. dnl Checks for header files.
@ -49,29 +56,32 @@ dnl Checks for library functions.
AC_ARG_WITH(qf-headers, AC_ARG_WITH(qf-headers,
[ --with-qf-headers=DIR use the QuakeForge headers found in DRI], [ --with-qf-headers=DIR use the QuakeForge headers found in DRI],
QF_HEADERS=$withval, QF_HEADERS=auto) QF_INCL=$withval, QF_INCL=auto)
AC_ARG_WITH(qf-libs, AC_ARG_WITH(qf-libs,
[ --with-qf-libs=DIR use the QuakeForge libs found in DRI], [ --with-qf-libs=DIR use the QuakeForge libs found in DRI],
QF_LIBS=$withval, QF_LIBS=auto) QF_LIBS=$withval, QF_LIBS=auto)
AC_MSG_CHECKING(for QF headers location) AC_MSG_CHECKING(for QF headers location)
if test "x$QF_HEADERS" = xauto; then if test "x$QF_INCL" = xauto; then
qf_dir=`cd ${srcdir}/../..; pwd` qf_dir=`cd ${srcdir}/../..; pwd`
if test -r ${qf_dir}/include/QF/qtypes.h; then if test -r ${qf_dir}/include/QF/qtypes.h; then
QF_HEADERS="-I ${qf_dir}/include" QF_INCL="-I${qf_dir}/include"
else else
QF_HEADERS='' QF_INCL=''
fi fi
else else
QF_HEADERS="-I ${QF_HEADERS}" QF_INCL="-I${QF_INCL}"
fi fi
AC_MSG_RESULT($QF_HEADERS) AC_MSG_RESULT($QF_INCL)
AC_SUBST(QF_INCL)
AC_MSG_CHECKING(for QF libs location) AC_MSG_CHECKING(for QF libs location)
QF_DEPS=""
if test "x$QF_LIBS" = xauto; then if test "x$QF_LIBS" = xauto; then
qf_dir=`cd ${srcdir}/../..; pwd` qf_dir=`cd ${srcdir}/../..; pwd`
if test -r ${qf_dir}/libs/util/qfplist.c; then if test -r ${qf_dir}/libs/util/qfplist.c; then
QF_LIBS="-L ${qf_dir}/libs/util" QF_LIBS="-L ${qf_dir}/libs/util"
QF_DEPS="${qf_dir}/libs/libqfutil.a"
else else
QF_LIBS='' QF_LIBS=''
fi fi
@ -79,6 +89,9 @@ else
QF_LIBS="-L ${QF_LIBS}" QF_LIBS="-L ${QF_LIBS}"
fi fi
AC_MSG_RESULT($QF_LIBS) AC_MSG_RESULT($QF_LIBS)
QF_LIBS="${QF_LIBS} -lqfutil"
AC_SUBST(QF_LIBS)
AC_SUBST(QF_DEPS)
AC_OUTPUT( AC_OUTPUT(
include/Makefile include/Makefile

View file

@ -30,12 +30,16 @@
#include <time.h> #include <time.h>
#include <stdarg.h> #include <stdarg.h>
#ifndef __BYTEBOOL__ #ifndef _DEF_BYTE_
#define __BYTEBOOL__ # define _DEF_BYTE_
typedef enum {false, true} qboolean;
typedef unsigned char byte; typedef unsigned char byte;
#endif #endif
#ifndef _DEF_BOOL_
# define _DEF_BOOL_
typedef enum {false, true} qboolean;
#endif
// the dec offsetof macro doesn't work very well... // the dec offsetof macro doesn't work very well...
#define myoffsetof(type,identifier) ((size_t)&((type *)0)->identifier) #define myoffsetof(type,identifier) ((size_t)&((type *)0)->identifier)
@ -57,13 +61,6 @@ void SafeWrite (FILE *f, void *buffer, int count);
int LoadFile (char *filename, void **bufferptr); int LoadFile (char *filename, void **bufferptr);
short BigShort (short l);
short LittleShort (short l);
int BigLong (int l);
int LittleLong (int l);
float BigFloat (float l);
float LittleFloat (float l);
char *COM_Parse (char *data); char *COM_Parse (char *data);
extern char com_token[1024]; extern char com_token[1024];

View file

@ -1,179 +0,0 @@
/* Copyright (C) 1996-1997 Id Software, Inc.
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 the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
See file, 'COPYING', for details.
*/
// this file is shared by QuakeForge and qfcc
typedef int func_t;
typedef int string_t;
typedef enum {ev_void, ev_string, ev_float, ev_vector, ev_entity, ev_field, ev_function, ev_pointer} etype_t;
#define OFS_NULL 0
#define OFS_RETURN 1
#define OFS_PARM0 4 // leave 3 ofs for each parm to hold vectors
#define OFS_PARM1 7
#define OFS_PARM2 10
#define OFS_PARM3 13
#define OFS_PARM4 16
#define OFS_PARM5 19
#define OFS_PARM6 22
#define OFS_PARM7 25
#define RESERVED_OFS 28
enum {
OP_DONE,
OP_MUL_F,
OP_MUL_V,
OP_MUL_FV,
OP_MUL_VF,
OP_DIV_F,
OP_ADD_F,
OP_ADD_V,
OP_SUB_F,
OP_SUB_V,
OP_EQ_F,
OP_EQ_V,
OP_EQ_S,
OP_EQ_E,
OP_EQ_FNC,
OP_NE_F,
OP_NE_V,
OP_NE_S,
OP_NE_E,
OP_NE_FNC,
OP_LE,
OP_GE,
OP_LT,
OP_GT,
OP_LOAD_F,
OP_LOAD_V,
OP_LOAD_S,
OP_LOAD_ENT,
OP_LOAD_FLD,
OP_LOAD_FNC,
OP_ADDRESS,
OP_STORE_F,
OP_STORE_V,
OP_STORE_S,
OP_STORE_ENT,
OP_STORE_FLD,
OP_STORE_FNC,
OP_STOREP_F,
OP_STOREP_V,
OP_STOREP_S,
OP_STOREP_ENT,
OP_STOREP_FLD,
OP_STOREP_FNC,
OP_RETURN,
OP_NOT_F,
OP_NOT_V,
OP_NOT_S,
OP_NOT_ENT,
OP_NOT_FNC,
OP_IF,
OP_IFNOT,
OP_CALL0,
OP_CALL1,
OP_CALL2,
OP_CALL3,
OP_CALL4,
OP_CALL5,
OP_CALL6,
OP_CALL7,
OP_CALL8,
OP_STATE,
OP_GOTO,
OP_AND,
OP_OR,
OP_BITAND,
OP_BITOR
};
typedef struct statement_s
{
unsigned short op;
short a,b,c;
} dstatement_t;
typedef struct
{
unsigned short type; // if DEF_SAVEGLOBGAL bit is set
// the variable needs to be saved in savegames
unsigned short ofs;
int s_name;
} ddef_t;
#define DEF_SAVEGLOBGAL (1<<15)
#define MAX_PARMS 8
typedef struct
{
int first_statement; // negative numbers are builtins
int parm_start;
int locals; // total ints of parms + locals
int profile; // runtime
int s_name;
int s_file; // source file defined in
int numparms;
byte parm_size[MAX_PARMS];
} dfunction_t;
#define PROG_VERSION 6
typedef struct
{
int version;
int crc; // check of header file
int ofs_statements;
int numstatements; // statement 0 is an error
int ofs_globaldefs;
int numglobaldefs;
int ofs_fielddefs;
int numfielddefs;
int ofs_functions;
int numfunctions; // function 0 is an empty
int ofs_strings;
int numstrings; // first string is a null string
int ofs_globals;
int numglobals;
int entityfields;
} dprograms_t;

View file

@ -22,7 +22,7 @@
#include <stdio.h> #include <stdio.h>
#include <setjmp.h> #include <setjmp.h>
#include "pr_comp.h" #include "QF/pr_comp.h"
/* /*

View file

@ -28,8 +28,10 @@
# #
AUTOMAKE_OPTIONS= foreign AUTOMAKE_OPTIONS= foreign
INCLUDES= -I$(top_srcdir)/include INCLUDES= -I$(top_srcdir)/include $(QF_INCL)
bin_PROGRAMS= qfcc bin_PROGRAMS= qfcc
qfcc_SOURCES= cmdlib.c pr_comp.c pr_lex.c qfcc.c qfcc_SOURCES= cmdlib.c pr_comp.c pr_lex.c qfcc.c
qfcc_LDADD= $(QF_LIBS)
qfcc_DEPENDENCIES= $(QF_DEPS)

View file

@ -289,143 +289,6 @@ LoadFile (char *filename, void **bufferptr)
return length; return length;
} }
/*
============================================================================
BYTE ORDER FUNCTIONS
============================================================================
*/
#ifdef WORDS_BIGENDIAN
short
LittleShort (short l)
{
byte b1, b2;
b1 = l & 255;
b2 = (l >> 8) & 255;
return (b1 << 8) + b2;
}
short
BigShort (short l)
{
return l;
}
int
LittleLong (int l)
{
byte b1, b2, b3, b4;
b1 = l & 255;
b2 = (l >> 8) & 255;
b3 = (l >> 16) & 255;
b4 = (l >> 24) & 255;
return ((int) b1 << 24) + ((int) b2 << 16) + ((int) b3 << 8) + b4;
}
int
BigLong (int l)
{
return l;
}
float
LittleFloat (float l)
{
union {
byte b[4];
float f;
} in, out;
in.f = l;
out.b[0] = in.b[3];
out.b[1] = in.b[2];
out.b[2] = in.b[1];
out.b[3] = in.b[0];
return out.f;
}
float
BigFloat (float l)
{
return l;
}
#else
short
BigShort (short l)
{
byte b1, b2;
b1 = l & 255;
b2 = (l >> 8) & 255;
return (b1 << 8) + b2;
}
short
LittleShort (short l)
{
return l;
}
int
BigLong (int l)
{
byte b1, b2, b3, b4;
b1 = l & 255;
b2 = (l >> 8) & 255;
b3 = (l >> 16) & 255;
b4 = (l >> 24) & 255;
return ((int) b1 << 24) + ((int) b2 << 16) + ((int) b3 << 8) + b4;
}
int
LittleLong (int l)
{
return l;
}
float
BigFloat (float l)
{
union {
byte b[4];
float f;
} in, out;
in.f = l;
out.b[0] = in.b[3];
out.b[1] = in.b[2];
out.b[2] = in.b[1];
out.b[3] = in.b[0];
return out.f;
}
float
LittleFloat (float l)
{
return l;
}
#endif
//======================================================= //=======================================================

View file

@ -349,7 +349,7 @@ PR_ParseFunctionCall (def_t *func)
t = func->type; t = func->type;
if (t->type != ev_function) if (t->type != ev_func)
PR_ParseError ("not a function"); PR_ParseError ("not a function");
// copy the arguments to the global parameter variables // copy the arguments to the global parameter variables
@ -440,7 +440,7 @@ PR_Term (void)
return PR_Statement (&pr_opcodes[OP_NOT_ENT], e, 0); return PR_Statement (&pr_opcodes[OP_NOT_ENT], e, 0);
case ev_vector: case ev_vector:
return PR_Statement (&pr_opcodes[OP_NOT_V], e, 0); return PR_Statement (&pr_opcodes[OP_NOT_V], e, 0);
case ev_function: case ev_func:
return PR_Statement (&pr_opcodes[OP_NOT_FNC], e, 0); return PR_Statement (&pr_opcodes[OP_NOT_FNC], e, 0);
default: default:
PR_ParseError ("Type mismatch for !"); PR_ParseError ("Type mismatch for !");
@ -839,7 +839,7 @@ PR_ParseDefs (void)
type = PR_ParseType (); type = PR_ParseType ();
if (pr_scope && (type->type == ev_field || type->type == ev_function)) if (pr_scope && (type->type == ev_field || type->type == ev_func))
PR_ParseError ("Fields and functions must be global"); PR_ParseError ("Fields and functions must be global");
do { do {
@ -852,7 +852,7 @@ PR_ParseDefs (void)
if (def->initialized) if (def->initialized)
PR_ParseError ("%s redeclared", name); PR_ParseError ("%s redeclared", name);
if (type->type == ev_function) { if (type->type == ev_func) {
locals_start = locals_end = numpr_globals; locals_start = locals_end = numpr_globals;
pr_scope = def; pr_scope = def;
f = PR_ParseImmediateStatements (type); f = PR_ParseImmediateStatements (type);

View file

@ -62,7 +62,7 @@ type_t type_vector = { ev_vector, &def_vector };
type_t type_entity = { ev_entity, &def_entity }; type_t type_entity = { ev_entity, &def_entity };
type_t type_field = { ev_field, &def_field }; type_t type_field = { ev_field, &def_field };
// type_function is a void() function used for state defs // type_function is a void() function used for state defs
type_t type_function = { ev_function, &def_function, NULL, &type_void }; type_t type_function = { ev_func, &def_function, NULL, &type_void };
type_t type_pointer = { ev_pointer, &def_pointer }; type_t type_pointer = { ev_pointer, &def_pointer };
type_t type_floatfield = { ev_field, &def_field, NULL, &type_float }; type_t type_floatfield = { ev_field, &def_field, NULL, &type_float };
@ -649,7 +649,7 @@ PR_ParseType (void)
// function type // function type
memset (&new, 0, sizeof (new)); memset (&new, 0, sizeof (new));
new.type = ev_function; new.type = ev_func;
new.aux_type = type; // return type new.aux_type = type; // return type
new.num_parms = 0; new.num_parms = 0;
if (!PR_Check (tt_punct, ")")) { if (!PR_Check (tt_punct, ")")) {

View file

@ -30,9 +30,11 @@
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
# include "config.h" # include "config.h"
#endif #endif
#include "QF/qendian.h"
#include "qfcc.h" #include "qfcc.h"
char sourcedir[1024]; char sourcedir[1024];
char destfile[1024]; char destfile[1024];
@ -204,7 +206,7 @@ WriteData (int crc)
int i; int i;
for (def = pr.def_head.next; def; def = def->next) { for (def = pr.def_head.next; def; def = def->next) {
if (def->type->type == ev_function) { if (def->type->type == ev_func) {
// df = &functions[numfunctions]; // df = &functions[numfunctions];
// numfunctions++; // numfunctions++;
} else if (def->type->type == ev_field) { } else if (def->type->type == ev_field) {
@ -220,9 +222,9 @@ WriteData (int crc)
dd->type = def->type->type; dd->type = def->type->type;
if (!def->initialized if (!def->initialized
&& def->type->type != ev_function && def->type->type != ev_func
&& def->type->type != ev_field && def->scope == NULL) && def->type->type != ev_field && def->scope == NULL)
dd->type |= DEF_SAVEGLOBGAL; dd->type |= DEF_SAVEGLOBAL;
dd->s_name = CopyString (def->name); dd->s_name = CopyString (def->name);
dd->ofs = def->ofs; dd->ofs = def->ofs;
} }
@ -392,7 +394,7 @@ PR_ValueString (etype_t type, void *val)
case ev_entity: case ev_entity:
sprintf (line, "entity %i", *(int *) val); sprintf (line, "entity %i", *(int *) val);
break; break;
case ev_function: case ev_func:
if (!(f = functions + *(int *) val)) if (!(f = functions + *(int *) val))
sprintf (line, "undefined function"); sprintf (line, "undefined function");
else else
@ -468,7 +470,7 @@ PR_GlobalString (gofs_t ofs)
if (!(def = pr_global_defs[ofs])) if (!(def = pr_global_defs[ofs]))
return PR_GlobalStringNoContents (ofs); return PR_GlobalStringNoContents (ofs);
if (def->initialized && def->type->type != ev_function) { if (def->initialized && def->type->type != ev_func) {
s = PR_ValueString (def->type->type, &pr_globals[ofs]); s = PR_ValueString (def->type->type, &pr_globals[ofs]);
sprintf (line, "%i(%s)", ofs, s); sprintf (line, "%i(%s)", ofs, s);
} else { } else {
@ -582,7 +584,7 @@ PR_FinishCompilation (void)
// check to make sure all functions prototyped have code // check to make sure all functions prototyped have code
for (d = pr.def_head.next; d; d = d->next) { for (d = pr.def_head.next; d; d = d->next) {
if (d->type->type == ev_function && !d->scope) { // function args ok if (d->type->type == ev_func && !d->scope) { // function args ok
// f = G_FUNCTION(d->ofs); // f = G_FUNCTION(d->ofs);
// if (!f || (!f->code && !f->builtin)) // if (!f || (!f->code && !f->builtin))
if (!d->initialized) { if (!d->initialized) {
@ -633,7 +635,7 @@ PR_WriteProgdefs (char *filename)
case ev_string: case ev_string:
fprintf (f, "\tstring_t\t%s;\n", d->name); fprintf (f, "\tstring_t\t%s;\n", d->name);
break; break;
case ev_function: case ev_func:
fprintf (f, "\tfunc_t\t%s;\n", d->name); fprintf (f, "\tfunc_t\t%s;\n", d->name);
break; break;
case ev_entity: case ev_entity:
@ -666,7 +668,7 @@ PR_WriteProgdefs (char *filename)
case ev_string: case ev_string:
fprintf (f, "\tstring_t\t%s;\n", d->name); fprintf (f, "\tstring_t\t%s;\n", d->name);
break; break;
case ev_function: case ev_func:
fprintf (f, "\tfunc_t\t%s;\n", d->name); fprintf (f, "\tfunc_t\t%s;\n", d->name);
break; break;
case ev_entity: case ev_entity:
@ -752,12 +754,12 @@ Options: \n\
-h, --help display this help and exit\n\ -h, --help display this help and exit\n\
-V, --version output version information and exit\n\ -V, --version output version information and exit\n\
"); ");
return; return 1;
} }
if (CheckParm ("-V") || CheckParm ("--version")) { if (CheckParm ("-V") || CheckParm ("--version")) {
printf ("%s version %s\n", PACKAGE, VERSION); printf ("%s version %s\n", PACKAGE, VERSION);
return; return 1;
} }
if ((p = CheckParm ("--source")) && p < argc - 1) { if ((p = CheckParm ("--source")) && p < argc - 1) {
@ -796,7 +798,7 @@ Options: \n\
LoadFile (filename, (void *) &src2); LoadFile (filename, (void *) &src2);
if (!PR_CompileFile (src2, filename)) if (!PR_CompileFile (src2, filename))
exit (1); return 1;
} }
if (!PR_FinishCompilation ()) if (!PR_FinishCompilation ())
@ -813,4 +815,5 @@ Options: \n\
stop = I_FloatTime (); stop = I_FloatTime ();
printf ("Compilation time: %i seconds.\n", (int) (stop - start)); printf ("Compilation time: %i seconds.\n", (int) (stop - start));
return 0;
} }