05 Oct 2007

This commit is contained in:
g-cont 2007-10-05 00:00:00 +04:00 committed by Alibek Omarov
parent 826e336f4d
commit 72a2aae795
18 changed files with 503 additions and 819 deletions

View File

@ -33,8 +33,12 @@ SV_ClipToLinks SV_ClipMoveToEntities
while(compileactive) PR_ContinueCompile();
PR_FinishCompilation();
}
progdefs.h должен содержать только кастомные поля, вместо текущих
убрать предупреждение про совпадение локальных и глобальных имен
костанта -999 вызывает немедленное падение компилятора при переводе в Int
}
studioframeadvance
studiorewindframe

View File

@ -2309,7 +2309,7 @@ int FS_CheckParm (const char *parm)
{
// NEXTSTEP sometimes clears appkit vars.
if (!fs_argv[i]) continue;
if (!strcmp (parm, fs_argv[i])) return i;
if (!stricmp (parm, fs_argv[i])) return i;
}
return 0;
}

View File

@ -75,6 +75,12 @@ bool opt_locals_marshalling; // make the local vars of all functions occupy the
bool opt_logicops; // don't make conditions enter functions if the return value will be discarded due to a previous value. (C style if statements)
bool opt_vectorcalls; // vectors can be packed into 3 floats, which can yield lower numpr_globals, but cost two more statements per call (only works for q1 calling conventions).
bool opt_simplifiedifs; // if (f != 0) -> if (f). if (f == 0) -> ifnot (f)
bool opt_writelinenums; // write debug info version 7 (line of numbers)
bool opt_writetypes; // write debug info version 7 (types)
bool opt_writesources; // write compressed sources into progs.dat for easy decompile and extended debug
bool opt_compstrings; // compress all strings into produced file
bool opt_compfunctions; // compress all functions and statements
bool opt_compress_other; // compress all parts of progs
bool simplestore;
file_t *asmfile;
@ -577,7 +583,7 @@ def_t *PR_SupplyConversion(def_t *var, etype_t wanted)
case ev_entity:
return PR_Statement(pr_opcodes+OP_LOAD_ENT, pev, var, NULL);
default:
Sys_Error("Inexplicit field load failed, try explicit");
PR_ParseError(ERR_INTERNAL, "Inexplicit field load failed, try explicit");
}
}
}
@ -618,13 +624,13 @@ gofs_t PR_GetFreeOffsetSpace(uint size)
}
ofs = numpr_globals;
numpr_globals+=size;
numpr_globals += size;
if (numpr_globals >= MAX_REGS)
{
if (!opt_overlaptemps || !opt_locals_marshalling)
Sys_Error("numpr_globals exceeded MAX_REGS - you'll need to use more optimisations");
else Sys_Error("numpr_globals exceeded MAX_REGS");
PR_ParseError(ERR_INTERNAL, "numpr_globals exceeded MAX_REGS - you'll need to use more optimisations");
else PR_ParseError(ERR_INTERNAL, "numpr_globals exceeded MAX_REGS");
}
return ofs;
@ -683,7 +689,7 @@ static def_t *PR_GetTemp(type_t *type)
break;
}
if (t && t->scope && t->scope != pr_scope)
Sys_Error("Internal error temp has scope not equal to current scope");
PR_ParseError(ERR_INTERNAL, "temp has scope not equal to current scope");
if (!t)
{
@ -1978,7 +1984,7 @@ def_t *PR_ParseFunctionCall (def_t *func)
e = PR_Statement(pr_opcodes+OP_LOAD_ENT, opev, e, NULL);
break;
default:
Sys_Error("Bad member type. Try forced expansion");
PR_ParseError(ERR_INTERNAL, "Bad member type. Try forced expansion");
}
}
@ -2295,7 +2301,7 @@ void PR_EmitFieldsForMembers(type_t *class)
f = PR_MemberInParentClass(mt->name, class->parentclass);
if(f)
{
if (m->arraysize > 1) Sys_Error("QCCLIB does not support overloaded arrays of members");
if (m->arraysize > 1) PR_ParseError(ERR_INTERNAL, "QCCLIB does not support overloaded arrays of members");
a = 0;
for (o = 0; o < m->type->size; o++)
{
@ -4997,9 +5003,9 @@ function_t *PR_ParseImmediateStatements (type_t *type)
if (i < MAX_PARMS)
{
f->parm_ofs[i] = defs[i]->ofs;
if (i > 0 && f->parm_ofs[i] < f->parm_ofs[i-1]) Sys_Error ("bad parm order");
if (i > 0 && f->parm_ofs[i] < f->parm_ofs[i-1]) PR_ParseError(ERR_INTERNAL, "bad parm order");
if (i > 0 && f->parm_ofs[i] != f->parm_ofs[i-1]+defs[i-1]->type->size)
Sys_Error ("parms not packed");
PR_ParseError(ERR_INTERNAL, "parms not packed");
}
parm = parm->next;
}
@ -5450,7 +5456,7 @@ def_t *PR_DummyDef(type_t *type, char *name, def_t *scope, int arraysize, uint o
def->scope = scope;
def->constant = true;
if (ofs + type->size*a >= MAX_REGS) Sys_Error("MAX_REGS is too small");
if (ofs + type->size*a >= MAX_REGS) PR_ParseError(ERR_INTERNAL, "MAX_REGS is too small");
def->ofs = ofs + type->size*a;
if (!first) first = def;
@ -5561,7 +5567,7 @@ def_t *PR_GetDef (type_t *type, char *name, def_t *scope, bool allocate, int arr
PR_ParseError (ERR_TYPEMISMATCHARRAYSIZE, "Array sizes for redecleration of %s do not match",name);
if (allocate && scope)
{
PR_ParseWarning (WARN_DUPLICATEDEFINITION, "%s duplicate definition ignored", name);
PR_ParseWarning (WARN_DUPLICATEDEFINITION, "%s duplicate, second definition ignored", name);
PR_ParsePrintDef(WARN_DUPLICATEDEFINITION, def);
}
return def;
@ -5592,7 +5598,7 @@ def_t *PR_GetDef (type_t *type, char *name, def_t *scope, bool allocate, int arr
continue; // in a different function
}
PR_ParseWarning (WARN_DUPLICATEDEFINITION, "%s duplicate definition ignored", name);
PR_ParseWarning (WARN_DUPLICATEDEFINITION, "%s duplicate, second definition ignored", name);
PR_ParsePrintDef(WARN_DUPLICATEDEFINITION, def);
}
return def;
@ -5617,7 +5623,7 @@ def_t *PR_GetDef (type_t *type, char *name, def_t *scope, bool allocate, int arr
PR_ParseError (ERR_TYPEMISMATCHARRAYSIZE, "Array sizes for redecleration of %s do not match",name);
if (allocate && scope)
{
PR_ParseWarning (WARN_DUPLICATEDEFINITION, "%s duplicate definition ignored", name);
PR_ParseWarning (WARN_DUPLICATEDEFINITION, "%s duplicate, second definition ignored", name);
PR_ParsePrintDef(WARN_DUPLICATEDEFINITION, def);
}
return def;
@ -5648,7 +5654,7 @@ def_t *PR_GetDef (type_t *type, char *name, def_t *scope, bool allocate, int arr
continue; // in a different function
}
PR_ParseWarning (WARN_DUPLICATEDEFINITION, "%s duplicate definition ignored", name);
PR_ParseWarning (WARN_DUPLICATEDEFINITION, "%s duplicate, second definition ignored", name);
PR_ParsePrintDef(WARN_DUPLICATEDEFINITION, def);
}
return def;
@ -6405,7 +6411,7 @@ void PR_ParseDefs (char *classname)
d->scope = NULL;
d->ofs = def->ofs+i;
if (d->ofs >= MAX_REGS) Sys_Error("MAX_REGS is too small");
if (d->ofs >= MAX_REGS) PR_ParseError(ERR_INTERNAL, "MAX_REGS is too small");
}
(((int *)pr_globals)[def->ofs+i]) = PR_CopyString(pr_immediate_string, opt_noduplicatestrings );
PR_Lex ();
@ -6616,6 +6622,55 @@ void PR_CompileFile (char *string, char *filename)
Mem_Copy(&pr_parse_abort, &abort_parse, sizeof(abort_parse));
}
/*
==============
PR_FinishCompilation
called after all files are compiled to check for errors
Returns false if errors were detected.
==============
*/
int PR_FinishCompilation( void )
{
def_t *d;
int errors = pr_total_error_count;
// check to make sure all functions prototyped have code
for (d = pr.def_head.next; d; d = d->next)
{
if (d->type->type == ev_function && !d->scope)// function parms are ok
{
if (d->initialized == 0)
{
if (!strncmp(d->name, "ArrayGet*", 9))
{
PR_EmitArrayGetFunction(d, d->name + 9);
pr_scope = NULL;
}
else if (!strncmp(d->name, "ArraySet*", 9))
{
PR_EmitArraySetFunction(d, d->name + 9);
pr_scope = NULL;
}
else if (!strncmp(d->name, "Class*", 6))
{
PR_EmitClassFromFunction(d, d->name + 6);
pr_scope = NULL;
}
else
{
PR_Warning(WARN_NOTDEFINED, strings + d->s_file, d->s_line, "function %s was not defined",d->name);
bodylessfuncs = true;
}
}
else if (d->initialized == 2) bodylessfuncs = true;
}
}
pr_scope = NULL;
return (errors == 0);
}
bool PR_Include(char *filename)
{
char *newfile;

View File

@ -96,7 +96,7 @@ bool PR_UnInclude(void)
type_t *PR_NewType (char *name, int basictype)
{
if (numtypeinfos>= maxtypeinfos) Sys_Error("Too many types");
if (numtypeinfos>= maxtypeinfos) PR_ParseError(ERR_INTERNAL, "Too many types");
memset(&qcc_typeinfo[numtypeinfos], 0, sizeof(type_t));
qcc_typeinfo[numtypeinfos].type = basictype;
qcc_typeinfo[numtypeinfos].name = name;
@ -395,7 +395,7 @@ bool PR_Precompiler(void)
if (!PR_SimpleGetToken())
{
if (!*pr_file_p)
Sys_Error("eof in includelist");
PR_ParseError(ERR_INTERNAL, "eof in includelist");
else
{
pr_file_p++;
@ -587,7 +587,7 @@ bool PR_Precompiler(void)
for (f = 0; compiler_flag[f].enabled; f++)
{
if (!stricmp(compiler_flag[f].abbrev, token))
if (!stricmp(compiler_flag[f].name, token))
{
if (compiler_flag[f].flags & FLAG_MIDCOMPILE)
*compiler_flag[f].enabled = st;
@ -735,7 +735,7 @@ void PR_LexString (void)
else if (c=='\"')
{
if (len >= sizeof(pr_immediate_string) - 1)
Sys_Error("String length exceeds %i", sizeof(pr_immediate_string)-1);
PR_ParseError(ERR_INTERNAL, "String length exceeds %i", sizeof(pr_immediate_string)-1);
while(*pr_file_p && *pr_file_p <= ' ')
{
@ -794,7 +794,7 @@ void PR_LexString (void)
{
PR_ParseWarning(WARN_MACROINSTRING, "Macro expansion in string");
if (len+strlen(cnst) >= sizeof(pr_token)-1)
Sys_Error("String length exceeds %i", sizeof(pr_token)-1);
PR_ParseError(ERR_INTERNAL, "String length exceeds %i", sizeof(pr_token)-1);
strcpy(pr_token+len, cnst);
len+=strlen(cnst);
pr_file_p = end;
@ -806,7 +806,7 @@ void PR_LexString (void)
pr_token[len] = c;
len++;
if (len >= sizeof(pr_token)-1)
Sys_Error("String length exceeds %i", sizeof(pr_token)-1);
PR_ParseError(ERR_INTERNAL, "String length exceeds %i", sizeof(pr_token)-1);
} while (1);
}
@ -1595,7 +1595,7 @@ int PR_CheakCompConst(void)
{
strcat(buffer, "#");
strcat(buffer, token);
PR_ParseWarning(0, "Stingification ignored");
PR_ParseWarning(0, "Stringification ignored");
}
continue;// already did this one
}
@ -1854,14 +1854,21 @@ void PR_ParseError (int errortype, char *error, ...)
va_list argptr;
char string[1024];
va_start (argptr,error);
_vsnprintf(string,sizeof(string)-1, error,argptr);
va_end (argptr);
va_start( argptr, error );
_vsnprintf(string, sizeof(string) - 1, error, argptr);
va_end( argptr );
PR_PrintScope();
PR_Message("%s:%i: error: %s\n", strings + s_file, pr_source_line, string);
longjmp (pr_parse_abort, 1);
if(errortype == ERR_INTERNAL)
{
// instead of sys error
std.error( "internal error: %s\n", string );
}
else
{
PR_PrintScope();
PR_Message("%s:%i: error: %s\n", strings + s_file, pr_source_line, string);
longjmp (pr_parse_abort, 1);
}
}
void PR_ParseErrorPrintDef (int errortype, def_t *def, char *error, ...)
@ -1870,14 +1877,13 @@ void PR_ParseErrorPrintDef (int errortype, def_t *def, char *error, ...)
char string[1024];
va_start (argptr,error);
_vsnprintf (string,sizeof(string)-1, error,argptr);
_vsnprintf (string, sizeof(string)-1, error, argptr);
va_end (argptr);
PR_PrintScope();
PR_Message ("%s:%i: error: %s\n", strings + s_file, pr_source_line, string);
PR_ParsePrintDef(WARN_ERROR, def);
longjmp (pr_parse_abort, 1);
}
@ -1898,7 +1904,13 @@ void PR_ParseWarning (int type, char *error, ...)
va_end (argptr);
PR_PrintScope();
if (type >= ERR_PARSEERRORS)
if(type == ERR_INTERNAL)
{
// instead of sys error
pr_total_error_count++;
std.error( "%s:%i: internal error C%i: %s\n", strings + s_file, pr_source_line, type, string );
}
else if (type > ERR_INTERNAL)
{
PR_Message("%s:%i: error C%i: %s\n", strings + s_file, pr_source_line, type, string);
pr_total_error_count++;
@ -2126,7 +2138,7 @@ type_t *PR_FindType (type_t *type)
return &qcc_typeinfo[t];
}
Sys_Error("Error with type");
PR_ParseError(ERR_INTERNAL, "Error with type");
return type;
}

View File

@ -5,9 +5,9 @@
#include "qcclib.h"
#define defaultkeyword (FLAG_HIDDENINGUI | FLAG_MIDCOMPILE | FLAG_ASDEFAULT)
#define nondefaultkeyword (FLAG_HIDDENINGUI | FLAG_MIDCOMPILE)
#define defaultoption (FLAG_MIDCOMPILE | FLAG_ASDEFAULT)
#define defaultkeyword (FLAG_MIDCOMPILE | FLAG_DEFAULT)
#define nondefaultkeyword (FLAG_MIDCOMPILE)
#define defaultoption (FLAG_MIDCOMPILE | FLAG_DEFAULT)
byte *qccpool;
char v_copyright[1024];
@ -71,76 +71,87 @@ int maxtypeinfos;
optimisations_t optimisations[] =
{
// level 0 = no optimisations
// level 1 = size optimisations
// level 2 = speed optimisations
// level 3 = dodgy optimisations.
// level 4 = experimental...
// level debug = include debug info
{&opt_writesources, "c", "write source", FL_DBG, FLAG_V7_ONLY },
{&opt_writelinenums, "a", "write linenums", FL_DBG, FLAG_V7_ONLY },
{&opt_writetypes, "b", "write types", FL_DBG, FLAG_V7_ONLY },
{&opt_assignments, "t", 1, FLAG_ASDEFAULT, "assignments", "c = a*b is performed in one operation rather than two, and can cause older decompilers to fail."},
{&opt_shortenifnots, "i", 1, FLAG_ASDEFAULT, "shortenifs", "if (!a) was traditionally compiled in two statements. This optimisation does it in one, but can cause some decompilers to get confused."},
{&opt_nonvec_parms, "p", 1, FLAG_ASDEFAULT, "nonvec_parms", "In the original qcc, function parameters were specified as a vector store even for floats. This fixes that."},
{&opt_constant_names, "c", 2, FLAG_KILLSDEBUGGERS, "constant_names", "This optimisation strips out the names of constants (but not strings) from your progs, resulting in smaller files. It makes decompilers leave out names or fabricate numerical ones."},
{&opt_constant_names_strings, "cs", 3, FLAG_KILLSDEBUGGERS, "constant_strings", "This optimisation strips out the names of string constants from your progs. However, this can break addons, so don't use it in those cases."},
{&opt_dupconstdefs, "d", 1, FLAG_ASDEFAULT, "dupconstdefs", "This will merge definitions of constants which are the same value. Pay extra attention to assignment to constant warnings."},
{&opt_noduplicatestrings, "s", 1, 0, "nodupstrings", "This will compact the string table that is stored in the progs. It will be considerably smaller with this."},
{&opt_locals, "l", 1, FLAG_KILLSDEBUGGERS, "locals", "Strips out local names and definitions. This makes it REALLY hard to decompile"},
{&opt_function_names, "n", 1, FLAG_KILLSDEBUGGERS, "function_names", "This strips out the names of functions which are never called. Doesn't make much of an impact though."},
{&opt_filenames, "f", 1, FLAG_KILLSDEBUGGERS, "filenames", "This strips out the filenames of the progs. This can confuse the really old decompilers, but is nothing to the more recent ones."},
{&opt_unreferenced, "u", 1, FLAG_ASDEFAULT, "unreferenced", "Removes the entries of unreferenced variables. Doesn't make a difference in well maintained code."},
{&opt_overlaptemps, "r", 1, FLAG_ASDEFAULT, "overlaptemps", "Optimises the pr_globals count by overlapping temporaries. In QC, every multiplication, division or operation in general produces a temporary variable. This optimisation prevents excess, and in the case of Hexen2's gamecode, reduces the count by 50k. This is the most important optimisation, ever."},
{&opt_constantarithmatic, "a", 1, FLAG_ASDEFAULT, "constarithmatic", "5*6 actually emits an operation into the progs. This prevents that happening, effectivly making the compiler see 30"},
{&opt_precache_file, "pf", 2, 0, "precache_file", "Strip out stuff wasted used in function calls and strings to the precache_file builtin (which is actually a stub in quake)."},
{&opt_return_only, "ro", 3, FLAG_KILLSDEBUGGERS, "return_only", "Functions ending in a return statement do not need a done statement at the end of the function. This can confuse some decompilers, making functions appear larger than they were."},
{&opt_compound_jumps, "cj", 3, FLAG_KILLSDEBUGGERS, "compound_jumps", "This optimisation plays an effect mostly with nested if/else statements, instead of jumping to an unconditional jump statement, it'll jump to the final destination instead. This will bewilder decompilers."},
{&opt_stripfunctions, "sf", 3, 0, "strip_functions", "Strips out the 'defs' of functions that were only ever called directly. This does not affect saved games."},
{&opt_locals_marshalling, "lm", 4, FLAG_KILLSDEBUGGERS, "locals_marshaling","Store all locals in one section of the pr_globals. Vastly reducing it. This effectivly does the job of overlaptemps. It's been noticed as buggy by a few, however, and the curcumstances where it causes problems are not yet known."},
{&opt_vectorcalls, "vc", 4, FLAG_KILLSDEBUGGERS, "vectorcalls", "Where a function is called with just a vector, this causes the function call to store three floats instead of one vector. This can save a good number of pr_globals where those vectors contain many duplicate coordinates but do not match entirly."},
{NULL}
// level 0 = fixed some qcc errors
{&opt_nonvec_parms, "g", "fix nonvec parms", FL_OP0, FLAG_DEFAULT },
// level 1 = size optimizations
{&opt_shortenifnots, "f", "shorten if(!a)", FL_OP1, FLAG_DEFAULT },
{&opt_assignments, "e", "assigments", FL_OP1, FLAG_DEFAULT },
{&opt_dupconstdefs, "j", "no dup constants", FL_OP1, FLAG_DEFAULT },
{&opt_noduplicatestrings, "k", "no dup strings", FL_OP1, 0, },
{&opt_locals, "l", "strip local names", FL_OP1, 0 },
{&opt_function_names, "m", "strip func names", FL_OP1, 0 },
{&opt_filenames, "n", "strip file names", FL_OP1, 0 },
{&opt_unreferenced, "o", "strip unreferenced", FL_OP1, FLAG_DEFAULT },
{&opt_overlaptemps, "p", "optimize overlaptemps", FL_OP1, FLAG_DEFAULT },
{&opt_constantarithmatic, "q", "precompute constnts", FL_OP1, FLAG_DEFAULT },
{&opt_compstrings, "x", "deflate prog strings", FL_OP1, FLAG_V7_ONLY },
// level 2 = speed optimizations
{&opt_constant_names, "h", "strip const names", FL_OP2, 0 },
{&opt_precache_file, "r", "strip precache files", FL_OP2, 0 },
{&opt_compfunctions, "y", "deflate prog funcs", FL_OP2, FLAG_V7_ONLY },
// level 3 = dodgy optimizations
{&opt_return_only, "s", "optimize return calls", FL_OP3, 0 },
{&opt_compound_jumps, "t", "optimize num of jumps", FL_OP3, 0 },
{&opt_stripfunctions, "u", "strip functions", FL_OP3, 0 },
{&opt_constant_names_strings, "i", "strip const strings", FL_OP3, 0 },
{&opt_compress_other, "z", "deflate all prog", FL_OP3, FLAG_V7_ONLY },
// level 4 = use with caution, may be bugly
{&opt_locals_marshalling, "y", "reduce locals, buggly", FL_OP4, FLAG_V7_ONLY },
{&opt_vectorcalls, "w", "optimize vector calls", FL_OP4, FLAG_V7_ONLY },
{NULL, "", "", 0, 0 },
};
compiler_flag_t compiler_flag[] =
{
// keywords
{&keyword_asm, defaultkeyword, "asm", "Keyword: asm", "Disables the 'asm' keyword. Use the writeasm flag to see an example of the asm."},
{&keyword_break, defaultkeyword, "break", "Keyword: break", "Disables the 'break' keyword."},
{&keyword_case, defaultkeyword, "case", "Keyword: case", "Disables the 'case' keyword."},
{&keyword_class, defaultkeyword, "class", "Keyword: class", "Disables the 'class' keyword."},
{&keyword_const, defaultkeyword, "const", "Keyword: const", "Disables the 'const' keyword."},
{&keyword_continue, defaultkeyword, "continue", "Keyword: continue", "Disables the 'continue' keyword."},
{&keyword_default, defaultkeyword, "default", "Keyword: default", "Disables the 'default' keyword."},
{&keyword_entity, defaultkeyword, "entity", "Keyword: entity", "Disables the 'entity' keyword."},
{&keyword_enum, defaultkeyword, "enum", "Keyword: enum", "Disables the 'enum' keyword."}, // kinda like in c, but typedef not supported.
{&keyword_enumflags,defaultkeyword, "enumflags", "Keyword: enumflags", "Disables the 'enumflags' keyword."}, // like enum, but doubles instead of adds 1.
{&keyword_extern, defaultkeyword, "extern", "Keyword: extern", "Disables the 'extern' keyword. Use only on functions inside addons."}, //function is external, don't error or warn if the body was not found
{&keyword_float, defaultkeyword, "float", "Keyword: float", "Disables the 'float' keyword. (Disables the float keyword without 'local' preceeding it)"},
{&keyword_for, defaultkeyword, "for", "Keyword: for", "Disables the 'for' keyword. Syntax: for(assignment; while; increment) {codeblock;}"},
{&keyword_goto, defaultkeyword, "goto", "Keyword: goto", "Disables the 'goto' keyword."},
{&keyword_int, defaultkeyword, "int", "Keyword: int", "Disables the 'int' keyword."},
{&keyword_integer, defaultkeyword, "integer", "Keyword: integer", "Disables the 'integer' keyword."},
{&keyword_noref, defaultkeyword, "noref", "Keyword: noref", "Disables the 'noref' keyword."}, // nowhere else references this, don't strip it.
{&keyword_nosave, defaultkeyword, "nosave", "Keyword: nosave", "Disables the 'nosave' keyword."}, // don't write the def to the output.
{&keyword_shared, defaultkeyword, "shared", "Keyword: shared", "Disables the 'shared' keyword."}, // mark global to be copied over when progs changes
{&keyword_state, nondefaultkeyword, "state", "Keyword: state", "Disables the 'state' keyword."},
{&keyword_string, defaultkeyword, "string", "Keyword: string", "Disables the 'string' keyword."},
{&keyword_struct, defaultkeyword, "struct", "Keyword: struct", "Disables the 'struct' keyword."},
{&keyword_switch, defaultkeyword, "switch", "Keyword: switch", "Disables the 'switch' keyword."},
{&keyword_typedef, defaultkeyword, "typedef", "Keyword: typedef", "Disables the 'typedef' keyword."}, // FIXME
{&keyword_union, defaultkeyword, "union", "Keyword: union", "Disables the 'union' keyword."}, // you surly know what a union is!
{&keyword_var, defaultkeyword, "var", "Keyword: var", "Disables the 'var' keyword."},
{&keyword_vector, defaultkeyword, "vector", "Keyword: vector", "Disables the 'vector' keyword."},
{&keyword_asm, defaultkeyword, "asm" },
{&keyword_break, defaultkeyword, "break" },
{&keyword_case, defaultkeyword, "case" },
{&keyword_class, defaultkeyword, "class" },
{&keyword_const, defaultkeyword, "const" },
{&keyword_continue, defaultkeyword, "continue" },
{&keyword_default, defaultkeyword, "default" },
{&keyword_entity, defaultkeyword, "entity" },
{&keyword_enum, defaultkeyword, "enum" }, // kinda like in c, but typedef not supported.
{&keyword_enumflags,defaultkeyword, "enumflags" }, // like enum, but doubles instead of adds 1.
{&keyword_extern, defaultkeyword, "extern" }, // function is external, don't error or warn if the body was not found
{&keyword_float, defaultkeyword, "float" },
{&keyword_for, defaultkeyword, "for" },
{&keyword_goto, defaultkeyword, "goto" },
{&keyword_int, defaultkeyword, "int" },
{&keyword_integer, defaultkeyword, "integer" },
{&keyword_noref, defaultkeyword, "noref" }, // nowhere else references this, don't strip it.
{&keyword_nosave, defaultkeyword, "nosave" }, // don't write the def to the output.
{&keyword_shared, defaultkeyword, "shared" }, // mark global to be copied over when progs changes
{&keyword_state, nondefaultkeyword, "state" },
{&keyword_string, defaultkeyword, "string" },
{&keyword_struct, defaultkeyword, "struct" },
{&keyword_switch, defaultkeyword, "switch" },
{&keyword_typedef, defaultkeyword, "typedef" }, // FIXME
{&keyword_union, defaultkeyword, "union" }, // you surly know what a union is!
{&keyword_var, defaultkeyword, "var" },
{&keyword_vector, defaultkeyword, "vector" },
// options
{&keywords_coexist, FLAG_ASDEFAULT, "kce", "Keywords Coexist", "If you want keywords to NOT be disabled when they a variable by the same name is defined, check here."},
{&output_parms, 0, "parms", "Define offset parms", "if PARM0 PARM1 etc should be defined by the compiler. These are useful if you make use of the asm keyword for function calls, or you wish to create your own variable arguments. This is an easy way to break decompilers."},//controls weather to define PARMx for the parms (note - this can screw over some decompilers)
{&autoprototype, 0, "autoproto", "Automatic Prototyping", "Causes compilation to take two passes instead of one. The first pass, only the definitions are read. The second pass actually compiles your code. This means you never have to remember to prototype functions again."}, //so you no longer need to prototype functions and things in advance.
{&writeasm, 0, "wasm", "Dump Assembler", "Writes out a qc.asm which contains all your functions but in assembler. This is a great way to look for bugs in qcclib, but can also be used to see exactly what your functions turn into, and thus how to optimise statements better."},//spit out a qc.asm file, containing an assembler dump of the ENTIRE progs. (Doesn't include initialisation of constants)
{&flag_ifstring, FLAG_MIDCOMPILE, "ifstring", "if(string) fix", "Causes if(string) to behave identically to if(string!="") This is most useful with addons of course, but also has adverse effects with FRIK_FILE's fgets, where it becomes impossible to determin the end of the file. In such a case, you can still use asm {IF string 2;RETURN} to detect eof and leave the function."},//correction for if(string) no-ifstring to get the standard behaviour.
{&flag_laxcasts, FLAG_MIDCOMPILE, "lax", "Lax type checks", "Disables many errors (generating warnings instead) when function calls or operations refer to two normally incompatable types. This is required for reacc support, and can also allow certain (evil) mods to compile that were originally written for frikqcc."}, //Allow lax casting. This'll produce loadsa warnings of course. But allows compilation of certain dodgy code.
{&flag_hashonly, FLAG_MIDCOMPILE, "hashonly", "Hash-only constants", "Allows use of only #constant for precompiler constants, allows certain preqcc using mods to compile"},
{&opt_logicops, FLAG_MIDCOMPILE, "lo", "Logic ops", "This changes the behaviour of your code. It generates additional if operations to early-out in if statements. With this flag, the line if (0 && somefunction()) will never call the function. It can thus be considered an optimisation. However, due to the change of behaviour, it is not considered so by qcclib. Note that due to inprecisions with floats, this flag can cause runaway loop errors within the player walk and run functions. This code is advised:\nplayer_stand1:\n if (self.velocity_x || self.velocity_y)\nplayer_run\n if (!(self.velocity_x || self.velocity_y))"},
{&flag_fastarrays, defaultoption, "fastarrays", "fast arrays where possible", "Generates extra instructions inside array handling functions to detect engine and use extension opcodes only in supporting engines.\nAdds a global which is set by the engine if the engine supports the extra opcodes. Note that this applies to all arrays or none."}, // correction for if(string) no-ifstring to get the standard behaviour.
{&keywords_coexist, FLAG_DEFAULT, "kce" },//"Keywords Coexist", "If you want keywords to NOT be disabled when they a variable by the same name is defined, check here."},
{&output_parms, 0, "parms" },//"Define offset parms", "if PARM0 PARM1 etc should be defined by the compiler. These are useful if you make use of the asm keyword for function calls, or you wish to create your own variable arguments. This is an easy way to break decompilers."},//controls weather to define PARMx for the parms (note - this can screw over some decompilers)
{&autoprototype, 0, "autoproto" },//"Automatic Prototyping", "Causes compilation to take two passes instead of one. The first pass, only the definitions are read. The second pass actually compiles your code. This means you never have to remember to prototype functions again."}, //so you no longer need to prototype functions and things in advance.
{&writeasm, 0, "wasm", },//"Dump Assembler", "Writes out a qc.asm which contains all your functions but in assembler. This is a great way to look for bugs in qcclib, but can also be used to see exactly what your functions turn into, and thus how to optimise statements better."},//spit out a qc.asm file, containing an assembler dump of the ENTIRE progs. (Doesn't include initialisation of constants)
{&flag_ifstring, FLAG_MIDCOMPILE, "ifstring" },//"if(string) fix", "Causes if(string) to behave identically to if(string!="") This is most useful with addons of course, but also has adverse effects with FRIK_FILE's fgets, where it becomes impossible to determin the end of the file. In such a case, you can still use asm {IF string 2;RETURN} to detect eof and leave the function."},//correction for if(string) no-ifstring to get the standard behaviour.
{&flag_laxcasts, FLAG_MIDCOMPILE, "lax" },//"Lax type checks", "Disables many errors (generating warnings instead) when function calls or operations refer to two normally incompatable types. This is required for reacc support, and can also allow certain (evil) mods to compile that were originally written for frikqcc."}, //Allow lax casting. This'll produce loadsa warnings of course. But allows compilation of certain dodgy code.
{&flag_hashonly, FLAG_MIDCOMPILE, "hashonly" },//"Hash-only constants", "Allows use of only #constant for precompiler constants, allows certain preqcc using mods to compile"},
{&opt_logicops, FLAG_MIDCOMPILE, "lo" },//"Logic ops", "This changes the behaviour of your code. It generates additional if operations to early-out in if statements. With this flag, the line if (0 && somefunction()) will never call the function. It can thus be considered an optimisation. However, due to the change of behaviour, it is not considered so by qcclib. Note that due to inprecisions with floats, this flag can cause runaway loop errors within the player walk and run functions. This code is advised:\nplayer_stand1:\n if (self.velocity_x || self.velocity_y)\nplayer_run\n if (!(self.velocity_x || self.velocity_y))"},
{&flag_fastarrays, defaultoption, "fastarrays" },//"fast arrays where possible", "Generates extra instructions inside array handling functions to detect engine and use extension opcodes only in supporting engines.\nAdds a global which is set by the engine if the engine supports the extra opcodes. Note that this applies to all arrays or none."}, // correction for if(string) no-ifstring to get the standard behaviour.
{NULL}
};
@ -156,65 +167,53 @@ target_t targets[] =
void PR_CommandLinePrecompilerOptions (void)
{
const_t *cnst;
int i, p;
char *name, *val;
const_t *cnst;
int level, i, j, p = 0;
char *name, *val;
for (i = 1;i<fs_argc;i++)
// default state
for (i = 0; optimisations[i].enabled; i++)
*optimisations[i].enabled = false;
for (i = 1; i < fs_argc; i++)
{
//compiler constant
if ( !strncmp(fs_argv[i], "-D", 2) )
// #define
if( !strnicmp(fs_argv[i], "/D", 2))
{
name = fs_argv[i] + 2;
name = fs_argv[i+1];
val = strchr(name, '=');
if (val)
{
*val = '\0';
val++;
}
if (val) { *val = '\0', val++; }
cnst = PR_DefineName(name);
if (val)
{
if (strlen(val)+1 >= sizeof(cnst->value))
Sys_Error("Compiler constant value is too long\n");
if(strlen(val) + 1 >= sizeof(cnst->value))
PR_ParseError(ERR_INTERNAL, "compiler constant value is too long\n");
strncpy(cnst->value, val, sizeof(cnst->value)-1);
PR_Message("value %s\n", val );
cnst->value[sizeof(cnst->value)-1] = '\0';
}
}
// optimisations.
else if ( !strnicmp(fs_argv[i], "-O", 2) || !strnicmp(fs_argv[i], "/O", 2) )
else if( !strnicmp(fs_argv[i], "/O", 2))
{
p = 0;
if (fs_argv[i][2] >= '0' && fs_argv[i][2] <= '3')
int currentlevel;
name = fs_argv[i], name += 2;// skip "/O"
level = atoi(name);
if(fs_argv[i][2] == 'd') currentlevel = MASK_DEBUG; // disable optimizations
else if (fs_argv[i][2] == '0') currentlevel = MASK_LEVEL_O;
else if (fs_argv[i][2] == '1') currentlevel = MASK_LEVEL_1;
else if (fs_argv[i][2] == '2') currentlevel = MASK_LEVEL_2;
else if (fs_argv[i][2] == '3') currentlevel = MASK_LEVEL_3;
else if (fs_argv[i][2] == '4') currentlevel = MASK_LEVEL_4;
for (i = 0; optimisations[i].enabled; i++)
{
}
else if (!strnicmp(fs_argv[i]+2, "no-", 3))
{
if (fs_argv[i][5])
if(optimisations[i].levelmask & currentlevel)
{
for (p = 0; optimisations[p].enabled; p++)
{
if ((*optimisations[p].abbrev && !stricmp(fs_argv[i]+5, optimisations[p].abbrev)) || !stricmp(fs_argv[i]+5, optimisations[p].fullname))
{
*optimisations[p].enabled = false;
break;
}
}
*optimisations[i].enabled = true;
Msg("use opt: \"%s\"\n", optimisations[i].fullname );
}
}
else
{
if (fs_argv[i][2])
for (p = 0; optimisations[p].enabled; p++)
if ((*optimisations[p].abbrev && !stricmp(fs_argv[i]+2, optimisations[p].abbrev)) || !stricmp(fs_argv[i]+2, optimisations[p].fullname))
{
*optimisations[p].enabled = true;
break;
}
}
if (!optimisations[p].enabled)
PR_Warning(0, NULL, WARN_BADPARAMS, "Unrecognised optimisation parameter (%s)", fs_argv[i]);
}
else if ( !strnicmp(fs_argv[i], "-K", 2) || !strnicmp(fs_argv[i], "/K", 2) )
@ -223,7 +222,7 @@ void PR_CommandLinePrecompilerOptions (void)
if (!strnicmp(fs_argv[i]+2, "no-", 3))
{
for (p = 0; compiler_flag[p].enabled; p++)
if (!stricmp(fs_argv[i]+5, compiler_flag[p].abbrev))
if (!stricmp(fs_argv[i]+5, compiler_flag[p].name))
{
*compiler_flag[p].enabled = false;
break;
@ -232,7 +231,7 @@ void PR_CommandLinePrecompilerOptions (void)
else
{
for (p = 0; compiler_flag[p].enabled; p++)
if (!stricmp(fs_argv[i]+2, compiler_flag[p].abbrev))
if (!stricmp(fs_argv[i]+2, compiler_flag[p].name))
{
*compiler_flag[p].enabled = true;
break;
@ -248,7 +247,7 @@ void PR_CommandLinePrecompilerOptions (void)
if (!strnicmp(fs_argv[i]+2, "no-", 3))
{
for (p = 0; compiler_flag[p].enabled; p++)
if (!stricmp(fs_argv[i]+5, compiler_flag[p].abbrev))
if (!stricmp(fs_argv[i]+5, compiler_flag[p].name))
{
*compiler_flag[p].enabled = false;
break;
@ -257,7 +256,7 @@ void PR_CommandLinePrecompilerOptions (void)
else
{
for (p = 0; compiler_flag[p].enabled; p++)
if (!stricmp(fs_argv[i]+2, compiler_flag[p].abbrev))
if (!stricmp(fs_argv[i]+2, compiler_flag[p].name))
{
*compiler_flag[p].enabled = true;
break;
@ -311,76 +310,18 @@ void PR_CommandLinePrecompilerOptions (void)
void PR_SetDefaultProperties (void)
{
int i;
int i, p;
Hash_InitTable(&compconstantstable, MAX_CONSTANTS, Qalloc(BytesForBuckets(MAX_CONSTANTS)));
for (p = 0; compiler_flag[p].enabled; p++)
*compiler_flag[p].enabled = compiler_flag[p].flags & FLAG_DEFAULT;
Hash_InitTable(&compconstantstable, MAX_CONSTANTS);
ForcedCRC = 0;
PR_DefineName("QCCLIB");
if (FS_CheckParm("/Oz"))
{
targetformat = QCF_RELEASE;
PR_DefineName("OP_COMP_STATEMENTS");
PR_DefineName("OP_COMP_DEFS");
PR_DefineName("OP_COMP_FIELDS");
PR_DefineName("OP_COMP_FUNCTIONS");
PR_DefineName("OP_COMP_STRINGS");
PR_DefineName("OP_COMP_GLOBALS");
PR_DefineName("OP_COMP_LINES");
PR_DefineName("OP_COMP_TYPES");
compressoutput = true; //enable compression
}
if (FS_CheckParm("/O0") || FS_CheckParm("-O0"))
level = 0;
else if (FS_CheckParm("/O1") || FS_CheckParm("-O1"))
level = 1;
else if (FS_CheckParm("/O2") || FS_CheckParm("-O2"))
level = 2;
else if (FS_CheckParm("/O3") || FS_CheckParm("-O3"))
level = 3;
else level = -1;
if (level == -1)
{
for (i = 0; optimisations[i].enabled; i++)
{
if (optimisations[i].flags & FLAG_ASDEFAULT)
*optimisations[i].enabled = true;
else
*optimisations[i].enabled = false;
}
}
else
{
for (i = 0; optimisations[i].enabled; i++)
{
if (level >= optimisations[i].optimisationlevel)
*optimisations[i].enabled = true;
else
*optimisations[i].enabled = false;
}
}
//targetformat = QCF_STANDARD;
switch(targetformat)
{
case QCF_DEBUG:
case QCF_RELEASE:
strncpy(pevname, "pev", 3 );
strncpy(pevname, "opev", 4 );
break;
default:
case QCF_STANDARD:
strncpy(pevname, "self", 4 );
strncpy(opevname, "oself", 5 );
break;
}
//enable all warnings
memset(pr_warning, 0, sizeof(pr_warning));
@ -398,31 +339,119 @@ void PR_SetDefaultProperties (void)
//Check the command line
PR_CommandLinePrecompilerOptions();
if (FS_CheckParm("-debug")) //disable any debug optimisations
//targetformat = QCF_STANDARD;
//FIXME
switch(targetformat)
{
case QCF_DEBUG:
case QCF_RELEASE:
strncpy(pevname, "pev", 3 );
strncpy(pevname, "opev", 4 );
break;
default:
case QCF_STANDARD:
strncpy(pevname, "self", 4 );
strncpy(opevname, "oself", 5 );
for (i = 0; optimisations[i].enabled; i++)
{
if (optimisations[i].flags & FLAG_KILLSDEBUGGERS)
if(*optimisations[i].enabled && optimisations[i].flags & FLAG_V7_ONLY)
{
*optimisations[i].enabled = false;
Msg("\"%s\" not supported with standard target, disable\n", optimisations[i].fullname );
}
}
break;
}
}
void PR_InitData (void)
/*
===================
PR_Init
initialize compiler and hash tables
===================
*/
void PR_Init( const char *name )
{
static char parmname[12][MAX_PARMS];
static temp_t ret_temp;
int i;
strncat(v_copyright, "This file was created with Xash3D QuakeC compiler,\n", sizeof(v_copyright));
strncat(v_copyright, "who based on original code of ForeThought's QuakeC compiler.\n", sizeof(v_copyright));
strncat(v_copyright, "Thanks to ID Software at all.", sizeof(v_copyright));
// tune limits
MAX_REGS = 65536;
MAX_ERRORS = 10; // per one file
MAX_STRINGS = 1000000;
MAX_GLOBALS = 32768;
MAX_FIELDS = 2048;
MAX_STATEMENTS = 0x80000;
MAX_FUNCTIONS = 16384;
maxtypeinfos = 16384;
MAX_CONSTANTS = 2048;
PR_SetDefaultProperties();
numtemps = 0;
functemps = NULL;
sourcefile = NULL;
numstatements = 1;
strings = (void *)Qalloc(sizeof(char) * MAX_STRINGS);
strofs = 1;
statements = (void *)Qalloc(sizeof(dstatement_t) * MAX_STATEMENTS);
numstatements = 1;
statement_linenums = (void *)Qalloc(sizeof(int) * MAX_STATEMENTS);
functions = (void *)Qalloc(sizeof(dfunction_t) * MAX_FUNCTIONS);
numfunctions = 1;
numglobaldefs = 1;
pr_bracelevel = 0;
pr_globals = (void *)Qalloc(sizeof(float) * MAX_REGS);
numpr_globals = 0;
Hash_InitTable(&globalstable, MAX_REGS);
Hash_InitTable(&localstable, MAX_REGS);
Hash_InitTable(&floatconstdefstable, MAX_REGS+1);
Hash_InitTable(&intconstdefstable, MAX_REGS+1);
Hash_InitTable(&stringconstdefstable, MAX_REGS);
qcc_globals = (void *)Qalloc(sizeof(ddef_t) * MAX_GLOBALS);
numglobaldefs = 1;
fields = (void *)Qalloc(sizeof(ddef_t) * MAX_FIELDS);
numfielddefs = 1;
precache_sounds = (void *)Qalloc(sizeof(char) * MAX_NAME * MAX_SOUNDS);
numsounds = 0;
precache_textures = (void *)Qalloc(sizeof(char) * MAX_NAME * MAX_TEXTURES);
numtextures = 0;
precache_models = (void *)Qalloc(sizeof(char) * MAX_NAME * MAX_MODELS);
nummodels = 0;
precache_files = (void *)Qalloc(sizeof(char) * MAX_NAME * MAX_FILES);
numfiles = 0;
qcc_typeinfo = (void *)Qalloc(sizeof(type_t) * maxtypeinfos);
numtypeinfos = 0;
qcc_tempofs = Qalloc(sizeof(int) * max_temps);
tempsstart = 0;
bodylessfuncs = 0;
memset(&pr, 0, sizeof(pr));
memset(&ret_temp, 0, sizeof(ret_temp));
memset(pr_immediate_string, 0, sizeof(pr_immediate_string));
if (opt_locals_marshalling) MsgWarn("Locals marshalling might be buggy. Use with caution\n");
strncpy( qccmprogsdat, name, sizeof(qccmprogsdat));
// default parms
def_ret.ofs = OFS_RETURN;
def_ret.name = "return";
def_ret.temp = &ret_temp;
@ -443,109 +472,6 @@ void PR_InitData (void)
}
}
/*
===================
PR_Init
initialize compiler and hash tables
===================
*/
void PR_Init( void )
{
int p;
// tune limits
MAX_REGS = 65536;
MAX_ERRORS = 10; // per one file
MAX_STRINGS = 1000000;
MAX_GLOBALS = 32768;
MAX_FIELDS = 2048;
MAX_STATEMENTS = 0x80000;
MAX_FUNCTIONS = 16384;
maxtypeinfos = 16384;
MAX_CONSTANTS = 2048;
strcpy(v_copyright, "This file was created with Xash3D QuakeC compiler\nbased on original code of ForeThought's QuakeC compiler\nThanks to ID Software at all");
for (p = 0; compiler_flag[p].enabled; p++)
{
*compiler_flag[p].enabled = compiler_flag[p].flags & FLAG_ASDEFAULT;
}
PR_SetDefaultProperties();
numtemps = 0;
functemps=NULL;
strings = (void *)Qalloc(sizeof(char) * MAX_STRINGS);
strofs = 1;
statements = (void *)Qalloc(sizeof(dstatement_t) * MAX_STATEMENTS);
numstatements = 0;
statement_linenums = (void *)Qalloc(sizeof(int) * MAX_STATEMENTS);
functions = (void *)Qalloc(sizeof(dfunction_t) * MAX_FUNCTIONS);
numfunctions=0;
pr_bracelevel = 0;
pr_globals = (void *)Qalloc(sizeof(float) * MAX_REGS);
numpr_globals=0;
Hash_InitTable(&globalstable, MAX_REGS, Qalloc(BytesForBuckets(MAX_REGS)));
Hash_InitTable(&localstable, MAX_REGS, Qalloc(BytesForBuckets(MAX_REGS)));
Hash_InitTable(&floatconstdefstable, MAX_REGS+1, Qalloc(BytesForBuckets(MAX_REGS+1)));
Hash_InitTable(&intconstdefstable, MAX_REGS+1, Qalloc(BytesForBuckets(MAX_REGS+1)));
Hash_InitTable(&stringconstdefstable, MAX_REGS, Qalloc(BytesForBuckets(MAX_REGS)));
// pr_global_defs = (def_t **)Qalloc(sizeof(def_t *) * MAX_REGS);
qcc_globals = (void *)Qalloc(sizeof(ddef_t) * MAX_GLOBALS);
numglobaldefs=0;
fields = (void *)Qalloc(sizeof(ddef_t) * MAX_FIELDS);
numfielddefs=0;
memset(pr_immediate_string, 0, sizeof(pr_immediate_string));
precache_sounds = (void *)Qalloc(sizeof(char)*MAX_NAME*MAX_SOUNDS);
numsounds = 0;
precache_textures = (void *)Qalloc(sizeof(char)*MAX_NAME*MAX_TEXTURES);
numtextures=0;
precache_models = (void *)Qalloc(sizeof(char)*MAX_NAME*MAX_MODELS);
nummodels=0;
precache_files = (void *)Qalloc(sizeof(char)*MAX_NAME*MAX_FILES);
numfiles = 0;
qcc_typeinfo = (void *)Qalloc(sizeof(type_t)*maxtypeinfos);
numtypeinfos = 0;
qcc_tempofs = Qalloc(sizeof(int) * max_temps);
tempsstart = 0;
bodylessfuncs=0;
memset(&pr, 0, sizeof(pr));
#ifdef MAX_EXTRA_PARMS
memset(&extra_parms, 0, sizeof(extra_parms));
#endif
if (opt_locals_marshalling)
Msg("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\nLocals marshalling might be buggy. Use with caution\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");
if(FS_GetParmFromCmdLine("-src", qccmsourcedir ))
{
strcat (qccmsourcedir, "/");
Msg ("Source directory: %s\n", qccmsourcedir);
}
else *qccmsourcedir = '\0';
PR_InitData ();
}
void PR_WriteData (int crc)
{
char element[MAX_NAME];
@ -600,15 +526,25 @@ void PR_WriteData (int crc)
outputsize = 32;
}
if(opt_compstrings)
{
progs.blockscompressed |= COMP_STRINGS;
}
if(opt_compfunctions)
{
progs.blockscompressed |= COMP_FUNCTIONS;
progs.blockscompressed |= COMP_STATEMENTS;
}
if(opt_compress_other)
{
progs.blockscompressed |= COMP_DEFS;
progs.blockscompressed |= COMP_FIELDS;
progs.blockscompressed |= COMP_GLOBALS;
}
//compression of blocks?
if (compressoutput)
{
progs.blockscompressed |= COMP_STATEMENTS;
progs.blockscompressed |= COMP_DEFS;
progs.blockscompressed |= COMP_FIELDS;
progs.blockscompressed |= COMP_FUNCTIONS;
progs.blockscompressed |= COMP_STRINGS;
progs.blockscompressed |= COMP_GLOBALS;
progs.blockscompressed |= COMP_LINENUMS;
progs.blockscompressed |= COMP_TYPES;
}
@ -892,14 +828,14 @@ void PR_WriteData (int crc)
progs.ofsbodylessfuncs = VFS_Tell(h);
progs.numbodylessfuncs = PR_WriteBodylessFuncs(h);
if (debugtarget)
if (opt_writelinenums)
{
progs.ofslinenums = VFS_Tell(h);
PR_WriteBlock(h, progs.ofslinenums, statement_linenums, numstatements*sizeof(int), progs.blockscompressed & COMP_LINENUMS);
}
else progs.ofslinenums = 0;
if (types)
if (opt_writetypes)
{
progs.ofs_types = VFS_Tell(h);
progs.numtypes = numtypeinfos;
@ -910,7 +846,7 @@ void PR_WriteData (int crc)
progs.ofs_types = 0;
progs.numtypes = 0;
}
progs.ofsfiles = PR_WriteSourceFiles(h, &progs, debugtarget);
progs.ofsfiles = PR_WriteSourceFiles(h, &progs, opt_writesources);
break;
}
@ -1029,54 +965,6 @@ void PR_BeginCompilation ( void )
compileactive = true;
}
/*
==============
PR_FinishCompilation
called after all files are compiled to check for errors
Returns false if errors were detected.
==============
*/
int PR_FinishCompilation (void)
{
def_t *d;
int errors = pr_total_error_count;
// check to make sure all functions prototyped have code
for (d = pr.def_head.next; d; d = d->next)
{
if (d->type->type == ev_function && !d->scope)// function parms are ok
{
if (d->initialized == 0)
{
if (!strncmp(d->name, "ArrayGet*", 9))
{
PR_EmitArrayGetFunction(d, d->name + 9);
pr_scope = NULL;
}
else if (!strncmp(d->name, "ArraySet*", 9))
{
PR_EmitArraySetFunction(d, d->name + 9);
pr_scope = NULL;
}
else if (!strncmp(d->name, "Class*", 6))
{
PR_EmitClassFromFunction(d, d->name + 6);
pr_scope = NULL;
}
else
{
PR_Warning(WARN_NOTDEFINED, strings + d->s_file, d->s_line, "function %s was not defined",d->name);
bodylessfuncs = true;
}
}
else if (d->initialized == 2) bodylessfuncs = true;
}
}
pr_scope = NULL;
return (errors == 0);
}
//=============================================================================
@ -1183,8 +1071,8 @@ bool PrepareDATProgs ( const char *dir, const char *name, byte params )
{
qccpool = Mem_AllocPool( "QCC Compiler" );
FS_InitRootDir(".");
PR_Init();
FS_InitRootDir( (char *)dir );
PR_Init( name );
return true;
}

View File

@ -6,10 +6,10 @@
#include "qcclib.h"
#include "zip32.h"
void Hash_InitTable(hashtable_t *table, int numbucks, void *mem)
void Hash_InitTable(hashtable_t *table, int numbucks)
{
table->numbuckets = numbucks;
table->bucket = (bucket_t **)mem;
table->bucket = (bucket_t **)Qalloc(BytesForBuckets(numbucks));
}
int Hash_Key(char *name, int modulus)
@ -282,12 +282,12 @@ int PR_WriteSourceFiles(vfile_t *h, dprograms_t *progs, bool sourceaswell)
continue;
strcpy(idf[num].filename, f->filename);
idf[num].size = f->size;
idf[num].compmethod = 1;
idf[num].compmethod = 2;
idf[num].ofs = VFS_Tell(h);
idf[num].compsize = PR_encode(f->size, idf[num].compmethod, f->file, h);
Msg("Add %s, size %d, compressed %d\n", idf[num].filename, idf[num].size, idf[num].compsize );
num++;
}
ofs = VFS_Tell(h);
VFS_Write(h, &num, sizeof(int));
VFS_Write(h, idf, sizeof(includeddatafile_t)*num);
@ -359,7 +359,7 @@ word PR_WriteProgdefs (char *filename)
char file[PROGDEFS_MAX_SIZE];
char header_name[MAX_QPATH];
def_t *d;
int f = 0;
int f = 0, k = 1;
word crc;
CRC_Init (&crc);
@ -456,8 +456,9 @@ word PR_WriteProgdefs (char *filename)
// write fields
for (d = pr.def_head.next; d; d = d->next)
{
if (!strcmp (d->name, "end_sys_fields")) break;
if (!strcmp (d->name, "end_sys_fields")) k = 0;
if (d->type->type != ev_field) continue;
if (k) continue; //write only user fields
if (f) ADD2(",\n");
f = 1;
@ -565,10 +566,9 @@ void PR_UnmarshalLocals( void )
numpr_globals = maxo+3;
if (numpr_globals > MAX_REGS)
Sys_Error("Too many globals are in use to unmarshal all locals");
PR_ParseError(ERR_INTERNAL, "Too many globals are in use to unmarshal all locals");
if (maxo-ofs)
Msg("Total of %i marshalled globals\n", maxo-ofs);
if (maxo-ofs) Msg("Total of %i marshalled globals\n", maxo-ofs);
}
/*
@ -607,8 +607,6 @@ int PR_encode(int len, int method, char *in, vfile_t *handle)
}
VFS_Write( handle, out, sizeof(out) - strm.avail_out );
i += sizeof(out) - strm.avail_out;
Msg("real length %d, compressed len %d\n", len, i );
deflateEnd( &strm );
return i;
}
@ -623,7 +621,7 @@ byte *PR_LoadFile(char *filename, fs_offset_t *filesizeptr, int type )
{
char *mem;
int len = FS_FileSize(filename);
if (!len) Sys_Error("Couldn't open file %s", filename);
if (!len) PR_ParseError(ERR_INTERNAL, "Couldn't open file %s", filename);
mem = Qalloc(sizeof(cachedsourcefile_t) + len );
((cachedsourcefile_t*)mem)->next = sourcefile;

View File

@ -34,12 +34,25 @@ TODO:
#define MAX_FILES 1024
#define PROGDEFS_MAX_SIZE 16384 // 16 kbytes
// optimization level flags
#define FL_DBG 1
#define FL_OP0 2
#define FL_OP1 4
#define FL_OP2 8
#define FL_OP3 16
#define FL_OP4 32
#define MASK_DEBUG (FL_DBG)
#define MASK_LEVEL_O (FL_OP0)
#define MASK_LEVEL_1 (FL_OP0|FL_OP1)
#define MASK_LEVEL_2 (FL_OP0|FL_OP1|FL_OP2)
#define MASK_LEVEL_3 (FL_OP0|FL_OP1|FL_OP2|FL_OP3)
#define MASK_LEVEL_4 (FL_OP0|FL_OP1|FL_OP2|FL_OP3|FL_OP4)
//compiler flags
#define FLAG_KILLSDEBUGGERS 1
#define FLAG_ASDEFAULT 2
#define FLAG_SETINGUI 4
#define FLAG_HIDDENINGUI 8
#define FLAG_MIDCOMPILE 16 //option can be changed mid-compile with the special pragma
#define FLAG_V7_ONLY 1 // only 7 version can use this optimization
#define FLAG_DEFAULT 2 // enabled as default
#define FLAG_MIDCOMPILE 4 // option can be changed mid-compile with the special pragma
#define G_FLOAT(o) (pr_globals[o])
#define G_INT(o) (*(int *)&pr_globals[o])
@ -100,16 +113,16 @@ typedef enum {
typedef struct bucket_s
{
void *data;
char *keystring;
struct bucket_s *next;
}bucket_t;
void *data;
char *keystring;
struct bucket_s *next;
} bucket_t;
typedef struct hashtable_s
{
int numbuckets;
bucket_t **bucket;
}hashtable_t;
uint numbuckets;
bucket_t **bucket;
} hashtable_t;
typedef struct cachedsourcefile_s
{
@ -165,24 +178,17 @@ typedef union eval_s
typedef struct
{
bool *enabled;
char *abbrev;
int optimisationlevel;
int flags; //1: kills debuggers. 2: applied as default.
char *fullname;
char *description;
void *guiinfo;
char *shortname; // for option "/Ox", where x is shortname
char *fullname; // display name
int levelmask; // optimization level mask
int flags; // sepcial flags for kill debug extensions, e.t.c
} optimisations_t;
typedef struct
{
bool *enabled;
int flags; //2 applied as default
char *abbrev;
char *fullname;
char *description;
void *guiinfo;
int flags; // 2 applied as default
char *name;
} compiler_flag_t;
typedef struct
@ -457,6 +463,7 @@ extern opcode_t pr_opcodes[]; // sized by initialization
extern temp_t *functemps;
const extern int type_size[];
extern const_t *CompilerConstant;
extern bool bodylessfuncs;
extern bool pr_dumpasm;
extern char pr_token[8192];
extern token_type_t pr_token_type;
@ -522,10 +529,16 @@ extern bool opt_stripfunctions;
extern bool opt_locals_marshalling;
extern bool opt_logicops;
extern bool opt_vectorcalls;
extern bool opt_writelinenums;
extern bool opt_writetypes;
extern bool opt_writesources;
extern bool opt_compstrings; // compress all strings into produced file
extern bool opt_compfunctions; // compress all functions and statements
extern bool opt_compress_other;
extern bool pr_warning[WARN_MAX];
extern char pr_parm_names[MAX_PARMS + MAX_PARMS_EXTRA][MAX_NAME];
extern def_t *extra_parms[MAX_PARMS_EXTRA];
extern jmp_buf pr_parse_abort; // longjump with this on parse error
extern jmp_buf pr_parse_abort; // longjump with this on parse error
extern int pr_source_line;
extern char *pr_file_p;
extern def_t *pr_scope;
@ -573,7 +586,7 @@ extern int numfiles;
// pr_utils.c
//
extern int typecmp(type_t *a, type_t *b);
void Hash_InitTable(hashtable_t *table, int numbucks, void *mem);
void Hash_InitTable(hashtable_t *table, int numbucks);
int Hash_Key(char *name, int modulus);
void *Hash_Get(hashtable_t *table, char *name);
void *Hash_GetKey(hashtable_t *table, int key);

View File

@ -23,7 +23,7 @@ if errorlevel 1 set BUILD_ERROR=1
%MSDEV% render/render.dsp %CONFIG%"render - Win32 Debug" %build_target%
if errorlevel 1 set BUILD_ERROR=1
qcclib.exe -src vprogs -progdefs -log /Oz
qcclib.exe -dir vprogs -progdefs -log /O3
if errorlevel 1 set BUILD_ERROR=1
if "%BUILD_ERROR%"=="" goto build_ok
@ -51,8 +51,8 @@ if exist launch\launch.plg del /f /q launch\launch.plg
if exist common\common.plg del /f /q common\common.plg
if exist render\render.plg del /f /q render\render.plg
if exist compile.log del /f /q compile.log
if exist server.dat move server.dat D:\Xash3D\xash\server.dat
if exist progdefs.h move progdefs.h engine\progdefs.h
if exist vprogs\server.dat move vprogs\server.dat D:\Xash3D\xash\server.dat
if exist vprogs\progdefs.h move vprogs\progdefs.h engine\progdefs.h
echo Build succeeded!
echo Please wait. Xash is now loading

View File

@ -164,105 +164,73 @@ typedef struct prvm_fieldvars_s
static prvm_fieldvars_t reqfields[] =
{
{0, 1, "classname"},
{1, 1, "globalname"},
{2, 2, "modelindex"},
{3, 3, "origin"},
{6, 3, "angles"},
{9, 3, "old_origin"},
{12, 3, "old_angles"},
{15, 3, "velocity"},
{18, 3, "avelocity"},
{21, 3, "post_origin"},
{24, 3, "post_angles"},
{27, 3, "post_velocity"},
{30, 3, "post_avelocity"},
{33, 3, "origin_offset"},
{36, 3, "angles_offset"},
{39, 2, "ltime"},
{40, 2, "bouncetype"},
{41, 2, "movetype"},
{42, 2, "solid"},
{43, 3, "absmin"},
{46, 3, "absmax"},
{49, 3, "mins"},
{52, 3, "maxs"},
{55, 3, "size"},
{58, 4, "chain"},
{59, 1, "model"},
{60, 2, "frame"},
{61, 2, "sequence"},
{62, 2, "renderfx"},
{63, 2, "effects"},
{64, 2, "skin"},
{65, 2, "body"},
{66, 1, "weaponmodel"},
{67, 2, "weaponframe"},
{68, 6, "use"},
{69, 6, "touch"},
{70, 6, "think"},
{71, 6, "blocked"},
{72, 6, "activate"},
{73, 6, "walk"},
{74, 6, "jump"},
{75, 6, "duck"},
{76, 2, "flags"},
{77, 2, "aiflags"},
{78, 2, "spawnflags"},
{79, 4, "groundentity"},
{80, 2, "nextthink"},
{81, 2, "takedamage"},
{82, 2, "health"},
{83, 2, "frags"},
{84, 2, "weapon"},
{85, 2, "items"},
{86, 1, "target"},
{87, 1, "parent"},
{88, 1, "targetname"},
{89, 4, "aiment"},
{90, 4, "goalentity"},
{91, 3, "punchangle"},
{94, 2, "deadflag"},
{95, 3, "view_ofs"},
{98, 2, "button0"},
{99, 2, "button1"},
{100, 2, "button2"},
{101, 2, "impulse"},
{102, 2, "fixangle"},
{103, 3, "v_angle"},
{106, 2, "idealpitch"},
{107, 1, "netname"},
{108, 4, "enemy"},
{109, 2, "alpha"},
{110, 2, "team"},
{111, 2, "max_health"},
{112, 2, "teleport_time"},
{113, 2, "armortype"},
{114, 2, "armorvalue"},
{115, 2, "waterlevel"},
{116, 2, "watertype"},
{117, 2, "ideal_yaw"},
{118, 2, "yaw_speed"},
{119, 2, "dmg_take"},
{120, 2, "dmg_save"},
{121, 4, "dmg_inflictor"},
{122, 4, "owner"},
{123, 3, "movedir"},
{126, 1, "message"},
{127, 2, "sounds"},
{128, 1, "noise"},
{129, 1, "noise1"},
{130, 1, "noise2"},
{131, 1, "noise3"},
{132, 2, "jumpup"},
{133, 2, "jumpdn"},
{134, 4, "movetarget"},
{135, 2, "mass"},
{136, 2, "density"},
{137, 2, "gravity"},
{138, 2, "dmg"},
{139, 2, "dmgtime"},
{140, 2, "speed"}
{141, 6, "th_stand"},
{142, 6, "th_walk"},
{143, 6, "th_run"},
{144, 6, "th_pain"},
{145, 6, "th_die"},
{146, 6, "th_missile"},
{147, 6, "th_melee"},
{148, 1, "wad"},
{149, 1, "map"},
{150, 1, "landmark"},
{151, 2, "worldtype"},
{152, 2, "delay"},
{153, 2, "wait"},
{154, 2, "lip"},
{155, 2, "light_lev"},
{156, 2, "style"},
{157, 2, "skill"},
{158, 1, "killtarget"},
{159, 3, "pos1"},
{162, 3, "pos2"},
{165, 3, "mangle"},
{168, 2, "pain_finished"},
{169, 2, "air_finished"},
{170, 3, "camview"},
{173, 2, "aflag"},
{174, 4, "trigger_field"},
{175, 2, "anim_time"},
{176, 2, "anim_end"},
{177, 2, "anim_priority"},
{178, 2, "anim_run"},
{179, 2, "showhelp"},
{180, 2, "touched"},
{181, 1, "name"},
{182, 4, "triggerer"},
{183, 1, "targ"},
{184, 1, "targ[1]"},
{185, 1, "targ[2]"},
{186, 1, "targ[3]"},
{187, 1, "targ[4]"},
{188, 1, "targ[5]"},
{189, 1, "targ[6]"},
{190, 1, "targ[7]"},
{191, 1, "oldtarg"},
{192, 1, "oldtarg[1]"},
{193, 1, "oldtarg[2]"},
{194, 1, "oldtarg[3]"},
{195, 1, "oldtarg[4]"},
{196, 1, "oldtarg[5]"},
{197, 1, "oldtarg[6]"},
{198, 1, "oldtarg[7]"},
{199, 2, "twait"},
{200, 2, "twait[1]"},
{201, 2, "twait[2]"},
{202, 2, "twait[3]"},
{203, 2, "twait[4]"},
{204, 2, "twait[5]"},
{205, 2, "twait[6]"},
{206, 2, "twait[7]"},
{207, 2, "olddelay"},
{208, 1, "message1"},
{209, 1, "message2"},
{210, 2, "count"},
{211, 2, "state"},
{212, 2, "used"},
{213, 3, "dest"},
{216, 1, "target_dest"},
{217, 1, "oldmodel"}
};
#define PROG_CRC_SERVER 64081

View File

@ -196,13 +196,15 @@ void CommonInit ( char *funcname, int argc, char **argv )
Com->Compile.PrepareBSP( gamedir, source, bspflags );
break;
case QCCLIB:
if(!GetParmFromCmdLine("+dat", source ))
strncpy(source, "progs", sizeof(source));
if(!GetParmFromCmdLine("-dir", gamedir ))
strncpy(gamedir, ".", sizeof(gamedir));
if(!GetParmFromCmdLine("+src", source ))
strncpy(source, "progs.src", sizeof(source));
if(CheckParm("-progdefs")) qccflags |= QCC_PROGDEFS;
if(CheckParm("/O0")) qccflags |= QCC_OPT_LEVEL_0;
if(CheckParm("/O1")) qccflags |= QCC_OPT_LEVEL_1;
if(CheckParm("/O2")) qccflags |= QCC_OPT_LEVEL_2;
if(CheckParm("/O2")) qccflags |= QCC_OPT_LEVEL_3;
if(CheckParm("/O3")) qccflags |= QCC_OPT_LEVEL_3;
Com->Compile.PrepareDAT( gamedir, source, qccflags );
break;
@ -257,6 +259,7 @@ void CommonMain ( void )
Com->Compile.DAT();
strcpy(typemod, "progs" );
strcpy(searchmask[0], "*.src" );
strcpy(searchmask[1], "*.qc" );
break;
case DEFAULT:
strcpy(typemod, "things" );
@ -446,6 +449,7 @@ DLLEXPORT int CreateAPI( char *funcname )
if(GetParmFromCmdLine("-dev", dev_level ))
dev_mode = atoi(dev_level);
if(CheckParm ("-silent")) hooked_out = true;
UpdateEnvironmentVariables(); // set working directory
// init launcher

View File

@ -68,23 +68,29 @@ void ParseCommandLine (LPSTR lpCmdLine)
while (*lpCmdLine && (com_argc < MAX_NUM_ARGVS))
{
while (*lpCmdLine && ((*lpCmdLine <= 32) || (*lpCmdLine > 126)))
while (*lpCmdLine && *lpCmdLine <= ' ') lpCmdLine++;
if (!*lpCmdLine) break;
if (*lpCmdLine == '\"')
{
// quoted string
lpCmdLine++;
com_argv[com_argc] = lpCmdLine;
com_argc++;
while (*lpCmdLine && (*lpCmdLine != '\"')) lpCmdLine++;
}
else
{
// unquoted word
com_argv[com_argc] = lpCmdLine;
com_argc++;
while (*lpCmdLine && *lpCmdLine > ' ') lpCmdLine++;
}
if (*lpCmdLine)
{
com_argv[com_argc] = lpCmdLine;
com_argc++;
while (*lpCmdLine && ((*lpCmdLine > 32) && (*lpCmdLine <= 126)))
lpCmdLine++;
if (*lpCmdLine)
{
*lpCmdLine = 0;
lpCmdLine++;
}
*lpCmdLine = 0;
lpCmdLine++;
}
}

View File

@ -399,7 +399,7 @@ typedef struct
uint entityfields;
// version 7 extensions
uint ofsfiles; // source files. comp 256 or decrypt
uint ofsfiles; // source files always compressed
uint ofslinenums; // numstatements big // comp 64
uint ofsbodylessfuncs; // no comp
uint numbodylessfuncs;

View File

@ -24,7 +24,7 @@ if errorlevel 1 set BUILD_ERROR=1
%MSDEV% render/render.dsp %CONFIG%"render - Win32 Release" %build_target%
if errorlevel 1 set BUILD_ERROR=1
qcclib.exe -src vprogs -progdefs /Oz
qcclib.exe -dir vprogs -progdefs /Oz
if errorlevel 1 set BUILD_ERROR=1
if "%BUILD_ERROR%"=="" goto build_ok
@ -52,8 +52,8 @@ if exist launch\launch.plg del /f /q launch\launch.plg
if exist common\common.plg del /f /q common\common.plg
if exist render\render.plg del /f /q render\render.plg
if exist compile.log del /f /q compile.log
if exist server.dat move server.dat D:\Xash3D\xash\server.dat
if exist progdefs.h move progdefs.h engine\progdefs.h
if exist vprogs\server.dat move vprogs\server.dat D:\Xash3D\xash\server.dat
if exist vprogs\progdefs.h move vprogs\progdefs.h engine\progdefs.h
echo Build succeeded!
echo Please wait. Xash is now loading

View File

@ -1,6 +1,12 @@
=======================================================================
Xash3D QuakeC Compiler started at Oct04 2007 [00:48:34]
Xash3D QuakeC Compiler started at Oct05 2007 [00:01:47]
=======================================================================
use opt: "write source"
use opt: "write linenums"
use opt: "write types"
"write source" not supported with standard target, disable
"write linenums" not supported with standard target, disable
"write types" not supported with standard target, disable
------------Configuration: server - Vm16 Debug------------
Compiling...
defs.c
@ -36,14 +42,14 @@ ents/items/items.c
impulses.c
writing progdefs.h
Xash3D virtual machine
19056 strofs (of 1000000)
2799 numstatements (of 524288)
19684 strofs (of 1000000)
2867 numstatements (of 524288)
281 numfunctions (of 16384)
916 numglobaldefs (of 32768)
964 numglobaldefs (of 32768)
245 numfielddefs (218 unique) (of 2048)
927 numpr_globals (of 65536)
2279 numpr_globals (of 65536)
Writing server.dat
64796 TOTAL SIZE
71768 TOTAL SIZE
17 unique precache_sounds
3 unique precache_models
‘ª®¯¨à®¢ ­® ä ©«®¢: 1.
@ -51,5 +57,5 @@ Writing server.dat
server.dat - 0 error(s), 0 warning(s)
=======================================================================
Xash3D QuakeC Compiler stopped at Oct04 2007 [00:48:34]
Xash3D QuakeC Compiler stopped at Oct05 2007 [00:01:48]
=======================================================================

View File

@ -12,7 +12,7 @@
| refuse to run. |
+=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-+
*/
#pragma TARGET RELEASE
#pragma TARGET debug
// These lines CANNOT be altered/moved
// pointers to ents

View File

@ -1,270 +0,0 @@
// progdefs.h
// generated by Xash3D QuakeC compiler
#ifndef PROGDEFS_H
#define PROGDEFS_H
typedef struct globalvars_s
{
int pad[28];
int pev;
int other;
int world;
float time;
float frametime;
string_t mapname;
string_t startspot;
vec3_t spotoffset;
float deathmatch;
float coop;
float teamplay;
float serverflags;
float total_secrets;
float total_monsters;
float found_secrets;
float killed_monsters;
vec3_t v_forward;
vec3_t v_right;
vec3_t v_up;
float trace_allsolid;
float trace_startsolid;
float trace_fraction;
vec3_t trace_endpos;
vec3_t trace_plane_normal;
float trace_plane_dist;
float trace_hitgroup;
float trace_contents;
int trace_ent;
float trace_flags;
func_t main;
func_t StartFrame;
func_t EndFrame;
func_t PlayerPreThink;
func_t PlayerPostThink;
func_t ClientKill;
func_t ClientConnect;
func_t PutClientInServer;
func_t ClientDisconnect;
func_t ClientCommand;
} globalvars_t;
typedef struct entvars_s
{
string_t classname;
string_t globalname;
float modelindex;
vec3_t origin;
vec3_t angles;
vec3_t old_origin;
vec3_t old_angles;
vec3_t velocity;
vec3_t avelocity;
vec3_t post_origin;
vec3_t post_angles;
vec3_t post_velocity;
vec3_t post_avelocity;
vec3_t origin_offset;
vec3_t angles_offset;
float ltime;
float bouncetype;
float movetype;
float solid;
vec3_t absmin;
vec3_t absmax;
vec3_t mins;
vec3_t maxs;
vec3_t size;
int chain;
string_t model;
float frame;
float sequence;
float renderfx;
float effects;
float skin;
float body;
string_t weaponmodel;
float weaponframe;
func_t use;
func_t touch;
func_t think;
func_t blocked;
func_t activate;
func_t walk;
func_t jump;
func_t duck;
float flags;
float aiflags;
float spawnflags;
int groundentity;
float nextthink;
float takedamage;
float health;
float frags;
float weapon;
float items;
string_t target;
string_t parent;
string_t targetname;
int aiment;
int goalentity;
vec3_t punchangle;
float deadflag;
vec3_t view_ofs;
float button0;
float button1;
float button2;
float impulse;
float fixangle;
vec3_t v_angle;
float idealpitch;
string_t netname;
int enemy;
float alpha;
float team;
float max_health;
float teleport_time;
float armortype;
float armorvalue;
float waterlevel;
float watertype;
float ideal_yaw;
float yaw_speed;
float dmg_take;
float dmg_save;
int dmg_inflictor;
int owner;
vec3_t movedir;
string_t message;
float sounds;
string_t noise;
string_t noise1;
string_t noise2;
string_t noise3;
float jumpup;
float jumpdn;
int movetarget;
float mass;
float density;
float gravity;
float dmg;
float dmgtime;
float speed;
} entvars_t;
typedef struct prvm_fieldvars_s
{
int ofs;
int type;
const char *name;
} prvm_fieldvars_t;
#define REQFIELDS (sizeof(reqfields) / sizeof(prvm_fieldvars_t))
static prvm_fieldvars_t reqfields[] =
{
{0, 1, "classname"},
{1, 1, "globalname"},
{2, 2, "modelindex"},
{3, 3, "origin"},
{6, 3, "angles"},
{9, 3, "old_origin"},
{12, 3, "old_angles"},
{15, 3, "velocity"},
{18, 3, "avelocity"},
{21, 3, "post_origin"},
{24, 3, "post_angles"},
{27, 3, "post_velocity"},
{30, 3, "post_avelocity"},
{33, 3, "origin_offset"},
{36, 3, "angles_offset"},
{39, 2, "ltime"},
{40, 2, "bouncetype"},
{41, 2, "movetype"},
{42, 2, "solid"},
{43, 3, "absmin"},
{46, 3, "absmax"},
{49, 3, "mins"},
{52, 3, "maxs"},
{55, 3, "size"},
{58, 4, "chain"},
{59, 1, "model"},
{60, 2, "frame"},
{61, 2, "sequence"},
{62, 2, "renderfx"},
{63, 2, "effects"},
{64, 2, "skin"},
{65, 2, "body"},
{66, 1, "weaponmodel"},
{67, 2, "weaponframe"},
{68, 6, "use"},
{69, 6, "touch"},
{70, 6, "think"},
{71, 6, "blocked"},
{72, 6, "activate"},
{73, 6, "walk"},
{74, 6, "jump"},
{75, 6, "duck"},
{76, 2, "flags"},
{77, 2, "aiflags"},
{78, 2, "spawnflags"},
{79, 4, "groundentity"},
{80, 2, "nextthink"},
{81, 2, "takedamage"},
{82, 2, "health"},
{83, 2, "frags"},
{84, 2, "weapon"},
{85, 2, "items"},
{86, 1, "target"},
{87, 1, "parent"},
{88, 1, "targetname"},
{89, 4, "aiment"},
{90, 4, "goalentity"},
{91, 3, "punchangle"},
{94, 2, "deadflag"},
{95, 3, "view_ofs"},
{98, 2, "button0"},
{99, 2, "button1"},
{100, 2, "button2"},
{101, 2, "impulse"},
{102, 2, "fixangle"},
{103, 3, "v_angle"},
{106, 2, "idealpitch"},
{107, 1, "netname"},
{108, 4, "enemy"},
{109, 2, "alpha"},
{110, 2, "team"},
{111, 2, "max_health"},
{112, 2, "teleport_time"},
{113, 2, "armortype"},
{114, 2, "armorvalue"},
{115, 2, "waterlevel"},
{116, 2, "watertype"},
{117, 2, "ideal_yaw"},
{118, 2, "yaw_speed"},
{119, 2, "dmg_take"},
{120, 2, "dmg_save"},
{121, 4, "dmg_inflictor"},
{122, 4, "owner"},
{123, 3, "movedir"},
{126, 1, "message"},
{127, 2, "sounds"},
{128, 1, "noise"},
{129, 1, "noise1"},
{130, 1, "noise2"},
{131, 1, "noise3"},
{132, 2, "jumpup"},
{133, 2, "jumpdn"},
{134, 4, "movetarget"},
{135, 2, "mass"},
{136, 2, "density"},
{137, 2, "gravity"},
{138, 2, "dmg"},
{139, 2, "dmgtime"},
{140, 2, "speed"}
};
#define PROG_CRC_SERVER 64081
#endif//PROGDEFS_H

View File

@ -1 +1 @@
qcclib -log -debug -progdefs
qcclib -log -debug -progdefs /Od

Binary file not shown.