1 // this file is shared by the execution and compiler
3 /*i'm part way through making this work
4 I've given up now that I can't work out a way to load pointers.
5 Setting them should be fine.
11 /*this distinction is made as the execution uses c pointers while compiler uses pointers from the start of the string table of the current progs*/
13 typedef int QCC_string_t;
15 //typedef char *string_t;
18 //typedef enum {ev_void, ev_string, ev_float, ev_vector, ev_entity, ev_field, ev_function, ev_pointer, ev_integer, ev_struct, ev_union} etype_t;
19 // 0 1 2 3 4 5 6 7 8 9 10
23 #define OFS_PARM0 4 // leave 3 ofs for each parm to hold vectors
31 #define RESERVED_OFS 28
94 OP_CALL0, //careful... hexen2 and q1 have different calling conventions
95 OP_CALL1, //remap hexen2 calls to OP_CALL2H
112 //these following ones are Hexen 2 constants.
169 //mostly they are various different ways of adding two vars with conversions.
222 OP_POINTER_ADD, //32 bit pointers
232 OP_STORE_P, //152... erm.. wait...
261 //-------------------------------------
262 //string manipulation.
263 OP_ADD_SF, //(char*)c = (char*)a + (float)b
264 OP_SUB_S, //(float)c = (char*)a - (char*)b
265 OP_STOREP_C,//(float)c = *(char*)b = (float)a
266 OP_LOADP_C, //(float)c = *(char*) //170
267 //-------------------------------------
289 //erm... FTEQCC doesn't make use of these... These are for DP.
293 OP_GSTOREP_FLD, // integers
295 OP_GSTOREP_FNC, // pointers
306 //back to ones that we do use.
308 OP_PUSH, //push 4octets onto the local-stack (which is ALWAYS poped on function return). Returns a pointer.
309 OP_POP, //pop those ones that were pushed (don't over do it). Needs assembler.
320 These ops are emulated out, always, and are only present in the compiler.
358 typedef struct statement16_s
361 unsigned short a,b,c;
363 typedef struct statement32_s
369 typedef struct QCC_statement16_s
372 unsigned short a,b,c;
373 } QCC_dstatement16_t;
374 typedef struct QCC_statement32_s
378 } QCC_dstatement32_t;
379 #define QCC_dstatement_t QCC_dstatement32_t
382 //these should be the same except the string type
384 typedef struct ddef16_s
386 unsigned short type; // if DEF_SAVEGLOBAL bit is set
387 // the variable needs to be saved in savegames
392 typedef struct ddef32_s
394 unsigned int type; // if DEF_SAVEGLOBAL bit is set
395 // the variable needs to be saved in savegames
400 typedef struct fdef_s
402 unsigned int type; // if DEF_SAVEGLOBAL bit is set
403 // the variable needs to be saved in savegames
405 unsigned int progsofs; //used at loading time, so maching field offsets (unions/members) are positioned at the same runtime offset.
409 typedef void *ddefXX_t;
411 typedef struct QCC_ddef16_s
413 unsigned short type; // if DEF_SAVEGLOBAL bit is set
414 // the variable needs to be saved in savegames
419 typedef struct QCC_ddef32_s
421 unsigned int type; // if DEF_SAVEGLOBAL bit is set
422 // the variable needs to be saved in savegames
427 #define QCC_ddef_t QCC_ddef32_t
430 #define DEF_SAVEGLOBAL (1<<15)
431 #define DEF_SHARED (1<<14)
438 int first_statement; // negative numbers are builtins
440 int locals; // total ints of parms + locals
442 int profile; // runtime
445 string_t s_file; // source file defined in
448 qbyte parm_size[MAX_PARMS];
453 unsigned int first_statement; // negative numbers are builtins
454 unsigned int parm_start;
455 int locals; // total ints of parms + locals
457 int profile; // runtime
460 QCC_string_t s_file; // source file defined in
463 qbyte parm_size[MAX_PARMS];
468 #define PROG_VERSION 6
469 #define PROG_KKQWSVVERSION 7
470 #define PROG_EXTENDEDVERSION 7
471 #define PROG_SECONDARYVERSION16 (*(int*)"1FTE" ^ *(int*)"PROG") //something unlikly and still meaningful (to me)
472 #define PROG_SECONDARYVERSION32 (*(int*)"1FTE" ^ *(int*)"32B ") //something unlikly and still meaningful (to me)
476 int crc; // check of header file
478 unsigned int ofs_statements; //comp 1
479 unsigned int numstatements; // statement 0 is an error
481 unsigned int ofs_globaldefs; //comp 2
482 unsigned int numglobaldefs;
484 unsigned int ofs_fielddefs; //comp 4
485 unsigned int numfielddefs;
487 unsigned int ofs_functions; //comp 8
488 unsigned int numfunctions; // function 0 is an empty
490 unsigned int ofs_strings; //comp 16
491 unsigned int numstrings; // first string is a null string
493 unsigned int ofs_globals; //comp 32
494 unsigned int numglobals;
496 unsigned int entityfields;
498 //debug / version 7 extensions
499 unsigned int ofsfiles; //non list format. no comp
500 unsigned int ofslinenums; //numstatements big //comp 64
501 unsigned int ofsbodylessfuncs; //no comp
502 unsigned int numbodylessfuncs;
504 unsigned int ofs_types; //comp 128
505 unsigned int numtypes;
506 unsigned int blockscompressed;
508 int secondaryversion; //Constant - to say that any version 7 progs are actually ours, not someone else's alterations.
510 #define standard_dprograms_t_size ((int)&((dprograms_t*)NULL)->ofsfiles)
524 } includeddatafile_t;
529 typedef struct typeinfo_s
537 int ofs; //inside a structure.