2009-11-04 21:16:50 +00:00
|
|
|
#ifdef _WIN32
|
2011-10-27 16:16:29 +00:00
|
|
|
#ifndef _CRT_SECURE_NO_WARNINGS
|
2010-07-11 02:22:39 +00:00
|
|
|
#define _CRT_SECURE_NO_WARNINGS
|
2011-10-27 16:16:29 +00:00
|
|
|
#endif
|
2010-07-11 02:22:39 +00:00
|
|
|
#define _CRT_NONSTDC_NO_WARNINGS
|
2005-02-02 08:21:44 +00:00
|
|
|
#ifndef AVAIL_ZLIB
|
|
|
|
#ifdef _MSC_VER
|
|
|
|
//#define AVAIL_ZLIB
|
|
|
|
#endif
|
|
|
|
#endif
|
2004-09-07 18:16:59 +00:00
|
|
|
|
2005-02-02 08:21:44 +00:00
|
|
|
#include <windows.h>
|
2004-09-07 18:16:59 +00:00
|
|
|
|
2005-02-02 08:21:44 +00:00
|
|
|
enum{false, true};
|
2004-09-07 18:16:59 +00:00
|
|
|
#else
|
2005-02-02 08:21:44 +00:00
|
|
|
#include <stdarg.h>
|
|
|
|
#include <math.h>
|
2004-09-07 18:16:59 +00:00
|
|
|
|
2005-02-02 08:21:44 +00:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <setjmp.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <ctype.h>
|
2004-09-07 18:16:59 +00:00
|
|
|
|
2005-02-02 08:21:44 +00:00
|
|
|
#ifndef __declspec
|
|
|
|
#define __declspec(mode)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
typedef enum{false, true} boolean;
|
2004-09-07 18:16:59 +00:00
|
|
|
//#define _inline inline
|
|
|
|
#endif
|
|
|
|
typedef unsigned char qbyte;
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
#define DLL_PROG
|
|
|
|
#ifndef PROGSUSED
|
|
|
|
#define PROGSUSED
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "progtype.h"
|
|
|
|
#include "progslib.h"
|
|
|
|
|
2011-05-29 04:26:29 +00:00
|
|
|
#ifdef _MSC_VER
|
2010-11-02 23:17:25 +00:00
|
|
|
#pragma warning(disable : 4244)
|
|
|
|
#pragma warning(disable : 4267)
|
2011-05-29 04:26:29 +00:00
|
|
|
#endif
|
2010-11-02 23:17:25 +00:00
|
|
|
|
2004-09-07 18:16:59 +00:00
|
|
|
//extern progfuncs_t *progfuncs;
|
|
|
|
|
|
|
|
#define prinst progfuncs->prinst
|
|
|
|
#define externs progfuncs->parms
|
|
|
|
|
|
|
|
#include "pr_comp.h"
|
|
|
|
|
|
|
|
#include "qcd.h"
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
int targetflags; //weather we need to mark the progs as a newer version
|
|
|
|
char *name;
|
|
|
|
char *opname;
|
|
|
|
int priority;
|
|
|
|
enum {ASSOC_LEFT, ASSOC_RIGHT, ASSOC_RIGHT_RESULT} associative;
|
|
|
|
struct QCC_type_s **type_a, **type_b, **type_c;
|
|
|
|
} QCC_opcode_t;
|
|
|
|
extern QCC_opcode_t pr_opcodes[]; // sized by initialization
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef _MSC_VER
|
|
|
|
#define Q_vsnprintf _vsnprintf
|
|
|
|
#else
|
|
|
|
#define Q_vsnprintf vsnprintf
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#define sv_num_edicts (*externs->sv_num_edicts)
|
|
|
|
#define sv_edicts (*externs->sv_edicts)
|
|
|
|
|
|
|
|
#define printf externs->printf
|
|
|
|
#define Sys_Error externs->Sys_Error
|
|
|
|
#define Abort externs->Abort
|
|
|
|
|
|
|
|
#define memalloc externs->memalloc
|
|
|
|
#define memfree externs->memfree
|
|
|
|
|
|
|
|
int PRHunkMark(progfuncs_t *progfuncs);
|
|
|
|
void PRHunkFree(progfuncs_t *progfuncs, int mark);
|
|
|
|
void *PRHunkAlloc(progfuncs_t *progfuncs, int size);
|
2005-03-28 00:11:59 +00:00
|
|
|
void *PRAddressableAlloc(progfuncs_t *progfuncs, int ammount);
|
2004-09-07 18:16:59 +00:00
|
|
|
|
2009-11-04 21:16:50 +00:00
|
|
|
#ifdef printf
|
|
|
|
#undef LIKEPRINTF
|
|
|
|
#define LIKEPRINTF(x)
|
|
|
|
#endif
|
|
|
|
|
2004-09-07 18:16:59 +00:00
|
|
|
//void *HunkAlloc (int size);
|
2009-11-04 21:16:50 +00:00
|
|
|
char *VARGS qcva (char *text, ...) LIKEPRINTF(1);
|
2004-09-07 18:16:59 +00:00
|
|
|
void QC_InitShares(progfuncs_t *progfuncs);
|
|
|
|
void QC_StartShares(progfuncs_t *progfuncs);
|
|
|
|
void QC_AddSharedVar(progfuncs_t *progfuncs, int num, int type);
|
2005-05-15 18:49:04 +00:00
|
|
|
void QC_AddSharedFieldVar(progfuncs_t *progfuncs, int num, char *stringtable);
|
2010-07-18 08:42:59 +00:00
|
|
|
int QC_RegisterFieldVar(progfuncs_t *progfuncs, unsigned int type, char *name, signed long requestedpos, signed long originalofs);
|
2004-09-07 18:16:59 +00:00
|
|
|
pbool Decompile(progfuncs_t *progfuncs, char *fname);
|
|
|
|
int PR_ToggleBreakpoint(progfuncs_t *progfuncs, char *filename, int linenum, int flag);
|
2004-11-23 00:29:10 +00:00
|
|
|
void StripExtension (char *path);
|
2004-09-07 18:16:59 +00:00
|
|
|
|
|
|
|
|
2005-03-28 00:11:59 +00:00
|
|
|
#define edvars(ed) (((edictrun_t*)ed)->fields) //pointer to the field vars, given an edict
|
2004-09-07 18:16:59 +00:00
|
|
|
|
|
|
|
|
2005-10-07 16:27:20 +00:00
|
|
|
void SetEndian(void);
|
2005-05-22 13:42:10 +00:00
|
|
|
extern short (*PRBigShort) (short l);
|
|
|
|
extern short (*PRLittleShort) (short l);
|
2006-11-10 15:48:18 +00:00
|
|
|
extern int (*PRBigLong) (int l);
|
|
|
|
extern int (*PRLittleLong) (int l);
|
2005-05-22 13:42:10 +00:00
|
|
|
extern float (*PRBigFloat) (float l);
|
|
|
|
extern float (*PRLittleFloat) (float l);
|
2004-09-07 18:16:59 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
#ifndef COMPILER
|
|
|
|
typedef union eval_s
|
|
|
|
{
|
|
|
|
string_t string;
|
|
|
|
float _float;
|
|
|
|
float vector[3];
|
|
|
|
func_t function;
|
|
|
|
int _int;
|
|
|
|
int edict;
|
|
|
|
progsnum_t prog; //so it can easily be changed
|
|
|
|
} eval_t;
|
|
|
|
#endif
|
|
|
|
*/
|
|
|
|
|
|
|
|
typedef struct edictrun_s
|
|
|
|
{
|
|
|
|
pbool isfree;
|
2005-10-09 21:59:54 +00:00
|
|
|
|
|
|
|
float freetime; // realtime when the object was freed
|
2005-10-07 16:27:20 +00:00
|
|
|
unsigned int entnum;
|
2004-09-07 18:16:59 +00:00
|
|
|
pbool readonly; //causes error when QC tries writing to it. (quake's world entity)
|
2005-03-28 00:11:59 +00:00
|
|
|
void *fields;
|
2004-09-07 18:16:59 +00:00
|
|
|
|
|
|
|
// other fields from progs come immediately after
|
|
|
|
} edictrun_t;
|
|
|
|
|
|
|
|
|
|
|
|
int Comp_Begin(progfuncs_t *progfuncs, int nump, char **parms);
|
|
|
|
int Comp_Continue(progfuncs_t *progfuncs);
|
|
|
|
|
|
|
|
char *EvaluateDebugString(progfuncs_t *progfuncs, char *key);
|
|
|
|
char *SaveEnts(progfuncs_t *progfuncs, char *mem, int *size, int mode);
|
|
|
|
int LoadEnts(progfuncs_t *progfuncs, char *file, float killonspawnflags);
|
|
|
|
char *SaveEnt (progfuncs_t *progfuncs, char *buf, int *size, struct edict_s *ed);
|
|
|
|
struct edict_s *RestoreEnt (progfuncs_t *progfuncs, char *buf, int *size, struct edict_s *ed);
|
|
|
|
void PR_StackTrace (progfuncs_t *progfuncs);
|
|
|
|
|
|
|
|
extern int noextensions;
|
|
|
|
|
2011-03-04 13:59:06 +00:00
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
PST_DEFAULT, //16
|
|
|
|
PST_FTE32, //32
|
|
|
|
PST_KKQWSV, //24
|
|
|
|
PST_QTEST,
|
|
|
|
} progstructtype_t;
|
|
|
|
|
2004-09-07 18:16:59 +00:00
|
|
|
#ifndef COMPILER
|
|
|
|
typedef struct progstate_s
|
|
|
|
{
|
|
|
|
dprograms_t *progs;
|
|
|
|
dfunction_t *functions;
|
|
|
|
char *strings;
|
|
|
|
union {
|
|
|
|
ddefXX_t *globaldefs;
|
|
|
|
ddef16_t *globaldefs16;
|
|
|
|
ddef32_t *globaldefs32;
|
|
|
|
};
|
|
|
|
union {
|
|
|
|
ddefXX_t *fielddefs;
|
|
|
|
ddef16_t *fielddefs16;
|
|
|
|
ddef32_t *fielddefs32;
|
2005-10-09 21:59:54 +00:00
|
|
|
};
|
2004-09-07 18:16:59 +00:00
|
|
|
void *statements;
|
|
|
|
// void *global_struct;
|
|
|
|
float *globals; // same as pr_global_struct
|
|
|
|
|
|
|
|
typeinfo_t *types;
|
|
|
|
|
|
|
|
int edict_size; // in bytes
|
|
|
|
|
|
|
|
char filename[128];
|
|
|
|
|
|
|
|
builtin_t *builtins;
|
|
|
|
int numbuiltins;
|
|
|
|
|
|
|
|
int *linenums; //debug versions only
|
|
|
|
|
2011-03-04 13:59:06 +00:00
|
|
|
progstructtype_t structtype;
|
2011-07-30 14:14:56 +00:00
|
|
|
|
|
|
|
#ifdef QCJIT
|
|
|
|
struct jitstate *jit;
|
|
|
|
#endif
|
2004-09-07 18:16:59 +00:00
|
|
|
} progstate_t;
|
|
|
|
|
|
|
|
typedef struct extensionbuiltin_s {
|
|
|
|
char *name;
|
|
|
|
builtin_t func;
|
|
|
|
struct extensionbuiltin_s *prev;
|
|
|
|
} extensionbuiltin_t;
|
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
|
|
|
|
|
|
|
|
#define pr_progs current_progstate->progs
|
2005-10-09 21:59:54 +00:00
|
|
|
#define pr_functions current_progstate->functions
|
2004-09-07 18:16:59 +00:00
|
|
|
#define pr_strings current_progstate->strings
|
|
|
|
#define pr_globaldefs16 ((ddef16_t*)current_progstate->globaldefs)
|
|
|
|
#define pr_globaldefs32 ((ddef32_t*)current_progstate->globaldefs)
|
|
|
|
#define pr_fielddefs16 ((ddef16_t*)current_progstate->fielddefs)
|
|
|
|
#define pr_fielddefs32 ((ddef32_t*)current_progstate->fielddefs)
|
|
|
|
#define pr_statements16 ((dstatement16_t*)current_progstate->statements)
|
|
|
|
#define pr_statements32 ((dstatement32_t*)current_progstate->statements)
|
|
|
|
//#define pr_global_struct current_progstate->global_struct
|
|
|
|
#define pr_globals current_progstate->globals
|
|
|
|
#define pr_linenums current_progstate->linenums
|
|
|
|
#define pr_types current_progstate->types
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
|
|
|
|
void PR_Init (void);
|
|
|
|
|
|
|
|
void PR_ExecuteProgram (progfuncs_t *progfuncs, func_t fnum);
|
|
|
|
int PR_LoadProgs(progfuncs_t *progfncs, char *s, int headercrc, builtin_t *builtins, int numbuiltins);
|
|
|
|
int PR_ReallyLoadProgs (progfuncs_t *progfuncs, char *filename, int headercrc, progstate_t *progstate, pbool complain);
|
|
|
|
|
|
|
|
void *PRHunkAlloc(progfuncs_t *progfuncs, int ammount);
|
|
|
|
|
|
|
|
void PR_Profile_f (void);
|
|
|
|
|
|
|
|
struct edict_s *ED_Alloc (progfuncs_t *progfuncs);
|
|
|
|
void ED_Free (progfuncs_t *progfuncs, struct edict_s *ed);
|
|
|
|
|
2005-05-17 02:36:54 +00:00
|
|
|
char *ED_NewString (progfuncs_t *progfuncs, char *string, int minlength);
|
2004-09-07 18:16:59 +00:00
|
|
|
// returns a copy of the string allocated from the server's string heap
|
|
|
|
|
|
|
|
void ED_Print (progfuncs_t *progfuncs, struct edict_s *ed);
|
|
|
|
//void ED_Write (FILE *f, edictrun_t *ed);
|
|
|
|
char *ED_ParseEdict (progfuncs_t *progfuncs, char *data, edictrun_t *ent);
|
|
|
|
|
|
|
|
//void ED_WriteGlobals (FILE *f);
|
|
|
|
void ED_ParseGlobals (char *data);
|
|
|
|
|
|
|
|
//void ED_LoadFromFile (char *data);
|
|
|
|
|
|
|
|
//define EDICT_NUM(n) ((edict_t *)(sv.edicts+ (n)*pr_edict_size))
|
|
|
|
//define NUM_FOR_EDICT(e) (((byte *)(e) - sv.edicts)/pr_edict_size)
|
|
|
|
|
2005-10-07 16:27:20 +00:00
|
|
|
struct edict_s *EDICT_NUM(progfuncs_t *progfuncs, unsigned int n);
|
|
|
|
unsigned int NUM_FOR_EDICT(progfuncs_t *progfuncs, struct edict_s *e);
|
2004-09-07 18:16:59 +00:00
|
|
|
|
|
|
|
//#define NEXT_EDICT(e) ((edictrun_t *)( (byte *)e + pr_edict_size))
|
|
|
|
|
2005-03-28 00:11:59 +00:00
|
|
|
#define EDICT_TO_PROG(pf, e) (((edictrun_t*)e)->entnum)
|
|
|
|
#define PROG_TO_EDICT(pf, e) ((struct edictrun_s *)prinst->edicttable[e])
|
2004-09-07 18:16:59 +00:00
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
|
|
|
|
#define G_FLOAT(o) (pr_globals[o])
|
|
|
|
#define G_FLOAT2(o) (pr_globals[OFS_PARM0 + o*3])
|
|
|
|
#define G_INT(o) (*(int *)&pr_globals[o])
|
|
|
|
#define G_EDICT(o) ((edict_t *)((qbyte *)sv_edicts+ *(int *)&pr_globals[o]))
|
|
|
|
#define G_EDICTNUM(o) NUM_FOR_EDICT(G_EDICT(o))
|
|
|
|
#define G_VECTOR(o) (&pr_globals[o])
|
|
|
|
#define G_STRING(o) (*(string_t *)&pr_globals[o])
|
|
|
|
#define G_STRING2(o) ((char*)*(string_t *)&pr_globals[o])
|
|
|
|
#define GQ_STRING(o) (*(QCC_string_t *)&pr_globals[o])
|
|
|
|
#define GQ_STRING2(o) ((char*)*(QCC_string_t *)&pr_globals[o])
|
|
|
|
#define G_FUNCTION(o) (*(func_t *)&pr_globals[o])
|
2011-10-27 16:16:29 +00:00
|
|
|
#define G_PROG(o) G_FLOAT(o) //simply so it's nice and easy to change...
|
2004-09-07 18:16:59 +00:00
|
|
|
|
|
|
|
#define RETURN_EDICT(e) (((int *)pr_globals)[OFS_RETURN] = EDICT_TO_PROG(e))
|
|
|
|
|
|
|
|
#define E_FLOAT(e,o) (((float*)&e->v)[o])
|
|
|
|
#define E_INT(e,o) (*(int *)&((float*)&e->v)[o])
|
|
|
|
#define E_VECTOR(e,o) (&((float*)&e->v)[o])
|
|
|
|
#define E_STRING(e,o) (*(string_t *)&((float*)(e+1))[o])
|
|
|
|
|
2007-08-08 02:37:59 +00:00
|
|
|
const extern unsigned int type_size[];
|
2004-09-07 18:16:59 +00:00
|
|
|
|
|
|
|
|
|
|
|
extern unsigned short pr_crc;
|
|
|
|
|
2009-11-04 21:16:50 +00:00
|
|
|
void VARGS PR_RunError (progfuncs_t *progfuncs, char *error, ...) LIKEPRINTF(2);
|
2004-09-07 18:16:59 +00:00
|
|
|
|
|
|
|
void ED_PrintEdicts (progfuncs_t *progfuncs);
|
|
|
|
void ED_PrintNum (progfuncs_t *progfuncs, int ent);
|
|
|
|
|
|
|
|
|
|
|
|
pbool PR_SwitchProgs(progfuncs_t *progfuncs, progsnum_t type);
|
|
|
|
void PR_MoveParms(progfuncs_t *progfuncs, progsnum_t progs1, progsnum_t progs2);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
eval_t *GetEdictFieldValue(progfuncs_t *progfuncs, struct edict_s *ed, char *name, evalc_t *cache);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef COMPILER
|
|
|
|
|
|
|
|
//this is windows - all files are written with this endian standard
|
|
|
|
//optimisation
|
|
|
|
//leave undefined if in doubt over os.
|
2005-02-02 08:21:44 +00:00
|
|
|
#ifdef _WIN32
|
2004-09-07 18:16:59 +00:00
|
|
|
#define NOENDIAN
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
int varofs;
|
|
|
|
int size;
|
|
|
|
} sharedvar_t;
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
int s;
|
|
|
|
dfunction_t *f;
|
|
|
|
int progsnum;
|
2005-02-28 07:16:19 +00:00
|
|
|
int pushed;
|
2004-09-07 18:16:59 +00:00
|
|
|
} prstack_t;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//pr_multi.c
|
|
|
|
void PR_SetBuiltins(int type);
|
|
|
|
|
|
|
|
#define var(type, name) type name
|
|
|
|
#define vars(type, name, size) type name[size]
|
|
|
|
|
|
|
|
typedef struct prinst_s {
|
2007-03-11 16:51:45 +00:00
|
|
|
char **tempstrings;
|
|
|
|
int maxtempstrings;
|
|
|
|
int numtempstrings;
|
|
|
|
int numtempstringsstack;
|
|
|
|
|
|
|
|
char **allocedstrings;
|
|
|
|
int maxallocedstrings;
|
|
|
|
int numallocedstrings;
|
|
|
|
|
2011-10-27 16:16:29 +00:00
|
|
|
var(progstate_t *, progstate);
|
|
|
|
#define pr_progstate prinst->progstate
|
2004-09-07 18:16:59 +00:00
|
|
|
|
|
|
|
var(progsnum_t, pr_typecurrent);
|
|
|
|
#define pr_typecurrent prinst->pr_typecurrent
|
2005-10-07 16:27:20 +00:00
|
|
|
var(unsigned int, maxprogs);
|
2004-09-07 18:16:59 +00:00
|
|
|
#define maxprogs prinst->maxprogs
|
|
|
|
|
|
|
|
var(progstate_t *,current_progstate);
|
|
|
|
#define current_progstate prinst->current_progstate
|
|
|
|
|
|
|
|
var(unsigned int, numshares);
|
|
|
|
#define numshares prinst->numshares
|
|
|
|
var(sharedvar_t *,shares); //shared globals, not including parms
|
|
|
|
#define shares prinst->shares
|
|
|
|
var(unsigned int, maxshares);
|
|
|
|
#define maxshares prinst->maxshares
|
|
|
|
|
|
|
|
var(struct prmemb_s *, memblocks);
|
|
|
|
#define memb prinst->memblocks
|
|
|
|
|
|
|
|
var(unsigned int, maxfields);
|
|
|
|
#define maxfields prinst->maxfields
|
|
|
|
var(unsigned int, numfields);
|
|
|
|
#define numfields prinst->numfields
|
|
|
|
var(fdef_t*, field); //biggest size
|
|
|
|
#define field prinst->field
|
|
|
|
|
|
|
|
int reorganisefields;
|
|
|
|
|
|
|
|
|
|
|
|
//pr_exec.c
|
|
|
|
#define MAX_STACK_DEPTH 64
|
|
|
|
vars(prstack_t, pr_stack, MAX_STACK_DEPTH);
|
|
|
|
#define pr_stack prinst->pr_stack
|
|
|
|
var(int, pr_depth);
|
|
|
|
#define pr_depth prinst->pr_depth
|
2005-02-28 07:16:19 +00:00
|
|
|
var(int, spushed);
|
|
|
|
#define pr_spushed prinst->spushed
|
2004-09-07 18:16:59 +00:00
|
|
|
|
2004-12-08 04:14:52 +00:00
|
|
|
#define LOCALSTACK_SIZE 4096
|
2004-09-07 18:16:59 +00:00
|
|
|
vars(int, localstack, LOCALSTACK_SIZE);
|
|
|
|
#define localstack prinst->localstack
|
|
|
|
var(int, localstack_used);
|
|
|
|
#define localstack_used prinst->localstack_used
|
|
|
|
|
|
|
|
var(int, continuestatement);
|
|
|
|
var(int, exitdepth);
|
|
|
|
|
|
|
|
var(int, pr_trace);
|
|
|
|
#define pr_trace prinst->pr_trace
|
|
|
|
var(dfunction_t *, pr_xfunction);
|
|
|
|
#define pr_xfunction prinst->pr_xfunction
|
|
|
|
var(int, pr_xstatement);
|
|
|
|
#define pr_xstatement prinst->pr_xstatement
|
|
|
|
|
|
|
|
var(int, pr_argc);
|
|
|
|
#define pr_argc prinst->pr_argc
|
|
|
|
|
|
|
|
//pr_edict.c
|
|
|
|
|
2005-10-07 16:27:20 +00:00
|
|
|
var(unsigned int, maxedicts);
|
2004-09-07 18:16:59 +00:00
|
|
|
#define maxedicts prinst->maxedicts
|
|
|
|
|
|
|
|
var(evalc_t, spawnflagscache);
|
|
|
|
#define spawnflagscache prinst->spawnflagscache
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2007-08-08 02:37:59 +00:00
|
|
|
var(unsigned int, fields_size); // in bytes
|
2005-03-28 00:11:59 +00:00
|
|
|
#define fields_size prinst->fields_size
|
2007-08-08 02:37:59 +00:00
|
|
|
var(unsigned int, max_fields_size);
|
2005-03-28 00:11:59 +00:00
|
|
|
#define max_fields_size prinst->max_fields_size
|
2004-09-07 18:16:59 +00:00
|
|
|
|
|
|
|
|
|
|
|
//initlib.c
|
2005-03-28 00:11:59 +00:00
|
|
|
var(char *, addressablehunk);
|
|
|
|
#define addressablehunk prinst->addressablehunk
|
2008-10-05 02:55:01 +00:00
|
|
|
var(unsigned int, addressableused);
|
2005-03-28 00:11:59 +00:00
|
|
|
#define addressableused prinst->addressableused
|
2008-10-05 02:55:01 +00:00
|
|
|
var(unsigned int, addressablesize);
|
2005-03-28 00:11:59 +00:00
|
|
|
#define addressablesize prinst->addressablesize
|
2004-09-07 18:16:59 +00:00
|
|
|
|
|
|
|
|
2005-05-15 18:49:04 +00:00
|
|
|
//var(extensionbuiltin_t *, extensionbuiltin);
|
|
|
|
//#define extensionbuiltin prinst->extensionbuiltin
|
2004-09-07 18:16:59 +00:00
|
|
|
|
|
|
|
struct edict_s **edicttable;
|
|
|
|
} prinst_t;
|
|
|
|
extern vec3_t vec3_origin;
|
|
|
|
|
2011-05-20 04:10:46 +00:00
|
|
|
eval_t *PR_FindGlobal(progfuncs_t *prfuncs, char *globname, progsnum_t pnum, etype_t *type);
|
2004-09-07 18:16:59 +00:00
|
|
|
ddef16_t *ED_FindTypeGlobalFromProgs16 (progfuncs_t *progfuncs, char *name, progsnum_t prnum, int type);
|
|
|
|
ddef32_t *ED_FindTypeGlobalFromProgs32 (progfuncs_t *progfuncs, char *name, progsnum_t prnum, int type);
|
|
|
|
ddef16_t *ED_FindGlobalFromProgs16 (progfuncs_t *progfuncs, char *name, progsnum_t prnum);
|
|
|
|
ddef32_t *ED_FindGlobalFromProgs32 (progfuncs_t *progfuncs, char *name, progsnum_t prnum);
|
|
|
|
fdef_t *ED_FindField (progfuncs_t *progfuncs, char *name);
|
2008-01-23 01:31:01 +00:00
|
|
|
fdef_t *ED_FieldAtOfs (progfuncs_t *progfuncs, unsigned int ofs);
|
2005-10-09 21:59:54 +00:00
|
|
|
dfunction_t *ED_FindFunction (progfuncs_t *progfuncs, char *name, progsnum_t *pnum, progsnum_t fromprogs);
|
2004-09-07 18:16:59 +00:00
|
|
|
func_t PR_FindFunc(progfuncs_t *progfncs, char *funcname, progsnum_t pnum);
|
2005-03-28 00:11:59 +00:00
|
|
|
void PR_Configure (progfuncs_t *progfncs, int addressable_size, int max_progs);
|
2004-09-07 18:16:59 +00:00
|
|
|
int PR_InitEnts(progfuncs_t *progfncs, int maxents);
|
|
|
|
char *PR_ValueString (progfuncs_t *progfuncs, etype_t type, eval_t *val);
|
2009-11-04 21:16:50 +00:00
|
|
|
void QC_ClearEdict (progfuncs_t *progfuncs, struct edict_s *ed);
|
2005-10-07 16:27:20 +00:00
|
|
|
void PRAddressableFlush(progfuncs_t *progfuncs, int totalammount);
|
|
|
|
void QC_FlushProgsOffsets(progfuncs_t *progfuncs);
|
2004-09-07 18:16:59 +00:00
|
|
|
|
|
|
|
ddef16_t *ED_GlobalAtOfs16 (progfuncs_t *progfuncs, int ofs);
|
|
|
|
ddef16_t *ED_FindGlobal16 (progfuncs_t *progfuncs, char *name);
|
|
|
|
ddef32_t *ED_FindGlobal32 (progfuncs_t *progfuncs, char *name);
|
|
|
|
ddef32_t *ED_GlobalAtOfs32 (progfuncs_t *progfuncs, unsigned int ofs);
|
|
|
|
|
2007-03-11 16:51:45 +00:00
|
|
|
string_t PR_StringToProgs (progfuncs_t *inst, char *str);
|
2010-12-18 17:02:47 +00:00
|
|
|
char *ASMCALL PR_StringToNative (progfuncs_t *inst, string_t str);
|
2007-03-11 16:51:45 +00:00
|
|
|
|
|
|
|
void PR_FreeTemps (progfuncs_t *progfuncs, int depth);
|
|
|
|
|
2004-09-07 18:16:59 +00:00
|
|
|
char *PR_GlobalString (progfuncs_t *progfuncs, int ofs);
|
|
|
|
char *PR_GlobalStringNoContents (progfuncs_t *progfuncs, int ofs);
|
|
|
|
|
|
|
|
pbool CompileFile(progfuncs_t *progfuncs, char *filename);
|
|
|
|
|
2011-07-08 18:59:48 +00:00
|
|
|
struct jitstate;
|
|
|
|
struct jitstate *PR_GenerateJit(progfuncs_t *progfuncs);
|
|
|
|
void PR_EnterJIT(progfuncs_t *progfuncs, struct jitstate *jitstate, int statement);
|
2011-07-30 14:14:56 +00:00
|
|
|
void PR_CloseJit(struct jitstate *jit);
|
2009-11-04 21:16:50 +00:00
|
|
|
|
2004-09-07 18:16:59 +00:00
|
|
|
char *QCC_COM_Parse (char *data);
|
|
|
|
extern char qcc_token[1024];
|
|
|
|
#endif
|