From cf1ec0b4253d87258cfb2cad9f2e121b88133088 Mon Sep 17 00:00:00 2001 From: TimeServ Date: Sat, 3 Sep 2005 21:42:22 +0000 Subject: [PATCH] poundonly flag for preqcc-dependant mods constant name max increased to 64 git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@1267 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- engine/qclib/qcc.h | 3 ++- engine/qclib/qcc_pr_comp.c | 1 + engine/qclib/qcc_pr_lex.c | 2 +- engine/qclib/qccmain.c | 1 + 4 files changed, 5 insertions(+), 2 deletions(-) diff --git a/engine/qclib/qcc.h b/engine/qclib/qcc.h index cf01537f8..19dd24e72 100644 --- a/engine/qclib/qcc.h +++ b/engine/qclib/qcc.h @@ -63,7 +63,7 @@ extern int MAX_FUNCTIONS; #define MAX_DATA_PATH 64 extern int MAX_CONSTANTS; -#define MAXCONSTANTLENGTH 32 +#define MAXCONSTANTLENGTH 64 #define MAXCONSTANTVALUELENGTH 256 #define MAXCONSTANTPARAMLENGTH 32 #define MAXCONSTANTPARAMS 8 @@ -476,6 +476,7 @@ extern pbool flag_ifstring; extern pbool flag_acc; extern pbool flag_caseinsensative; extern pbool flag_laxcasts; +extern pbool flag_poundonly; extern pbool opt_overlaptemps; extern pbool opt_shortenifnots; diff --git a/engine/qclib/qcc_pr_comp.c b/engine/qclib/qcc_pr_comp.c index 66afc8b2f..e26591bce 100644 --- a/engine/qclib/qcc_pr_comp.c +++ b/engine/qclib/qcc_pr_comp.c @@ -71,6 +71,7 @@ pbool flag_ifstring; //makes if (blah) equivelent to if (blah != "") which reso pbool flag_acc; //reacc like behaviour of src files (finds *.qc in start dir and compiles all in alphabetical order) pbool flag_caseinsensative; //symbols will be matched to an insensative case if the specified case doesn't exist. This should b usable for any mod pbool flag_laxcasts; //Allow lax casting. This'll produce loadsa warnings of course. But allows compilation of certain dodgy code. +pbool flag_poundonly; //Allows use of only #constant for precompiler constants, allows certain preqcc using mods to compile pbool opt_overlaptemps; //reduce numpr_globals by reuse of temps. When they are not needed they are freed for reuse. The way this is implemented is better than frikqcc's. (This is the single most important optimisation) pbool opt_assignments; //STORE_F isn't used if an operation wrote to a temp. diff --git a/engine/qclib/qcc_pr_lex.c b/engine/qclib/qcc_pr_lex.c index e112438a5..4112b7266 100644 --- a/engine/qclib/qcc_pr_lex.c +++ b/engine/qclib/qcc_pr_lex.c @@ -2285,7 +2285,7 @@ void QCC_PR_Lex (void) if ( (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || c == '_' ) { - if (!QCC_PR_CheakCompConst()) //look for a macro. + if (flag_poundonly || !QCC_PR_CheakCompConst()) //look for a macro. QCC_PR_LexName (); else if (pr_token_type == tt_eof) diff --git a/engine/qclib/qccmain.c b/engine/qclib/qccmain.c index 979c352fa..fce076ed0 100644 --- a/engine/qclib/qccmain.c +++ b/engine/qclib/qccmain.c @@ -219,6 +219,7 @@ compiler_flag_t compiler_flag[] = { {&flag_acc, 0, "acc", "Reacc support", "Reacc is a pascall like compiler. It was released before the Quake source was released. This flag has a few effects. It sorts all qc files in the current directory into alphabetical order to compile them. It also allows Reacc global/field distinctions, as well as allows ¦ as EOF. Whilst case insensativity and lax type checking are supported by reacc, they are seperate compiler flags in fteqcc."}, //reacc like behaviour of src files. {&flag_caseinsensative, 0, "caseinsens", "Case insensativity", "Causes fteqcc to become case insensative whilst compiling names. It's generally not advised to use this as it compiles a little more slowly and provides little benefit. However, it is required for full reacc support."}, //symbols will be matched to an insensative case if the specified case doesn't exist. This should b usable for any mod {&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_poundonly, FLAG_MIDCOMPILE,"poundonly", "Pound-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 fteqcc. 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))"}, {NULL} };