2 Copyright (C) 1996-1997 Id Software, Inc.
4 This program is free software; you can redistribute it and/or
5 modify it under the terms of the GNU General Public License
6 as published by the Free Software Foundation; either version 2
7 of the License, or (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 See the GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 // this file is shared by quake and qcc
26 typedef unsigned int func_t;
29 typedef enum etype_e {ev_void, ev_string, ev_float, ev_vector, ev_entity, ev_field, ev_function, ev_pointer} etype_t;
34 #define OFS_PARM0 4 // leave 3 ofs for each parm to hold vectors
42 #define RESERVED_OFS 28
208 typedef struct statement16_s
214 typedef struct statement32_s
221 typedef struct ddef16_s
223 unsigned short type; // if DEF_SAVEGLOBGAL bit is set
224 // the variable needs to be saved in savegames
229 typedef struct ddef32_s
231 unsigned int type; // if DEF_SAVEGLOBGAL bit is set
232 // the variable needs to be saved in savegames
237 #define DEF_SAVEGLOBAL (1<<15)
241 typedef struct dfunction_s
243 int first_statement; // negative numbers are builtins
245 int locals; // total ints of parms + locals
247 int profile; // runtime
250 int s_file; // source file defined in
253 unsigned char parm_size[MAX_PARMS];
257 typedef struct mfunction_s
259 int first_statement; // negative numbers are builtins
261 int locals; // total ints of parms + locals
263 // these are doubles so that they can count up to 54bits or so rather than 32bit
264 double tprofile; // realtime in this function
265 double tbprofile; // realtime in builtins called by this function (NOTE: builtins also have a tprofile!)
266 double profile; // runtime
267 double builtinsprofile; // cost of builtin functions called by this function
268 double callcount; // times the functions has been called since the last profile call
269 double totaltime; // total execution time of this function DIRECTLY FROM THE ENGINE
270 double tprofile_total; // runtime (NOTE: tbprofile_total makes no real sense, so not accumulating that)
271 double profile_total; // runtime
272 double builtinsprofile_total; // cost of builtin functions called by this function
276 int s_file; // source file defined in
279 unsigned char parm_size[MAX_PARMS];
283 typedef struct mstatement_s
286 int operand[3]; // always a global or -1 for unused
287 int jumpabsolute; // only used by IF, IFNOT, GOTO
292 #define PROG_VERSION 6
293 typedef struct dprograms_s
296 int crc; // check of header file
298 unsigned int ofs_statements;
299 unsigned int numstatements; // statement 0 is an error
301 unsigned int ofs_globaldefs;
302 unsigned int numglobaldefs;
304 unsigned int ofs_fielddefs;
305 unsigned int numfielddefs;
307 unsigned int ofs_functions;
308 unsigned int numfunctions; // function 0 is an empty
310 unsigned int ofs_strings;
311 unsigned int numstrings; // first string is a null string
313 unsigned int ofs_globals;
314 unsigned int numglobals;
316 unsigned int entityfields;
320 typedef struct dprograms_v7_s
321 { //extended header written by fteqcc.
322 dprograms_t v6; //for easier casting.
324 //debug / version 7 extensions
325 unsigned int ofsfiles; //ignored. deprecated, should be 0. source files can instead be embedded by simply treating the .dat as a zip.
326 unsigned int ofslinenums; //ignored. alternative to external .lno files.
327 unsigned int ofsbodylessfuncs; //unsupported. function names imported from other modules. must be 0.
328 unsigned int numbodylessfuncs; //unsupported. must be 0.
330 unsigned int ofs_types; //unsupported+deprecated. rich type info. must be 0.
331 unsigned int numtypes; //unsupported+deprecated. rich type info. must be 0.
332 unsigned int blockscompressed; //unsupported. per-block compression. must be 0.
334 int secondaryversion; //if not known then its kkqwsv's v7, qfcc's v7, or uhexen2's v7, or something. abandon all hope when not recognised.
335 #define PROG_SECONDARYVERSION16 ((('1'<<0)|('F'<<8)|('T'<<16)|('E'<<24))^(('P'<<0)|('R'<<8)|('O'<<16)|('G'<<24))) //regular 16bit statements.
336 #define PROG_SECONDARYVERSION32 ((('1'<<0)|('F'<<8)|('T'<<16)|('E'<<24))^(('3'<<0)|('2'<<8)|('B'<<16)|(' '<<24))) //statements+globaldefs+fielddefs extended to 32bit.