spingle/source/progs.h

97 lines
2.3 KiB
C

/*
Copyright (C) 1996-2001 Id Software, Inc.
Copyright (C) 2002-2009 John Fitzgibbons and others
Copyright (C) 2010-2014 QuakeSpasm developers
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.
*/
#ifndef spingle__progs_h
#define spingle__progs_h
#include "pr_defs.h"
#include "pr_edict.h"
#include "pr_global.h"
#include "pr_ops.h"
enum
{
PROGHEADER_CRC = 5927,
PROG_VERSION = 6
};
typedef struct
{
int32_t version;
int32_t crc; // check of header file
int32_t ofs_statements;
int32_t numstatements; // statement 0 is an error
int32_t ofs_globaldefs;
int32_t numglobaldefs;
int32_t ofs_fielddefs;
int32_t numfielddefs;
int32_t ofs_functions;
int32_t numfunctions; // function 0 is an empty
int32_t ofs_strings;
int32_t numstrings; // first string is a null string
int32_t ofs_globals;
int32_t numglobals;
int32_t entityfields;
} dprograms_t;
extern dprograms_t progs;
extern char const *pr_strings;
extern char const **pr_knownstrings;
extern int32_t pr_maxknownstrings;
extern int32_t pr_numknownstrings;
extern builtin_t pr_builtins[];
extern int32_t pr_numbuiltins;
extern int32_t pr_argc;
extern bool pr_trace;
extern dfunction_t *pr_xfunction;
extern int32_t pr_xstatement;
extern uint16_t pr_crc;
extern bool pr_alpha_supported; //johnfitz
const char *PR_ValueString(int32_t type, eval_t *val);
const char *PR_UglyValueString(int32_t type, eval_t *val);
void PR_Init(void);
const char *PR_GetString(int32_t num);
int32_t PR_SetEngineString(const char *s);
int32_t PR_AllocString(int32_t bufferlength, char **ptr);
void PR_Profile_f(void);
noreturn void PR_RunError(const char *error, ...) FUNC_PRINTF(1, 2);
#endif