2004-08-23 01:38:21 +00:00
# ifndef MINIMAL
# include "qcc.h"
void QCC_PR_ParseAsm ( void ) ;
# define MEMBERFIELDNAME "__m%s"
# define STRCMP(s1,s2) (((*s1)!=(*s2)) || strcmp(s1+1,s2+1)) //saves about 2-6 out of 120 - expansion of idea from fastqcc
# define STRNCMP(s1,s2,l) (((*s1)!=(*s2)) || strncmp(s1+1,s2+1,l)) //pathetic saving here.
extern char * compilingfile ;
2004-11-29 21:08:02 +00:00
int conditional ;
2004-08-23 01:38:21 +00:00
2005-03-20 02:57:11 +00:00
//standard qcc keywords
# define keyword_do 1
# define keyword_return 1
# define keyword_if 1
# define keyword_else 1
# define keyword_local 1
# define keyword_while 1
//extended keywords.
2004-08-23 01:38:21 +00:00
pbool keyword_asm ;
pbool keyword_break ;
2005-03-20 02:57:11 +00:00
pbool keyword_case ;
pbool keyword_class ;
2011-11-08 06:00:35 +00:00
pbool keyword_optional ;
2005-03-20 02:57:11 +00:00
pbool keyword_const ; //fixme
2004-08-23 01:38:21 +00:00
pbool keyword_continue ;
2005-03-20 02:57:11 +00:00
pbool keyword_default ;
pbool keyword_entity ; //for skipping the local
pbool keyword_float ; //for skipping the local
pbool keyword_for ;
pbool keyword_goto ;
pbool keyword_int ; //for skipping the local
pbool keyword_integer ; //for skipping the local
2004-08-23 01:38:21 +00:00
pbool keyword_state ;
2005-03-20 02:57:11 +00:00
pbool keyword_string ; //for skipping the local
pbool keyword_struct ;
pbool keyword_switch ;
pbool keyword_thinktime ;
pbool keyword_var ; //allow it to be initialised and set around the place.
pbool keyword_vector ; //for skipping the local
pbool keyword_enum ; //kinda like in c, but typedef not supported.
pbool keyword_enumflags ; //like enum, but doubles instead of adds 1.
pbool keyword_typedef ; //fixme
# define keyword_codesys flag_acc //reacc needs this (forces the resultant crc)
# define keyword_function flag_acc //reacc needs this (reacc has this on all functions, wierd eh?)
# define keyword_objdata flag_acc //reacc needs this (following defs are fields rather than globals, use var to disable)
# define keyword_object flag_acc //reacc needs this (an entity)
# define keyword_pfunc flag_acc //reacc needs this (pointer to function)
# define keyword_system flag_acc //reacc needs this (potatos)
# define keyword_real flag_acc //reacc needs this (a float)
# define keyword_exit flag_acc //emits an OP_DONE opcode.
# define keyword_external flag_acc //reacc needs this (a builtin)
pbool keyword_extern ; //function is external, don't error or warn if the body was not found
pbool keyword_shared ; //mark global to be copied over when progs changes (part of FTE_MULTIPROGS)
pbool keyword_noref ; //nowhere else references this, don't strip it.
pbool keyword_nosave ; //don't write the def to the output.
pbool keyword_union ; //you surly know what a union is!
# define keyword_not 1 //hexenc support needs this, and fteqcc can optimise without it, but it adds an extra token after the if, so it can cause no namespace conflicts
2004-08-23 01:38:21 +00:00
pbool keywords_coexist ; //don't disable a keyword simply because a var was made with the same name.
pbool output_parms ; //emit some PARMX fields. confuses decompilers.
2005-02-09 19:32:30 +00:00
pbool autoprototype ; //take two passes over the source code. First time round doesn't enter and functions or initialise variables.
2007-10-05 17:43:26 +00:00
pbool pr_subscopedlocals ; //causes locals to be valid ONLY within their statement block. (they simply can't be referenced by name outside of it)
2005-02-09 19:32:30 +00:00
pbool flag_ifstring ; //makes if (blah) equivelent to if (blah != "") which resolves some issues in multiprogs situations.
2009-08-29 14:56:42 +00:00
pbool flag_iffloat ; //use an op_if_f instruction instead of op_if so if(-0) evaluates to false.
2005-02-09 19:32:30 +00:00
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.
2005-09-05 23:50:46 +00:00
pbool flag_hashonly ; //Allows use of only #constant for precompiler constants, allows certain preqcc using mods to compile
2005-09-14 04:36:07 +00:00
pbool flag_fasttrackarrays ; //Faster arrays, dynamically detected, activated only in supporting engines.
2009-11-04 21:16:50 +00:00
pbool flag_msvcstyle ; //MSVC style warnings, so msvc's ide works properly
2009-08-29 14:56:42 +00:00
pbool flag_assume_integer ; //5 - is that an integer or a float? qcc says float. but we support int too, so maybe we want that instead?
2010-07-18 10:01:57 +00:00
pbool flag_filetimes ;
2012-01-17 07:57:46 +00:00
pbool flag_typeexplicit ; //no implicit type conversions, you must do the casts yourself.
2004-08-23 01:38:21 +00:00
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.
pbool opt_shortenifnots ; //if(!var) is made an IF rather than NOT IFNOT
pbool opt_noduplicatestrings ; //brute force string check. time consuming but more effective than the equivelent in frikqcc.
pbool opt_constantarithmatic ; //3*5 appears as 15 instead of the extra statement.
pbool opt_nonvec_parms ; //store_f instead of store_v on function calls, where possible.
pbool opt_constant_names ; //take out the defs and name strings of constants.
pbool opt_constant_names_strings ; //removes the defs of strings too. plays havok with multiprogs.
pbool opt_precache_file ; //remove the call, the parameters, everything.
pbool opt_filenames ; //strip filenames. hinders older decompilers.
pbool opt_unreferenced ; //strip defs that are not referenced.
pbool opt_function_names ; //strip out the names of builtin functions.
pbool opt_locals ; //strip out the names of locals and immediates.
pbool opt_dupconstdefs ; //float X = 5; and float Y = 5; occupy the same global with this.
pbool opt_return_only ; //RETURN; DONE; at the end of a function strips out the done statement if there is no way to get to it.
pbool opt_compound_jumps ; //jumps to jump statements jump to the final point.
pbool opt_stripfunctions ; //if a functions is only ever called directly or by exe, don't emit the def.
2013-03-12 22:32:25 +00:00
pbool opt_locals_overlapping ; //make the local vars of all functions occupy the same globals.
2004-08-23 01:38:21 +00:00
pbool opt_logicops ; //don't make conditions enter functions if the return value will be discarded due to a previous value. (C style if statements)
2005-02-28 07:16:19 +00:00
pbool 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).
2005-06-04 04:20:20 +00:00
pbool opt_simplifiedifs ; //if (f != 0) -> if (f). if (f == 0) -> ifnot (f)
2004-08-23 01:38:21 +00:00
//bool opt_comexprremoval;
//these are the results of the opt_. The values are printed out when compilation is compleate, showing effectivness.
int optres_shortenifnots ;
int optres_assignments ;
int optres_overlaptemps ;
int optres_noduplicatestrings ;
int optres_constantarithmatic ;
int optres_nonvec_parms ;
int optres_constant_names ;
int optres_constant_names_strings ;
int optres_precache_file ;
int optres_filenames ;
int optres_unreferenced ;
int optres_function_names ;
int optres_locals ;
int optres_dupconstdefs ;
int optres_return_only ;
int optres_compound_jumps ;
//int optres_comexprremoval;
int optres_stripfunctions ;
2013-03-12 22:32:25 +00:00
int optres_locals_overlapping ;
2004-08-23 01:38:21 +00:00
int optres_logicops ;
int optres_test1 ;
int optres_test2 ;
2010-07-11 10:53:13 +00:00
void * ( * pHash_Get ) ( hashtable_t * table , const char * name ) ;
void * ( * pHash_GetNext ) ( hashtable_t * table , const char * name , void * old ) ;
void * ( * pHash_Add ) ( hashtable_t * table , const char * name , void * data , bucket_t * ) ;
2004-08-23 01:38:21 +00:00
2013-03-12 22:32:25 +00:00
QCC_def_t * QCC_PR_DummyDef ( QCC_type_t * type , char * name , QCC_def_t * scope , int arraysize , unsigned int ofs , int referable , unsigned int flags ) ;
2004-08-23 01:38:21 +00:00
QCC_type_t * QCC_PR_FindType ( QCC_type_t * type ) ;
2004-11-04 04:19:10 +00:00
QCC_type_t * QCC_PR_PointerType ( QCC_type_t * pointsto ) ;
2005-02-09 19:32:30 +00:00
QCC_type_t * QCC_PR_FieldType ( QCC_type_t * pointsto ) ;
------------------------------------------------------------------------
r4169 | acceptthis | 2013-01-17 08:55:12 +0000 (Thu, 17 Jan 2013) | 31 lines
removed MAX_VISEDICTS limit.
PEXT2_REPLACEMENTDELTAS tweaked, now has 4 million entity limit. still not enabled by default.
TE_BEAM now maps to a separate TEQW_BEAM to avoid conflicts with QW.
added android multitouch emulation for windows/rawinput (in_simulatemultitouch).
split topcolor/bottomcolor from scoreboard, for dp's colormap|1024 feature.
now using utf-8 for windows consoles.
qcc warnings/errors now give clickable console links for quick+easy editing.
disabled menutint when the currently active item changes contrast or gamma (for OneManClan).
Added support for drawfont/drawfontscale.
tweaked the qcvm a little to reduce the number of pointers.
.doll file loading. still experimental and will likely crash. requires csqc active, even if its a dummy progs. this will be fixed in time. Still other things that need cleaning up.
windows: gl_font "?" shows the standard windows font-selection dialog, and can be used to select windows fonts. not all work. and you probably don't want to use windings.
fixed splitscreen support when playing mvds. added mini-scoreboards to splitscreen.
editor/debugger now shows asm if there's no linenumber info. also, pressing f1 for help shows the shortcuts.
Added support for .framegroups files for psk(psa) and iqm formats.
True support for ezquake's colour codes. Mutually exclusive with background colours.
path command output slightly more readable.
added support for digest_hex (MD4, SHA1, CRC16).
skingroups now colourmap correctly.
Fix terrain colour hints, and litdata from the wrong bsp.
fix ftp dual-homed issue. support epsv command, and enable ipv6 (eprt still not supported).
remove d3d11 compilation from the makefile. the required headers are not provided by mingw, and are not available to the build bot, so don't bother.
fix v *= v.x and similar opcodes.
fteqcc: fixed support for áéÃóú type chars in names. utf-8 files now properly supported (even with the utf-8 bom/identifier). utf-16 also supported.
fteqcc: fixed '#if 1 == 3 && 4' parsing.
fteqcc: -Werror acts on the warning, rather than as a separate error. Line numbers are thus more readable.
fteqcc: copyright message now includes compile date instead.
fteqccgui: the treeview control is now coloured depending on whether there were warnings/errors in the last compile.
fteqccgui: the output window is now focused and scrolls down as compilation progresses.
pr_dumpplatform command dumps out some pragmas to convert more serious warnings to errors. This is to avoid the infamous 'fteqcc sucks cos my code sucks' issue.
rewrote prespawn/modelist/soundlist code. server tracks progress now.
------------------------------------------------------------------------
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4167 fc73d0e0-1445-4013-8a0c-d673dee63da5
2013-03-12 22:29:40 +00:00
QCC_def_t * QCC_PR_Term ( int exprflags ) ;
QCC_def_t * QCC_PR_GenerateFunctionCall ( QCC_def_t * func , QCC_def_t * arglist [ ] , int argcount ) ;
2013-03-12 22:32:25 +00:00
void QCC_Marshal_Locals ( int firststatement , int laststatement ) ;
2004-08-23 01:38:21 +00:00
void QCC_PR_ParseState ( void ) ;
pbool simplestore ;
2008-11-09 22:29:28 +00:00
pbool expandedemptymacro ;
2004-08-23 01:38:21 +00:00
QCC_pr_info_t pr ;
//QCC_def_t **pr_global_defs/*[MAX_REGS]*/; // to find def for a global variable
//keeps track of how many funcs are called while parsing a statement
//int qcc_functioncalled;
//========================================
QCC_def_t * pr_scope ; // the function being parsed, or NULL
QCC_type_t * pr_classtype ;
pbool pr_dumpasm ;
QCC_string_t s_file , s_file2 ; // filename for function definition
unsigned int locals_start ; // for tracking local variables vs temps
unsigned int locals_end ; // for tracking local variables vs temps
jmp_buf pr_parse_abort ; // longjump with this on parse error
void QCC_PR_ParseDefs ( char * classname ) ;
pbool qcc_usefulstatement ;
2013-03-12 22:32:25 +00:00
pbool debug_armour_defined ;
2004-08-23 01:38:21 +00:00
int max_breaks ;
int max_continues ;
int max_cases ;
int num_continues ;
int num_breaks ;
int num_cases ;
int * pr_breaks ;
int * pr_continues ;
int * pr_cases ;
QCC_def_t * * pr_casesdef ;
QCC_def_t * * pr_casesdef2 ;
typedef struct {
int statementno ;
int lineno ;
char name [ 256 ] ;
} gotooperator_t ;
int max_labels ;
int max_gotos ;
gotooperator_t * pr_labels ;
gotooperator_t * pr_gotos ;
int num_gotos ;
int num_labels ;
QCC_def_t * extra_parms [ MAX_EXTRA_PARMS ] ;
2011-08-16 04:12:15 +00:00
//#define ASSOC_RIGHT_RESULT ASSOC_RIGHT
2004-08-23 01:38:21 +00:00
//========================================
//FIXME: modifiy list so most common GROUPS are first
//use look up table for value of first char and sort by first char and most common...?
//if true, effectivly {b=a; return a;}
QCC_opcode_t pr_opcodes [ ] =
{
{ 6 , " <DONE> " , " DONE " , - 1 , ASSOC_LEFT , & type_void , & type_void , & type_void } ,
{ 6 , " * " , " MUL_F " , 3 , ASSOC_LEFT , & type_float , & type_float , & type_float } ,
{ 6 , " * " , " MUL_V " , 3 , ASSOC_LEFT , & type_vector , & type_vector , & type_float } ,
{ 6 , " * " , " MUL_FV " , 3 , ASSOC_LEFT , & type_float , & type_vector , & type_vector } ,
{ 6 , " * " , " MUL_VF " , 3 , ASSOC_LEFT , & type_vector , & type_float , & type_vector } ,
{ 6 , " / " , " DIV_F " , 3 , ASSOC_LEFT , & type_float , & type_float , & type_float } ,
{ 6 , " + " , " ADD_F " , 4 , ASSOC_LEFT , & type_float , & type_float , & type_float } ,
{ 6 , " + " , " ADD_V " , 4 , ASSOC_LEFT , & type_vector , & type_vector , & type_vector } ,
{ 6 , " - " , " SUB_F " , 4 , ASSOC_LEFT , & type_float , & type_float , & type_float } ,
{ 6 , " - " , " SUB_V " , 4 , ASSOC_LEFT , & type_vector , & type_vector , & type_vector } ,
{ 6 , " == " , " EQ_F " , 5 , ASSOC_LEFT , & type_float , & type_float , & type_float } ,
{ 6 , " == " , " EQ_V " , 5 , ASSOC_LEFT , & type_vector , & type_vector , & type_float } ,
{ 6 , " == " , " EQ_S " , 5 , ASSOC_LEFT , & type_string , & type_string , & type_float } ,
{ 6 , " == " , " EQ_E " , 5 , ASSOC_LEFT , & type_entity , & type_entity , & type_float } ,
{ 6 , " == " , " EQ_FNC " , 5 , ASSOC_LEFT , & type_function , & type_function , & type_float } ,
2011-05-15 13:23:13 +00:00
2004-08-23 01:38:21 +00:00
{ 6 , " != " , " NE_F " , 5 , ASSOC_LEFT , & type_float , & type_float , & type_float } ,
{ 6 , " != " , " NE_V " , 5 , ASSOC_LEFT , & type_vector , & type_vector , & type_float } ,
{ 6 , " != " , " NE_S " , 5 , ASSOC_LEFT , & type_string , & type_string , & type_float } ,
{ 6 , " != " , " NE_E " , 5 , ASSOC_LEFT , & type_entity , & type_entity , & type_float } ,
{ 6 , " != " , " NE_FNC " , 5 , ASSOC_LEFT , & type_function , & type_function , & type_float } ,
2011-05-15 13:23:13 +00:00
2004-08-23 01:38:21 +00:00
{ 6 , " <= " , " LE " , 5 , ASSOC_LEFT , & type_float , & type_float , & type_float } ,
{ 6 , " >= " , " GE " , 5 , ASSOC_LEFT , & type_float , & type_float , & type_float } ,
{ 6 , " < " , " LT " , 5 , ASSOC_LEFT , & type_float , & type_float , & type_float } ,
{ 6 , " > " , " GT " , 5 , ASSOC_LEFT , & type_float , & type_float , & type_float } ,
{ 6 , " . " , " INDIRECT_F " , 1 , ASSOC_LEFT , & type_entity , & type_field , & type_float } ,
{ 6 , " . " , " INDIRECT_V " , 1 , ASSOC_LEFT , & type_entity , & type_field , & type_vector } ,
{ 6 , " . " , " INDIRECT_S " , 1 , ASSOC_LEFT , & type_entity , & type_field , & type_string } ,
{ 6 , " . " , " INDIRECT_E " , 1 , ASSOC_LEFT , & type_entity , & type_field , & type_entity } ,
{ 6 , " . " , " INDIRECT_FI " , 1 , ASSOC_LEFT , & type_entity , & type_field , & type_field } ,
{ 6 , " . " , " INDIRECT_FU " , 1 , ASSOC_LEFT , & type_entity , & type_field , & type_function } ,
{ 6 , " . " , " ADDRESS " , 1 , ASSOC_LEFT , & type_entity , & type_field , & type_pointer } ,
{ 6 , " = " , " STORE_F " , 6 , ASSOC_RIGHT , & type_float , & type_float , & type_float } ,
{ 6 , " = " , " STORE_V " , 6 , ASSOC_RIGHT , & type_vector , & type_vector , & type_vector } ,
{ 6 , " = " , " STORE_S " , 6 , ASSOC_RIGHT , & type_string , & type_string , & type_string } ,
{ 6 , " = " , " STORE_ENT " , 6 , ASSOC_RIGHT , & type_entity , & type_entity , & type_entity } ,
{ 6 , " = " , " STORE_FLD " , 6 , ASSOC_RIGHT , & type_field , & type_field , & type_field } ,
{ 6 , " = " , " STORE_FNC " , 6 , ASSOC_RIGHT , & type_function , & type_function , & type_function } ,
{ 6 , " = " , " STOREP_F " , 6 , ASSOC_RIGHT , & type_pointer , & type_float , & type_float } ,
{ 6 , " = " , " STOREP_V " , 6 , ASSOC_RIGHT , & type_pointer , & type_vector , & type_vector } ,
{ 6 , " = " , " STOREP_S " , 6 , ASSOC_RIGHT , & type_pointer , & type_string , & type_string } ,
{ 6 , " = " , " STOREP_ENT " , 6 , ASSOC_RIGHT , & type_pointer , & type_entity , & type_entity } ,
{ 6 , " = " , " STOREP_FLD " , 6 , ASSOC_RIGHT , & type_pointer , & type_field , & type_field } ,
{ 6 , " = " , " STOREP_FNC " , 6 , ASSOC_RIGHT , & type_pointer , & type_function , & type_function } ,
{ 6 , " <RETURN> " , " RETURN " , - 1 , ASSOC_LEFT , & type_float , & type_void , & type_void } ,
2011-05-15 13:23:13 +00:00
2004-08-23 01:38:21 +00:00
{ 6 , " ! " , " NOT_F " , - 1 , ASSOC_LEFT , & type_float , & type_void , & type_float } ,
{ 6 , " ! " , " NOT_V " , - 1 , ASSOC_LEFT , & type_vector , & type_void , & type_float } ,
{ 6 , " ! " , " NOT_S " , - 1 , ASSOC_LEFT , & type_vector , & type_void , & type_float } ,
{ 6 , " ! " , " NOT_ENT " , - 1 , ASSOC_LEFT , & type_entity , & type_void , & type_float } ,
{ 6 , " ! " , " NOT_FNC " , - 1 , ASSOC_LEFT , & type_function , & type_void , & type_float } ,
2011-05-15 13:23:13 +00:00
2004-08-23 01:38:21 +00:00
{ 6 , " <IF> " , " IF " , - 1 , ASSOC_RIGHT , & type_float , NULL , & type_void } ,
{ 6 , " <IFNOT> " , " IFNOT " , - 1 , ASSOC_RIGHT , & type_float , NULL , & type_void } ,
2011-05-15 13:23:13 +00:00
2004-08-23 01:38:21 +00:00
// calls returns REG_RETURN
{ 6 , " <CALL0> " , " CALL0 " , - 1 , ASSOC_LEFT , & type_function , & type_void , & type_void } ,
{ 6 , " <CALL1> " , " CALL1 " , - 1 , ASSOC_LEFT , & type_function , & type_void , & type_void } ,
2011-05-15 13:23:13 +00:00
{ 6 , " <CALL2> " , " CALL2 " , - 1 , ASSOC_LEFT , & type_function , & type_void , & type_void } ,
{ 6 , " <CALL3> " , " CALL3 " , - 1 , ASSOC_LEFT , & type_function , & type_void , & type_void } ,
2004-08-23 01:38:21 +00:00
{ 6 , " <CALL4> " , " CALL4 " , - 1 , ASSOC_LEFT , & type_function , & type_void , & type_void } ,
{ 6 , " <CALL5> " , " CALL5 " , - 1 , ASSOC_LEFT , & type_function , & type_void , & type_void } ,
{ 6 , " <CALL6> " , " CALL6 " , - 1 , ASSOC_LEFT , & type_function , & type_void , & type_void } ,
{ 6 , " <CALL7> " , " CALL7 " , - 1 , ASSOC_LEFT , & type_function , & type_void , & type_void } ,
{ 6 , " <CALL8> " , " CALL8 " , - 1 , ASSOC_LEFT , & type_function , & type_void , & type_void } ,
2011-05-15 13:23:13 +00:00
2004-08-23 01:38:21 +00:00
{ 6 , " <STATE> " , " STATE " , - 1 , ASSOC_LEFT , & type_float , & type_float , & type_void } ,
2011-05-15 13:23:13 +00:00
2004-08-23 01:38:21 +00:00
{ 6 , " <GOTO> " , " GOTO " , - 1 , ASSOC_RIGHT , NULL , & type_void , & type_void } ,
2011-05-15 13:23:13 +00:00
2004-08-23 01:38:21 +00:00
{ 6 , " && " , " AND " , 7 , ASSOC_LEFT , & type_float , & type_float , & type_float } ,
{ 6 , " || " , " OR " , 7 , ASSOC_LEFT , & type_float , & type_float , & type_float } ,
{ 6 , " & " , " BITAND " , 3 , ASSOC_LEFT , & type_float , & type_float , & type_float } ,
{ 6 , " | " , " BITOR " , 3 , ASSOC_LEFT , & type_float , & type_float , & type_float } ,
//version 6 are in normal progs.
//these are hexen2
{ 7 , " *= " , " MULSTORE_F " , 6 , ASSOC_RIGHT_RESULT , & type_float , & type_float , & type_float } ,
2012-01-17 07:57:46 +00:00
{ 7 , " *= " , " MULSTORE_VF " , 6 , ASSOC_RIGHT_RESULT , & type_vector , & type_float , & type_vector } ,
2004-08-23 01:38:21 +00:00
{ 7 , " *= " , " MULSTOREP_F " , 6 , ASSOC_RIGHT_RESULT , & type_pointer , & type_float , & type_float } ,
2012-01-17 07:57:46 +00:00
{ 7 , " *= " , " MULSTOREP_VF " , 6 , ASSOC_RIGHT_RESULT , & type_pointer , & type_float , & type_vector } ,
2004-08-23 01:38:21 +00:00
{ 7 , " /= " , " DIVSTORE_F " , 6 , ASSOC_RIGHT_RESULT , & type_float , & type_float , & type_float } ,
{ 7 , " /= " , " DIVSTOREP_F " , 6 , ASSOC_RIGHT_RESULT , & type_pointer , & type_float , & type_float } ,
{ 7 , " += " , " ADDSTORE_F " , 6 , ASSOC_RIGHT_RESULT , & type_float , & type_float , & type_float } ,
{ 7 , " += " , " ADDSTORE_V " , 6 , ASSOC_RIGHT_RESULT , & type_vector , & type_vector , & type_vector } ,
{ 7 , " += " , " ADDSTOREP_F " , 6 , ASSOC_RIGHT_RESULT , & type_pointer , & type_float , & type_float } ,
{ 7 , " += " , " ADDSTOREP_V " , 6 , ASSOC_RIGHT_RESULT , & type_pointer , & type_vector , & type_vector } ,
{ 7 , " -= " , " SUBSTORE_F " , 6 , ASSOC_RIGHT_RESULT , & type_float , & type_float , & type_float } ,
{ 7 , " -= " , " SUBSTORE_V " , 6 , ASSOC_RIGHT_RESULT , & type_vector , & type_vector , & type_vector } ,
{ 7 , " -= " , " SUBSTOREP_F " , 6 , ASSOC_RIGHT_RESULT , & type_pointer , & type_float , & type_float } ,
{ 7 , " -= " , " SUBSTOREP_V " , 6 , ASSOC_RIGHT_RESULT , & type_pointer , & type_vector , & type_vector } ,
{ 7 , " <FETCH_GBL_F> " , " FETCH_GBL_F " , - 1 , ASSOC_LEFT , & type_float , & type_float , & type_float } ,
{ 7 , " <FETCH_GBL_V> " , " FETCH_GBL_V " , - 1 , ASSOC_LEFT , & type_vector , & type_float , & type_vector } ,
{ 7 , " <FETCH_GBL_S> " , " FETCH_GBL_S " , - 1 , ASSOC_LEFT , & type_string , & type_float , & type_string } ,
{ 7 , " <FETCH_GBL_E> " , " FETCH_GBL_E " , - 1 , ASSOC_LEFT , & type_entity , & type_float , & type_entity } ,
{ 7 , " <FETCH_GBL_FNC> " , " FETCH_GBL_FNC " , - 1 , ASSOC_LEFT , & type_function , & type_float , & type_function } ,
{ 7 , " <CSTATE> " , " CSTATE " , - 1 , ASSOC_LEFT , & type_float , & type_float , & type_void } ,
{ 7 , " <CWSTATE> " , " CWSTATE " , - 1 , ASSOC_LEFT , & type_float , & type_float , & type_void } ,
{ 7 , " <THINKTIME> " , " THINKTIME " , - 1 , ASSOC_LEFT , & type_entity , & type_float , & type_void } ,
2005-06-14 04:52:10 +00:00
{ 7 , " |= " , " BITSET_F " , 6 , ASSOC_RIGHT , & type_float , & type_float , & type_float } ,
{ 7 , " |= " , " BITSETP_F " , 6 , ASSOC_RIGHT , & type_pointer , & type_float , & type_float } ,
2008-11-09 22:29:28 +00:00
{ 7 , " &~= " , " BITCLR_F " , 6 , ASSOC_RIGHT , & type_float , & type_float , & type_float } ,
{ 7 , " &~= " , " BITCLRP_F " , 6 , ASSOC_RIGHT , & type_pointer , & type_float , & type_float } ,
2004-08-23 01:38:21 +00:00
{ 7 , " <RAND0> " , " RAND0 " , - 1 , ASSOC_LEFT , & type_void , & type_void , & type_float } ,
{ 7 , " <RAND1> " , " RAND1 " , - 1 , ASSOC_LEFT , & type_float , & type_void , & type_float } ,
{ 7 , " <RAND2> " , " RAND2 " , - 1 , ASSOC_LEFT , & type_float , & type_float , & type_float } ,
{ 7 , " <RANDV0> " , " RANDV0 " , - 1 , ASSOC_LEFT , & type_void , & type_void , & type_vector } ,
{ 7 , " <RANDV1> " , " RANDV1 " , - 1 , ASSOC_LEFT , & type_vector , & type_void , & type_vector } ,
{ 7 , " <RANDV2> " , " RANDV2 " , - 1 , ASSOC_LEFT , & type_vector , & type_vector , & type_vector } ,
2013-03-12 22:32:25 +00:00
{ 7 , " <SWITCH_F> " , " SWITCH_F " , - 1 , ASSOC_RIGHT , & type_void , NULL , & type_void } ,
{ 7 , " <SWITCH_V> " , " SWITCH_V " , - 1 , ASSOC_RIGHT , & type_void , NULL , & type_void } ,
{ 7 , " <SWITCH_S> " , " SWITCH_S " , - 1 , ASSOC_RIGHT , & type_void , NULL , & type_void } ,
{ 7 , " <SWITCH_E> " , " SWITCH_E " , - 1 , ASSOC_RIGHT , & type_void , NULL , & type_void } ,
{ 7 , " <SWITCH_FNC> " , " SWITCH_FNC " , - 1 , ASSOC_RIGHT , & type_void , NULL , & type_void } ,
2004-08-23 01:38:21 +00:00
2013-03-12 22:32:25 +00:00
{ 7 , " <CASE> " , " CASE " , - 1 , ASSOC_RIGHT , & type_void , NULL , & type_void } ,
{ 7 , " <CASERANGE> " , " CASERANGE " , - 1 , ASSOC_RIGHT , & type_void , & type_void , NULL } ,
2004-08-23 01:38:21 +00:00
//Later are additions by DMW.
{ 7 , " <CALL1H> " , " CALL1H " , - 1 , ASSOC_LEFT , & type_function , & type_vector , & type_void } ,
2011-05-15 13:23:13 +00:00
{ 7 , " <CALL2H> " , " CALL2H " , - 1 , ASSOC_LEFT , & type_function , & type_vector , & type_vector } ,
{ 7 , " <CALL3H> " , " CALL3H " , - 1 , ASSOC_LEFT , & type_function , & type_vector , & type_vector } ,
2004-08-23 01:38:21 +00:00
{ 7 , " <CALL4H> " , " CALL4H " , - 1 , ASSOC_LEFT , & type_function , & type_vector , & type_vector } ,
{ 7 , " <CALL5H> " , " CALL5H " , - 1 , ASSOC_LEFT , & type_function , & type_vector , & type_vector } ,
{ 7 , " <CALL6H> " , " CALL6H " , - 1 , ASSOC_LEFT , & type_function , & type_vector , & type_vector } ,
{ 7 , " <CALL7H> " , " CALL7H " , - 1 , ASSOC_LEFT , & type_function , & type_vector , & type_vector } ,
{ 7 , " <CALL8H> " , " CALL8H " , - 1 , ASSOC_LEFT , & type_function , & type_vector , & type_vector } ,
{ 7 , " = " , " STORE_I " , 6 , ASSOC_RIGHT , & type_integer , & type_integer , & type_integer } ,
2011-09-03 03:49:43 +00:00
{ 7 , " = " , " STORE_IF " , 6 , ASSOC_RIGHT , & type_float , & type_integer , & type_integer } ,
{ 7 , " = " , " STORE_FI " , 6 , ASSOC_RIGHT , & type_integer , & type_float , & type_float } ,
2004-08-23 01:38:21 +00:00
{ 7 , " + " , " ADD_I " , 4 , ASSOC_LEFT , & type_integer , & type_integer , & type_integer } ,
{ 7 , " + " , " ADD_FI " , 4 , ASSOC_LEFT , & type_float , & type_integer , & type_float } ,
{ 7 , " + " , " ADD_IF " , 4 , ASSOC_LEFT , & type_integer , & type_float , & type_float } ,
2011-05-15 13:23:13 +00:00
2004-08-23 01:38:21 +00:00
{ 7 , " - " , " SUB_I " , 4 , ASSOC_LEFT , & type_integer , & type_integer , & type_integer } ,
{ 7 , " - " , " SUB_FI " , 4 , ASSOC_LEFT , & type_float , & type_integer , & type_float } ,
{ 7 , " - " , " SUB_IF " , 4 , ASSOC_LEFT , & type_integer , & type_float , & type_float } ,
{ 7 , " <CIF> " , " C_ITOF " , - 1 , ASSOC_LEFT , & type_integer , & type_void , & type_float } ,
{ 7 , " <CFI> " , " C_FTOI " , - 1 , ASSOC_LEFT , & type_float , & type_void , & type_integer } ,
{ 7 , " <CPIF> " , " CP_ITOF " , - 1 , ASSOC_LEFT , & type_pointer , & type_integer , & type_float } ,
{ 7 , " <CPFI> " , " CP_FTOI " , - 1 , ASSOC_LEFT , & type_pointer , & type_float , & type_integer } ,
{ 7 , " . " , " INDIRECT " , 1 , ASSOC_LEFT , & type_entity , & type_field , & type_integer } ,
{ 7 , " = " , " STOREP_I " , 6 , ASSOC_RIGHT , & type_pointer , & type_integer , & type_integer } ,
{ 7 , " = " , " STOREP_IF " , 6 , ASSOC_RIGHT , & type_pointer , & type_float , & type_integer } ,
{ 7 , " = " , " STOREP_FI " , 6 , ASSOC_RIGHT , & type_pointer , & type_integer , & type_float } ,
{ 7 , " & " , " BITAND_I " , 3 , ASSOC_LEFT , & type_integer , & type_integer , & type_integer } ,
{ 7 , " | " , " BITOR_I " , 3 , ASSOC_LEFT , & type_integer , & type_integer , & type_integer } ,
{ 7 , " * " , " MUL_I " , 3 , ASSOC_LEFT , & type_integer , & type_integer , & type_integer } ,
{ 7 , " / " , " DIV_I " , 3 , ASSOC_LEFT , & type_integer , & type_integer , & type_integer } ,
{ 7 , " == " , " EQ_I " , 5 , ASSOC_LEFT , & type_integer , & type_integer , & type_integer } ,
{ 7 , " != " , " NE_I " , 5 , ASSOC_LEFT , & type_integer , & type_integer , & type_integer } ,
{ 7 , " <IFNOTS> " , " IFNOTS " , - 1 , ASSOC_RIGHT , & type_string , NULL , & type_void } ,
{ 7 , " <IFS> " , " IFS " , - 1 , ASSOC_RIGHT , & type_string , NULL , & type_void } ,
{ 7 , " ! " , " NOT_I " , - 1 , ASSOC_LEFT , & type_integer , & type_void , & type_integer } ,
{ 7 , " / " , " DIV_VF " , 3 , ASSOC_LEFT , & type_vector , & type_float , & type_float } ,
2008-11-09 22:29:28 +00:00
{ 7 , " ^ " , " XOR_I " , 3 , ASSOC_LEFT , & type_integer , & type_integer , & type_integer } ,
2004-08-23 01:38:21 +00:00
{ 7 , " >> " , " RSHIFT_I " , 3 , ASSOC_LEFT , & type_integer , & type_integer , & type_integer } ,
{ 7 , " << " , " LSHIFT_I " , 3 , ASSOC_LEFT , & type_integer , & type_integer , & type_integer } ,
//var, offset return
2004-11-04 04:19:10 +00:00
{ 7 , " <ARRAY> " , " GET_POINTER " , - 1 , ASSOC_LEFT , & type_float , & type_integer , & type_pointer } ,
2011-10-03 02:45:44 +00:00
{ 7 , " <ARRAY> " , " MUL4ADD_I " , - 1 , ASSOC_LEFT , & type_pointer , & type_integer , & type_pointer } ,
2004-08-23 01:38:21 +00:00
{ 7 , " = " , " LOADA_F " , 6 , ASSOC_LEFT , & type_float , & type_integer , & type_float } ,
{ 7 , " = " , " LOADA_V " , 6 , ASSOC_LEFT , & type_vector , & type_integer , & type_vector } ,
{ 7 , " = " , " LOADA_S " , 6 , ASSOC_LEFT , & type_string , & type_integer , & type_string } ,
{ 7 , " = " , " LOADA_ENT " , 6 , ASSOC_LEFT , & type_entity , & type_integer , & type_entity } ,
{ 7 , " = " , " LOADA_FLD " , 6 , ASSOC_LEFT , & type_field , & type_integer , & type_field } ,
{ 7 , " = " , " LOADA_FNC " , 6 , ASSOC_LEFT , & type_function , & type_integer , & type_function } ,
{ 7 , " = " , " LOADA_I " , 6 , ASSOC_LEFT , & type_integer , & type_integer , & type_integer } ,
2004-11-04 04:19:10 +00:00
{ 7 , " = " , " STORE_P " , 6 , ASSOC_RIGHT , & type_pointer , & type_pointer , & type_void } ,
2004-08-23 01:38:21 +00:00
{ 7 , " . " , " INDIRECT_P " , 1 , ASSOC_LEFT , & type_entity , & type_field , & type_pointer } ,
{ 7 , " = " , " LOADP_F " , 6 , ASSOC_LEFT , & type_pointer , & type_integer , & type_float } ,
{ 7 , " = " , " LOADP_V " , 6 , ASSOC_LEFT , & type_pointer , & type_integer , & type_vector } ,
{ 7 , " = " , " LOADP_S " , 6 , ASSOC_LEFT , & type_pointer , & type_integer , & type_string } ,
{ 7 , " = " , " LOADP_ENT " , 6 , ASSOC_LEFT , & type_pointer , & type_integer , & type_entity } ,
{ 7 , " = " , " LOADP_FLD " , 6 , ASSOC_LEFT , & type_pointer , & type_integer , & type_field } ,
{ 7 , " = " , " LOADP_FNC " , 6 , ASSOC_LEFT , & type_pointer , & type_integer , & type_function } ,
{ 7 , " = " , " LOADP_I " , 6 , ASSOC_LEFT , & type_pointer , & type_integer , & type_integer } ,
{ 7 , " <= " , " LE_I " , 5 , ASSOC_LEFT , & type_integer , & type_integer , & type_integer } ,
{ 7 , " >= " , " GE_I " , 5 , ASSOC_LEFT , & type_integer , & type_integer , & type_integer } ,
{ 7 , " < " , " LT_I " , 5 , ASSOC_LEFT , & type_integer , & type_integer , & type_integer } ,
{ 7 , " > " , " GT_I " , 5 , ASSOC_LEFT , & type_integer , & type_integer , & type_integer } ,
{ 7 , " <= " , " LE_IF " , 5 , ASSOC_LEFT , & type_integer , & type_float , & type_integer } ,
{ 7 , " >= " , " GE_IF " , 5 , ASSOC_LEFT , & type_integer , & type_float , & type_integer } ,
{ 7 , " < " , " LT_IF " , 5 , ASSOC_LEFT , & type_integer , & type_float , & type_integer } ,
{ 7 , " > " , " GT_IF " , 5 , ASSOC_LEFT , & type_integer , & type_float , & type_integer } ,
{ 7 , " <= " , " LE_FI " , 5 , ASSOC_LEFT , & type_float , & type_integer , & type_integer } ,
{ 7 , " >= " , " GE_FI " , 5 , ASSOC_LEFT , & type_float , & type_integer , & type_integer } ,
{ 7 , " < " , " LT_FI " , 5 , ASSOC_LEFT , & type_float , & type_integer , & type_integer } ,
{ 7 , " > " , " GT_FI " , 5 , ASSOC_LEFT , & type_float , & type_integer , & type_integer } ,
{ 7 , " == " , " EQ_IF " , 5 , ASSOC_LEFT , & type_integer , & type_float , & type_integer } ,
{ 7 , " == " , " EQ_FI " , 5 , ASSOC_LEFT , & type_float , & type_integer , & type_float } ,
//-------------------------------------
//string manipulation.
{ 7 , " + " , " ADD_SF " , 4 , ASSOC_LEFT , & type_string , & type_float , & type_string } ,
{ 7 , " - " , " SUB_S " , 4 , ASSOC_LEFT , & type_string , & type_string , & type_float } ,
{ 7 , " <STOREP_C> " , " STOREP_C " , 1 , ASSOC_RIGHT , & type_string , & type_float , & type_float } ,
------------------------------------------------------------------------
r4169 | acceptthis | 2013-01-17 08:55:12 +0000 (Thu, 17 Jan 2013) | 31 lines
removed MAX_VISEDICTS limit.
PEXT2_REPLACEMENTDELTAS tweaked, now has 4 million entity limit. still not enabled by default.
TE_BEAM now maps to a separate TEQW_BEAM to avoid conflicts with QW.
added android multitouch emulation for windows/rawinput (in_simulatemultitouch).
split topcolor/bottomcolor from scoreboard, for dp's colormap|1024 feature.
now using utf-8 for windows consoles.
qcc warnings/errors now give clickable console links for quick+easy editing.
disabled menutint when the currently active item changes contrast or gamma (for OneManClan).
Added support for drawfont/drawfontscale.
tweaked the qcvm a little to reduce the number of pointers.
.doll file loading. still experimental and will likely crash. requires csqc active, even if its a dummy progs. this will be fixed in time. Still other things that need cleaning up.
windows: gl_font "?" shows the standard windows font-selection dialog, and can be used to select windows fonts. not all work. and you probably don't want to use windings.
fixed splitscreen support when playing mvds. added mini-scoreboards to splitscreen.
editor/debugger now shows asm if there's no linenumber info. also, pressing f1 for help shows the shortcuts.
Added support for .framegroups files for psk(psa) and iqm formats.
True support for ezquake's colour codes. Mutually exclusive with background colours.
path command output slightly more readable.
added support for digest_hex (MD4, SHA1, CRC16).
skingroups now colourmap correctly.
Fix terrain colour hints, and litdata from the wrong bsp.
fix ftp dual-homed issue. support epsv command, and enable ipv6 (eprt still not supported).
remove d3d11 compilation from the makefile. the required headers are not provided by mingw, and are not available to the build bot, so don't bother.
fix v *= v.x and similar opcodes.
fteqcc: fixed support for áéÃóú type chars in names. utf-8 files now properly supported (even with the utf-8 bom/identifier). utf-16 also supported.
fteqcc: fixed '#if 1 == 3 && 4' parsing.
fteqcc: -Werror acts on the warning, rather than as a separate error. Line numbers are thus more readable.
fteqcc: copyright message now includes compile date instead.
fteqccgui: the treeview control is now coloured depending on whether there were warnings/errors in the last compile.
fteqccgui: the output window is now focused and scrolls down as compilation progresses.
pr_dumpplatform command dumps out some pragmas to convert more serious warnings to errors. This is to avoid the infamous 'fteqcc sucks cos my code sucks' issue.
rewrote prespawn/modelist/soundlist code. server tracks progress now.
------------------------------------------------------------------------
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4167 fc73d0e0-1445-4013-8a0c-d673dee63da5
2013-03-12 22:29:40 +00:00
{ 7 , " <LOADP_C> " , " LOADP_C " , 1 , ASSOC_LEFT , & type_string , & type_float , & type_float } ,
2004-08-23 01:38:21 +00:00
//-------------------------------------
{ 7 , " * " , " MUL_IF " , 5 , ASSOC_LEFT , & type_integer , & type_float , & type_integer } ,
{ 7 , " * " , " MUL_FI " , 5 , ASSOC_LEFT , & type_float , & type_integer , & type_float } ,
{ 7 , " * " , " MUL_VI " , 5 , ASSOC_LEFT , & type_vector , & type_integer , & type_vector } ,
{ 7 , " * " , " MUL_IV " , 5 , ASSOC_LEFT , & type_integer , & type_vector , & type_vector } ,
{ 7 , " / " , " DIV_IF " , 5 , ASSOC_LEFT , & type_integer , & type_float , & type_integer } ,
{ 7 , " / " , " DIV_FI " , 5 , ASSOC_LEFT , & type_float , & type_integer , & type_float } ,
{ 7 , " & " , " BITAND_IF " , 5 , ASSOC_LEFT , & type_integer , & type_float , & type_integer } ,
{ 7 , " | " , " BITOR_IF " , 5 , ASSOC_LEFT , & type_integer , & type_float , & type_integer } ,
{ 7 , " & " , " BITAND_FI " , 5 , ASSOC_LEFT , & type_float , & type_integer , & type_float } ,
{ 7 , " | " , " BITOR_FI " , 5 , ASSOC_LEFT , & type_float , & type_integer , & type_float } ,
2009-08-29 14:56:42 +00:00
{ 7 , " && " , " AND_I " , 7 , ASSOC_LEFT , & type_integer , & type_integer , & type_integer } ,
{ 7 , " || " , " OR_I " , 7 , ASSOC_LEFT , & type_integer , & type_integer , & type_integer } ,
{ 7 , " && " , " AND_IF " , 7 , ASSOC_LEFT , & type_integer , & type_float , & type_integer } ,
{ 7 , " || " , " OR_IF " , 7 , ASSOC_LEFT , & type_integer , & type_float , & type_integer } ,
2009-08-29 15:07:08 +00:00
{ 7 , " && " , " AND_FI " , 7 , ASSOC_LEFT , & type_float , & type_integer , & type_integer } ,
{ 7 , " || " , " OR_FI " , 7 , ASSOC_LEFT , & type_float , & type_integer , & type_integer } ,
2004-08-23 01:38:21 +00:00
{ 7 , " != " , " NE_IF " , 5 , ASSOC_LEFT , & type_integer , & type_float , & type_integer } ,
2009-08-29 15:07:08 +00:00
{ 7 , " != " , " NE_FI " , 5 , ASSOC_LEFT , & type_float , & type_float , & type_integer } ,
2004-08-23 01:38:21 +00:00
2011-05-15 13:23:13 +00:00
2004-08-23 01:38:21 +00:00
2004-11-04 04:19:10 +00:00
2005-02-28 07:16:19 +00:00
{ 7 , " <> " , " GSTOREP_I " , - 1 , ASSOC_LEFT , & type_float , & type_float , & type_float } ,
{ 7 , " <> " , " GSTOREP_F " , - 1 , ASSOC_LEFT , & type_float , & type_float , & type_float } ,
{ 7 , " <> " , " GSTOREP_ENT " , - 1 , ASSOC_LEFT , & type_float , & type_float , & type_float } ,
{ 7 , " <> " , " GSTOREP_FLD " , - 1 , ASSOC_LEFT , & type_float , & type_float , & type_float } ,
{ 7 , " <> " , " GSTOREP_S " , - 1 , ASSOC_LEFT , & type_float , & type_float , & type_float } ,
2008-11-09 22:29:28 +00:00
{ 7 , " <> " , " GSTOREP_FNC " , - 1 , ASSOC_LEFT , & type_float , & type_float , & type_float } ,
2005-02-28 07:16:19 +00:00
{ 7 , " <> " , " GSTOREP_V " , - 1 , ASSOC_LEFT , & type_float , & type_float , & type_float } ,
2004-11-04 04:19:10 +00:00
2005-02-28 07:16:19 +00:00
{ 7 , " <> " , " GADDRESS " , - 1 , ASSOC_LEFT , & type_float , & type_float , & type_float } ,
2004-11-04 04:19:10 +00:00
2005-06-14 04:52:10 +00:00
{ 7 , " <> " , " GLOAD_I " , - 1 , ASSOC_LEFT , & type_float , & type_float , & type_float } ,
{ 7 , " <> " , " GLOAD_F " , - 1 , ASSOC_LEFT , & type_float , & type_float , & type_float } ,
{ 7 , " <> " , " GLOAD_FLD " , - 1 , ASSOC_LEFT , & type_float , & type_float , & type_float } ,
{ 7 , " <> " , " GLOAD_ENT " , - 1 , ASSOC_LEFT , & type_float , & type_float , & type_float } ,
{ 7 , " <> " , " GLOAD_S " , - 1 , ASSOC_LEFT , & type_float , & type_float , & type_float } ,
{ 7 , " <> " , " GLOAD_FNC " , - 1 , ASSOC_LEFT , & type_float , & type_float , & type_float } ,
2011-10-03 02:45:44 +00:00
{ 7 , " <> " , " BOUNDCHECK " , - 1 , ASSOC_LEFT , & type_integer , NULL , NULL } ,
2005-06-14 04:52:10 +00:00
2012-02-13 09:24:01 +00:00
{ 7 , " <UNUSED> " , " UNUSED " , 6 , ASSOC_RIGHT , & type_void , & type_void , & type_void } ,
2005-06-14 04:52:10 +00:00
{ 7 , " <PUSH> " , " PUSH " , - 1 , ASSOC_RIGHT , & type_float , & type_void , & type_pointer } ,
{ 7 , " <POP> " , " POP " , - 1 , ASSOC_RIGHT , & type_float , & type_void , & type_void } ,
2008-11-09 22:29:28 +00:00
{ 7 , " <SWITCH_I> " , " SWITCH_I " , - 1 , ASSOC_LEFT , & type_void , NULL , & type_void } ,
{ 7 , " <> " , " GLOAD_S " , - 1 , ASSOC_LEFT , & type_float , & type_float , & type_float } ,
2009-08-29 14:56:42 +00:00
{ 6 , " <IF_F> " , " IF_F " , - 1 , ASSOC_RIGHT , & type_float , NULL , & type_void } ,
{ 6 , " <IFNOT_F> " , " IFNOT_F " , - 1 , ASSOC_RIGHT , & type_float , NULL , & type_void } ,
2008-11-09 22:29:28 +00:00
/* emulated ops begin here */
{ 7 , " <> " , " OP_EMULATED " , - 1 , ASSOC_LEFT , & type_float , & type_float , & type_float } ,
2005-06-14 04:52:10 +00:00
{ 7 , " |= " , " BITSET_I " , 6 , ASSOC_RIGHT , & type_integer , & type_integer , & type_integer } ,
{ 7 , " |= " , " BITSETP_I " , 6 , ASSOC_RIGHT , & type_pointer , & type_integer , & type_integer } ,
2008-11-09 22:29:28 +00:00
2005-06-14 04:52:10 +00:00
{ 7 , " *= " , " MULSTORE_I " , 6 , ASSOC_RIGHT_RESULT , & type_integer , & type_integer , & type_integer } ,
{ 7 , " /= " , " DIVSTORE_I " , 6 , ASSOC_RIGHT_RESULT , & type_integer , & type_integer , & type_integer } ,
{ 7 , " += " , " ADDSTORE_I " , 6 , ASSOC_RIGHT_RESULT , & type_integer , & type_integer , & type_integer } ,
{ 7 , " -= " , " SUBSTORE_I " , 6 , ASSOC_RIGHT_RESULT , & type_integer , & type_integer , & type_integer } ,
2008-11-09 22:29:28 +00:00
{ 7 , " *= " , " MULSTOREP_I " , 6 , ASSOC_RIGHT_RESULT , & type_pointer , & type_integer , & type_integer } ,
{ 7 , " /= " , " DIVSTOREP_I " , 6 , ASSOC_RIGHT_RESULT , & type_pointer , & type_integer , & type_integer } ,
{ 7 , " += " , " ADDSTOREP_I " , 6 , ASSOC_RIGHT_RESULT , & type_pointer , & type_integer , & type_integer } ,
{ 7 , " -= " , " SUBSTOREP_I " , 6 , ASSOC_RIGHT_RESULT , & type_pointer , & type_integer , & type_integer } ,
2012-01-17 07:57:46 +00:00
{ 7 , " *= " , " MULSTORE_IF " , 6 , ASSOC_RIGHT_RESULT , & type_integer , & type_float , & type_float } ,
{ 7 , " *= " , " MULSTOREP_IF " , 6 , ASSOC_RIGHT_RESULT , & type_intpointer , & type_float , & type_float } ,
{ 7 , " /= " , " DIVSTORE_IF " , 6 , ASSOC_RIGHT_RESULT , & type_integer , & type_float , & type_float } ,
{ 7 , " /= " , " DIVSTOREP_IF " , 6 , ASSOC_RIGHT_RESULT , & type_intpointer , & type_float , & type_float } ,
{ 7 , " += " , " ADDSTORE_IF " , 6 , ASSOC_RIGHT_RESULT , & type_integer , & type_float , & type_float } ,
{ 7 , " += " , " ADDSTOREP_IF " , 6 , ASSOC_RIGHT_RESULT , & type_intpointer , & type_float , & type_float } ,
{ 7 , " -= " , " SUBSTORE_IF " , 6 , ASSOC_RIGHT_RESULT , & type_integer , & type_float , & type_float } ,
{ 7 , " -= " , " SUBSTOREP_IF " , 6 , ASSOC_RIGHT_RESULT , & type_intpointer , & type_float , & type_float } ,
{ 7 , " *= " , " MULSTORE_FI " , 6 , ASSOC_RIGHT_RESULT , & type_float , & type_integer , & type_float } ,
{ 7 , " *= " , " MULSTOREP_FI " , 6 , ASSOC_RIGHT_RESULT , & type_floatpointer , & type_integer , & type_float } ,
{ 7 , " /= " , " DIVSTORE_FI " , 6 , ASSOC_RIGHT_RESULT , & type_float , & type_integer , & type_float } ,
{ 7 , " /= " , " DIVSTOREP_FI " , 6 , ASSOC_RIGHT_RESULT , & type_floatpointer , & type_integer , & type_float } ,
{ 7 , " += " , " ADDSTORE_FI " , 6 , ASSOC_RIGHT_RESULT , & type_float , & type_integer , & type_float } ,
{ 7 , " += " , " ADDSTOREP_FI " , 6 , ASSOC_RIGHT_RESULT , & type_floatpointer , & type_integer , & type_float } ,
{ 7 , " -= " , " SUBSTORE_FI " , 6 , ASSOC_RIGHT_RESULT , & type_float , & type_integer , & type_float } ,
{ 7 , " -= " , " SUBSTOREP_FI " , 6 , ASSOC_RIGHT_RESULT , & type_floatpointer , & type_integer , & type_float } ,
{ 7 , " *= " , " MULSTORE_VI " , 6 , ASSOC_RIGHT_RESULT , & type_vector , & type_integer , & type_vector } ,
{ 7 , " *= " , " MULSTOREP_VI " , 6 , ASSOC_RIGHT_RESULT , & type_pointer , & type_integer , & type_vector } ,
2004-11-04 04:19:10 +00:00
2012-01-28 10:30:44 +00:00
{ 7 , " = " , " LOADA_STRUCT " , 6 , ASSOC_LEFT , & type_float , & type_integer , & type_float } ,
------------------------------------------------------------------------
r4169 | acceptthis | 2013-01-17 08:55:12 +0000 (Thu, 17 Jan 2013) | 31 lines
removed MAX_VISEDICTS limit.
PEXT2_REPLACEMENTDELTAS tweaked, now has 4 million entity limit. still not enabled by default.
TE_BEAM now maps to a separate TEQW_BEAM to avoid conflicts with QW.
added android multitouch emulation for windows/rawinput (in_simulatemultitouch).
split topcolor/bottomcolor from scoreboard, for dp's colormap|1024 feature.
now using utf-8 for windows consoles.
qcc warnings/errors now give clickable console links for quick+easy editing.
disabled menutint when the currently active item changes contrast or gamma (for OneManClan).
Added support for drawfont/drawfontscale.
tweaked the qcvm a little to reduce the number of pointers.
.doll file loading. still experimental and will likely crash. requires csqc active, even if its a dummy progs. this will be fixed in time. Still other things that need cleaning up.
windows: gl_font "?" shows the standard windows font-selection dialog, and can be used to select windows fonts. not all work. and you probably don't want to use windings.
fixed splitscreen support when playing mvds. added mini-scoreboards to splitscreen.
editor/debugger now shows asm if there's no linenumber info. also, pressing f1 for help shows the shortcuts.
Added support for .framegroups files for psk(psa) and iqm formats.
True support for ezquake's colour codes. Mutually exclusive with background colours.
path command output slightly more readable.
added support for digest_hex (MD4, SHA1, CRC16).
skingroups now colourmap correctly.
Fix terrain colour hints, and litdata from the wrong bsp.
fix ftp dual-homed issue. support epsv command, and enable ipv6 (eprt still not supported).
remove d3d11 compilation from the makefile. the required headers are not provided by mingw, and are not available to the build bot, so don't bother.
fix v *= v.x and similar opcodes.
fteqcc: fixed support for áéÃóú type chars in names. utf-8 files now properly supported (even with the utf-8 bom/identifier). utf-16 also supported.
fteqcc: fixed '#if 1 == 3 && 4' parsing.
fteqcc: -Werror acts on the warning, rather than as a separate error. Line numbers are thus more readable.
fteqcc: copyright message now includes compile date instead.
fteqccgui: the treeview control is now coloured depending on whether there were warnings/errors in the last compile.
fteqccgui: the output window is now focused and scrolls down as compilation progresses.
pr_dumpplatform command dumps out some pragmas to convert more serious warnings to errors. This is to avoid the infamous 'fteqcc sucks cos my code sucks' issue.
rewrote prespawn/modelist/soundlist code. server tracks progress now.
------------------------------------------------------------------------
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4167 fc73d0e0-1445-4013-8a0c-d673dee63da5
2013-03-12 22:29:40 +00:00
{ 7 , " = " , " STOREP_P " , 6 , ASSOC_RIGHT , & type_pointer , & type_pointer , & type_pointer } ,
{ 7 , " ~ " , " BINARYNOT_F " , - 1 , ASSOC_LEFT , & type_float , & type_void , & type_float } ,
{ 7 , " ~ " , " BINARYNOT_I " , - 1 , ASSOC_LEFT , & type_integer , & type_void , & type_integer } ,
2012-02-13 09:24:01 +00:00
2004-08-23 01:38:21 +00:00
{ 0 , NULL }
} ;
2008-07-10 20:38:17 +00:00
pbool OpAssignsToC ( unsigned int op )
{
// calls, switches and cases DON'T
if ( pr_opcodes [ op ] . type_c = = & type_void )
return false ;
if ( op > = OP_SWITCH_F & & op < = OP_CALL8H )
return false ;
if ( op > = OP_RAND0 & & op < = OP_RANDV2 )
return false ;
// they use a and b, but have 3 types
// safety
if ( op > = OP_BITSET & & op < = OP_BITCLRP )
return false ;
/*if(op >= OP_STORE_I && op <= OP_STORE_FI)
return false ; < - add STOREP_ * ? */
if ( op = = OP_STOREP_C | | op = = OP_LOADP_C )
return false ;
if ( op > = OP_MULSTORE_F & & op < = OP_SUBSTOREP_V )
return false ;
return true ;
}
pbool OpAssignsToB ( unsigned int op )
{
if ( op > = OP_BITSET & & op < = OP_BITCLRP )
return true ;
if ( op > = OP_STORE_I & & op < = OP_STORE_FI )
return true ;
if ( op = = OP_STOREP_C | | op = = OP_LOADP_C )
return true ;
if ( op > = OP_MULSTORE_F & & op < = OP_SUBSTOREP_V )
return true ;
if ( op > = OP_STORE_F & & op < = OP_STOREP_FNC )
return true ;
return false ;
}
2009-08-29 14:56:42 +00:00
/*pbool OpAssignedTo(QCC_def_t *v, unsigned int op)
2008-07-10 20:38:17 +00:00
{
if ( OpAssignsToC ( op ) )
{
2009-08-29 14:56:42 +00:00
}
else if ( OpAssignsToB ( op ) )
2008-07-10 20:38:17 +00:00
{
}
return false ;
}
2009-08-29 14:56:42 +00:00
*/
2004-08-23 01:38:21 +00:00
# undef ASSOC_RIGHT_RESULT
# define TOP_PRIORITY 7
2011-09-03 03:49:43 +00:00
# define FUNC_PRIORITY 1
2009-07-03 19:02:42 +00:00
# define UNARY_PRIORITY 1
2004-08-23 01:38:21 +00:00
# define NOT_PRIORITY 5
//conditional and/or
# define CONDITION_PRIORITY 7
//this system cuts out 10/120
//these evaluate as top first.
2008-11-09 22:29:28 +00:00
QCC_opcode_t * opcodeprioritized [ TOP_PRIORITY + 1 ] [ 128 ] =
2004-08-23 01:38:21 +00:00
{
{ //don't use
/* &pr_opcodes[OP_DONE],
& pr_opcodes [ OP_RETURN ] ,
& pr_opcodes [ OP_NOT_F ] ,
& pr_opcodes [ OP_NOT_V ] ,
& pr_opcodes [ OP_NOT_S ] ,
& pr_opcodes [ OP_NOT_ENT ] ,
& pr_opcodes [ OP_NOT_FNC ] ,
& pr_opcodes [ OP_IF ] ,
& pr_opcodes [ OP_IFNOT ] ,
& pr_opcodes [ OP_CALL0 ] ,
& pr_opcodes [ OP_CALL1 ] ,
& pr_opcodes [ OP_CALL2 ] ,
& pr_opcodes [ OP_CALL3 ] ,
& pr_opcodes [ OP_CALL4 ] ,
& pr_opcodes [ OP_CALL5 ] ,
& pr_opcodes [ OP_CALL6 ] ,
& pr_opcodes [ OP_CALL7 ] ,
& pr_opcodes [ OP_CALL8 ] ,
& pr_opcodes [ OP_STATE ] ,
& pr_opcodes [ OP_GOTO ] ,
& pr_opcodes [ OP_IFNOTS ] ,
& pr_opcodes [ OP_IFS ] ,
& pr_opcodes [ OP_NOT_I ] ,
*/ NULL
} , { //1
& pr_opcodes [ OP_LOAD_F ] ,
& pr_opcodes [ OP_LOAD_V ] ,
& pr_opcodes [ OP_LOAD_S ] ,
& pr_opcodes [ OP_LOAD_ENT ] ,
& pr_opcodes [ OP_LOAD_FLD ] ,
& pr_opcodes [ OP_LOAD_FNC ] ,
& pr_opcodes [ OP_LOAD_I ] ,
2004-11-04 04:19:10 +00:00
& pr_opcodes [ OP_LOAD_P ] ,
2004-08-23 01:38:21 +00:00
& pr_opcodes [ OP_ADDRESS ] ,
NULL
} , { //2
/* //conversion. don't use
& pr_opcodes [ OP_C_ITOF ] ,
& pr_opcodes [ OP_C_FTOI ] ,
& pr_opcodes [ OP_CP_ITOF ] ,
& pr_opcodes [ OP_CP_FTOI ] ,
*/ NULL
} , { //3
& pr_opcodes [ OP_MUL_F ] ,
& pr_opcodes [ OP_MUL_V ] ,
& pr_opcodes [ OP_MUL_FV ] ,
2012-01-17 07:57:46 +00:00
& pr_opcodes [ OP_MUL_IV ] ,
2004-08-23 01:38:21 +00:00
& pr_opcodes [ OP_MUL_VF ] ,
2012-01-17 07:57:46 +00:00
& pr_opcodes [ OP_MUL_VI ] ,
2004-08-23 01:38:21 +00:00
& pr_opcodes [ OP_MUL_I ] ,
2012-01-17 07:57:46 +00:00
& pr_opcodes [ OP_MUL_FI ] ,
& pr_opcodes [ OP_MUL_IF ] ,
2004-08-23 01:38:21 +00:00
& pr_opcodes [ OP_DIV_F ] ,
& pr_opcodes [ OP_DIV_I ] ,
2012-01-17 07:57:46 +00:00
& pr_opcodes [ OP_DIV_FI ] ,
& pr_opcodes [ OP_DIV_IF ] ,
2004-08-23 01:38:21 +00:00
& pr_opcodes [ OP_DIV_VF ] ,
2011-07-08 18:59:48 +00:00
& pr_opcodes [ OP_BITAND_F ] ,
2004-08-23 01:38:21 +00:00
& pr_opcodes [ OP_BITAND_I ] ,
2008-11-09 22:29:28 +00:00
& pr_opcodes [ OP_BITAND_IF ] ,
& pr_opcodes [ OP_BITAND_FI ] ,
2004-08-23 01:38:21 +00:00
2011-07-08 18:59:48 +00:00
& pr_opcodes [ OP_BITOR_F ] ,
2004-08-23 01:38:21 +00:00
& pr_opcodes [ OP_BITOR_I ] ,
2008-11-09 22:29:28 +00:00
& pr_opcodes [ OP_BITOR_IF ] ,
& pr_opcodes [ OP_BITOR_FI ] ,
2004-08-23 01:38:21 +00:00
2008-11-09 22:29:28 +00:00
& pr_opcodes [ OP_XOR_I ] ,
2004-08-23 01:38:21 +00:00
& pr_opcodes [ OP_RSHIFT_I ] ,
& pr_opcodes [ OP_LSHIFT_I ] ,
NULL
} , { //4
& pr_opcodes [ OP_ADD_F ] ,
& pr_opcodes [ OP_ADD_V ] ,
& pr_opcodes [ OP_ADD_I ] ,
& pr_opcodes [ OP_ADD_FI ] ,
& pr_opcodes [ OP_ADD_IF ] ,
& pr_opcodes [ OP_ADD_SF ] ,
& pr_opcodes [ OP_SUB_F ] ,
& pr_opcodes [ OP_SUB_V ] ,
& pr_opcodes [ OP_SUB_I ] ,
& pr_opcodes [ OP_SUB_FI ] ,
& pr_opcodes [ OP_SUB_IF ] ,
& pr_opcodes [ OP_SUB_S ] ,
NULL
} , { //5
& pr_opcodes [ OP_EQ_F ] ,
& pr_opcodes [ OP_EQ_V ] ,
& pr_opcodes [ OP_EQ_S ] ,
& pr_opcodes [ OP_EQ_E ] ,
& pr_opcodes [ OP_EQ_FNC ] ,
& pr_opcodes [ OP_EQ_I ] ,
& pr_opcodes [ OP_EQ_IF ] ,
& pr_opcodes [ OP_EQ_FI ] ,
2011-05-15 13:23:13 +00:00
2004-08-23 01:38:21 +00:00
& pr_opcodes [ OP_NE_F ] ,
& pr_opcodes [ OP_NE_V ] ,
& pr_opcodes [ OP_NE_S ] ,
& pr_opcodes [ OP_NE_E ] ,
& pr_opcodes [ OP_NE_FNC ] ,
& pr_opcodes [ OP_NE_I ] ,
2008-11-09 22:29:28 +00:00
& pr_opcodes [ OP_NE_IF ] ,
& pr_opcodes [ OP_NE_FI ] ,
2011-05-15 13:23:13 +00:00
2011-07-08 18:59:48 +00:00
& pr_opcodes [ OP_LE_F ] ,
2004-08-23 01:38:21 +00:00
& pr_opcodes [ OP_LE_I ] ,
& pr_opcodes [ OP_LE_IF ] ,
& pr_opcodes [ OP_LE_FI ] ,
2011-07-08 18:59:48 +00:00
& pr_opcodes [ OP_GE_F ] ,
2004-08-23 01:38:21 +00:00
& pr_opcodes [ OP_GE_I ] ,
& pr_opcodes [ OP_GE_IF ] ,
& pr_opcodes [ OP_GE_FI ] ,
2011-07-08 18:59:48 +00:00
& pr_opcodes [ OP_LT_F ] ,
2004-08-23 01:38:21 +00:00
& pr_opcodes [ OP_LT_I ] ,
& pr_opcodes [ OP_LT_IF ] ,
& pr_opcodes [ OP_LT_FI ] ,
2011-07-08 18:59:48 +00:00
& pr_opcodes [ OP_GT_F ] ,
2004-08-23 01:38:21 +00:00
& pr_opcodes [ OP_GT_I ] ,
& pr_opcodes [ OP_GT_IF ] ,
& pr_opcodes [ OP_GT_FI ] ,
NULL
} , { //6
2012-02-13 09:24:01 +00:00
& pr_opcodes [ OP_STOREP_P ] ,
2004-08-23 01:38:21 +00:00
& pr_opcodes [ OP_STORE_F ] ,
& pr_opcodes [ OP_STORE_V ] ,
& pr_opcodes [ OP_STORE_S ] ,
& pr_opcodes [ OP_STORE_ENT ] ,
& pr_opcodes [ OP_STORE_FLD ] ,
& pr_opcodes [ OP_STORE_FNC ] ,
& pr_opcodes [ OP_STORE_I ] ,
& pr_opcodes [ OP_STORE_IF ] ,
& pr_opcodes [ OP_STORE_FI ] ,
2004-11-04 04:19:10 +00:00
& pr_opcodes [ OP_STORE_P ] ,
2004-08-23 01:38:21 +00:00
& pr_opcodes [ OP_STOREP_F ] ,
& pr_opcodes [ OP_STOREP_V ] ,
& pr_opcodes [ OP_STOREP_S ] ,
& pr_opcodes [ OP_STOREP_ENT ] ,
& pr_opcodes [ OP_STOREP_FLD ] ,
& pr_opcodes [ OP_STOREP_FNC ] ,
& pr_opcodes [ OP_STOREP_I ] ,
& pr_opcodes [ OP_STOREP_IF ] ,
& pr_opcodes [ OP_STOREP_FI ] ,
& pr_opcodes [ OP_DIVSTORE_F ] ,
2008-11-09 22:29:28 +00:00
& pr_opcodes [ OP_DIVSTORE_I ] ,
& pr_opcodes [ OP_DIVSTORE_FI ] ,
& pr_opcodes [ OP_DIVSTORE_IF ] ,
2004-08-23 01:38:21 +00:00
& pr_opcodes [ OP_DIVSTOREP_F ] ,
2008-11-09 22:29:28 +00:00
& pr_opcodes [ OP_DIVSTOREP_I ] ,
& pr_opcodes [ OP_DIVSTOREP_IF ] ,
& pr_opcodes [ OP_DIVSTOREP_FI ] ,
2004-08-23 01:38:21 +00:00
& pr_opcodes [ OP_MULSTORE_F ] ,
2012-01-17 07:57:46 +00:00
& pr_opcodes [ OP_MULSTORE_VF ] ,
& pr_opcodes [ OP_MULSTORE_VI ] ,
2008-11-09 22:29:28 +00:00
& pr_opcodes [ OP_MULSTORE_I ] ,
& pr_opcodes [ OP_MULSTORE_IF ] ,
& pr_opcodes [ OP_MULSTORE_FI ] ,
2004-08-23 01:38:21 +00:00
& pr_opcodes [ OP_MULSTOREP_F ] ,
2012-01-17 07:57:46 +00:00
& pr_opcodes [ OP_MULSTOREP_VF ] ,
& pr_opcodes [ OP_MULSTOREP_VI ] ,
2008-11-09 22:29:28 +00:00
& pr_opcodes [ OP_MULSTOREP_I ] ,
& pr_opcodes [ OP_MULSTOREP_IF ] ,
& pr_opcodes [ OP_MULSTOREP_FI ] ,
2004-08-23 01:38:21 +00:00
& pr_opcodes [ OP_ADDSTORE_F ] ,
& pr_opcodes [ OP_ADDSTORE_V ] ,
2008-11-09 22:29:28 +00:00
& pr_opcodes [ OP_ADDSTORE_I ] ,
& pr_opcodes [ OP_ADDSTORE_IF ] ,
& pr_opcodes [ OP_ADDSTORE_FI ] ,
2004-08-23 01:38:21 +00:00
& pr_opcodes [ OP_ADDSTOREP_F ] ,
& pr_opcodes [ OP_ADDSTOREP_V ] ,
2008-11-09 22:29:28 +00:00
& pr_opcodes [ OP_ADDSTOREP_I ] ,
& pr_opcodes [ OP_ADDSTOREP_IF ] ,
& pr_opcodes [ OP_ADDSTOREP_FI ] ,
2004-08-23 01:38:21 +00:00
& pr_opcodes [ OP_SUBSTORE_F ] ,
& pr_opcodes [ OP_SUBSTORE_V ] ,
2008-11-09 22:29:28 +00:00
& pr_opcodes [ OP_SUBSTORE_I ] ,
& pr_opcodes [ OP_SUBSTORE_IF ] ,
& pr_opcodes [ OP_SUBSTORE_FI ] ,
2004-08-23 01:38:21 +00:00
& pr_opcodes [ OP_SUBSTOREP_F ] ,
& pr_opcodes [ OP_SUBSTOREP_V ] ,
2008-11-09 22:29:28 +00:00
& pr_opcodes [ OP_SUBSTOREP_I ] ,
& pr_opcodes [ OP_SUBSTOREP_IF ] ,
& pr_opcodes [ OP_SUBSTOREP_FI ] ,
2004-08-23 01:38:21 +00:00
& pr_opcodes [ OP_BITSET ] ,
2008-11-09 22:29:28 +00:00
& pr_opcodes [ OP_BITSET_I ] ,
// &pr_opcodes[OP_BITSET_IF],
// &pr_opcodes[OP_BITSET_FI],
2004-08-23 01:38:21 +00:00
& pr_opcodes [ OP_BITSETP ] ,
2008-11-09 22:29:28 +00:00
& pr_opcodes [ OP_BITSETP_I ] ,
// &pr_opcodes[OP_BITSETP_IF],
// &pr_opcodes[OP_BITSETP_FI],
2004-08-23 01:38:21 +00:00
& pr_opcodes [ OP_BITCLR ] ,
& pr_opcodes [ OP_BITCLRP ] ,
2008-11-09 22:29:28 +00:00
2004-08-23 01:38:21 +00:00
NULL
} , { //7
2011-07-08 18:59:48 +00:00
& pr_opcodes [ OP_AND_F ] ,
2009-08-29 14:56:42 +00:00
& pr_opcodes [ OP_AND_I ] ,
& pr_opcodes [ OP_AND_IF ] ,
& pr_opcodes [ OP_AND_FI ] ,
2011-07-08 18:59:48 +00:00
& pr_opcodes [ OP_OR_F ] ,
2009-08-29 14:56:42 +00:00
& pr_opcodes [ OP_OR_I ] ,
& pr_opcodes [ OP_OR_IF ] ,
& pr_opcodes [ OP_OR_FI ] ,
2004-08-23 01:38:21 +00:00
NULL
}
} ;
pbool QCC_OPCodeValid ( QCC_opcode_t * op )
{
int num ;
num = op - pr_opcodes ;
2008-11-09 22:29:28 +00:00
2004-08-23 01:38:21 +00:00
switch ( qcc_targetformat )
{
case QCF_STANDARD :
case QCF_KK7 :
2011-03-04 13:59:06 +00:00
case QCF_QTEST :
2004-08-23 01:38:21 +00:00
if ( num < OP_MULSTORE_F )
return true ;
return false ;
case QCF_HEXEN2 :
if ( num > = OP_SWITCH_V & & num < = OP_SWITCH_FNC ) //these were assigned numbers but were never actually implemtented in standard h2.
return false ;
// if (num >= OP_MULSTORE_F && num <= OP_SUBSTOREP_V)
// return false;
if ( num < = OP_CALL8H ) //CALLXH are fixed up. This is to provide more dynamic switching...??
return true ;
return false ;
------------------------------------------------------------------------
r4169 | acceptthis | 2013-01-17 08:55:12 +0000 (Thu, 17 Jan 2013) | 31 lines
removed MAX_VISEDICTS limit.
PEXT2_REPLACEMENTDELTAS tweaked, now has 4 million entity limit. still not enabled by default.
TE_BEAM now maps to a separate TEQW_BEAM to avoid conflicts with QW.
added android multitouch emulation for windows/rawinput (in_simulatemultitouch).
split topcolor/bottomcolor from scoreboard, for dp's colormap|1024 feature.
now using utf-8 for windows consoles.
qcc warnings/errors now give clickable console links for quick+easy editing.
disabled menutint when the currently active item changes contrast or gamma (for OneManClan).
Added support for drawfont/drawfontscale.
tweaked the qcvm a little to reduce the number of pointers.
.doll file loading. still experimental and will likely crash. requires csqc active, even if its a dummy progs. this will be fixed in time. Still other things that need cleaning up.
windows: gl_font "?" shows the standard windows font-selection dialog, and can be used to select windows fonts. not all work. and you probably don't want to use windings.
fixed splitscreen support when playing mvds. added mini-scoreboards to splitscreen.
editor/debugger now shows asm if there's no linenumber info. also, pressing f1 for help shows the shortcuts.
Added support for .framegroups files for psk(psa) and iqm formats.
True support for ezquake's colour codes. Mutually exclusive with background colours.
path command output slightly more readable.
added support for digest_hex (MD4, SHA1, CRC16).
skingroups now colourmap correctly.
Fix terrain colour hints, and litdata from the wrong bsp.
fix ftp dual-homed issue. support epsv command, and enable ipv6 (eprt still not supported).
remove d3d11 compilation from the makefile. the required headers are not provided by mingw, and are not available to the build bot, so don't bother.
fix v *= v.x and similar opcodes.
fteqcc: fixed support for áéÃóú type chars in names. utf-8 files now properly supported (even with the utf-8 bom/identifier). utf-16 also supported.
fteqcc: fixed '#if 1 == 3 && 4' parsing.
fteqcc: -Werror acts on the warning, rather than as a separate error. Line numbers are thus more readable.
fteqcc: copyright message now includes compile date instead.
fteqccgui: the treeview control is now coloured depending on whether there were warnings/errors in the last compile.
fteqccgui: the output window is now focused and scrolls down as compilation progresses.
pr_dumpplatform command dumps out some pragmas to convert more serious warnings to errors. This is to avoid the infamous 'fteqcc sucks cos my code sucks' issue.
rewrote prespawn/modelist/soundlist code. server tracks progress now.
------------------------------------------------------------------------
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4167 fc73d0e0-1445-4013-8a0c-d673dee63da5
2013-03-12 22:29:40 +00:00
case QCF_FTEH2 :
2004-08-23 01:38:21 +00:00
case QCF_FTE :
case QCF_FTEDEBUG :
2008-11-09 22:29:28 +00:00
//no emulated opcodes
if ( num > = OP_NUMREALOPS )
return false ;
2004-08-23 01:38:21 +00:00
return true ;
2008-10-16 23:04:36 +00:00
case QCF_DARKPLACES :
//all id opcodes.
if ( num < OP_MULSTORE_F )
return true ;
2008-11-09 22:29:28 +00:00
//no emulated opcodes
if ( num > = OP_NUMREALOPS )
return false ;
2008-10-16 23:04:36 +00:00
//extended opcodes.
//DPFIXME: this is a list of the extended opcodes. I was conservative regarding supported ones.
// at the time of writing, these are the ones that look like they'll work just fine in Blub\0's patch.
// the ones that looked too permissive with bounds checks, or would give false positives are disabled.
// if the DP guys want I can change them as desired.
switch ( num )
{
//maths and conditionals (simple opcodes that read from specific globals and write to a global)
case OP_ADD_I :
case OP_ADD_IF :
case OP_ADD_FI :
case OP_SUB_I :
case OP_SUB_IF :
case OP_SUB_FI :
case OP_MUL_I :
case OP_MUL_IF :
case OP_MUL_FI :
case OP_MUL_VI :
case OP_DIV_VF :
case OP_DIV_I :
case OP_DIV_IF :
case OP_DIV_FI :
case OP_BITAND_I :
case OP_BITOR_I :
case OP_BITAND_IF :
case OP_BITOR_IF :
case OP_BITAND_FI :
case OP_BITOR_FI :
case OP_GE_I :
case OP_LE_I :
case OP_GT_I :
case OP_LT_I :
case OP_AND_I :
case OP_OR_I :
case OP_GE_IF :
case OP_LE_IF :
case OP_GT_IF :
case OP_LT_IF :
case OP_AND_IF :
case OP_OR_IF :
case OP_GE_FI :
case OP_LE_FI :
case OP_GT_FI :
case OP_LT_FI :
case OP_AND_FI :
case OP_OR_FI :
case OP_NOT_I :
case OP_EQ_I :
case OP_EQ_IF :
case OP_EQ_FI :
case OP_NE_I :
case OP_NE_IF :
case OP_NE_FI :
return true ;
//stores into a pointer (generated from 'ent.field=XXX')
case OP_STOREP_I : //no worse than the other OP_STOREP_X functions
//reads from an entity field
case OP_LOAD_I : //no worse than the other OP_LOAD_X functions.
2009-08-29 14:56:42 +00:00
case OP_LOAD_P :
2008-10-16 23:04:36 +00:00
return true ;
//stores into the globals array.
//they can change any global dynamically, but thats no security risk.
//fteqcc will not automatically generate these.
//fteqw does not support them either.
case OP_GSTOREP_I :
case OP_GSTOREP_F :
case OP_GSTOREP_ENT :
case OP_GSTOREP_FLD :
case OP_GSTOREP_S :
case OP_GSTOREP_FNC :
case OP_GSTOREP_V :
return true ;
//this opcode looks weird
case OP_GADDRESS : //floatc = globals[inta + floatb] (fte does not support)
return true ;
//fteqcc will not automatically generate these
//fteqw does not support them either, for that matter.
case OP_GLOAD_I : //c = globals[inta]
case OP_GLOAD_F : //note: fte does not support these
case OP_GLOAD_FLD :
case OP_GLOAD_ENT :
case OP_GLOAD_S :
case OP_GLOAD_FNC :
return true ;
case OP_GLOAD_V :
return false ; //DPFIXME: this is commented out in the patch I was given a link to... because the opcode wasn't defined.
//these are reportedly functional.
case OP_CALL8H :
case OP_CALL7H :
case OP_CALL6H :
case OP_CALL5H :
case OP_CALL4H :
case OP_CALL3H :
case OP_CALL2H :
case OP_CALL1H :
return true ;
case OP_RAND0 :
case OP_RAND1 :
case OP_RAND2 :
case OP_RANDV0 :
case OP_RANDV1 :
case OP_RANDV2 :
return true ;
case OP_BITSET : // b |= a
case OP_BITCLR : // b &= ~a
case OP_BITSETP : // *b |= a
case OP_BITCLRP : // *b &= ~a
return false ; //FIXME: I do not fully follow the controversy over these.
case OP_SWITCH_F :
case OP_SWITCH_V :
case OP_SWITCH_S :
case OP_SWITCH_E :
case OP_SWITCH_FNC :
case OP_CASE :
case OP_CASERANGE :
return true ;
//assuming the pointers here are fine, the return values are a little strange.
//but its fine
case OP_ADDSTORE_F :
case OP_ADDSTORE_V :
case OP_ADDSTOREP_F : // e.f += f
case OP_ADDSTOREP_V : // e.v += v
case OP_SUBSTORE_F :
case OP_SUBSTORE_V :
case OP_SUBSTOREP_F : // e.f += f
case OP_SUBSTOREP_V : // e.v += v
return true ;
case OP_LOADA_I :
case OP_LOADA_F :
case OP_LOADA_FLD :
case OP_LOADA_ENT :
case OP_LOADA_S :
case OP_LOADA_FNC :
case OP_LOADA_V :
return false ; //DPFIXME: DP does not bounds check these properly. I won't generate them.
2011-05-15 13:23:13 +00:00
2008-10-16 23:04:36 +00:00
case OP_CONV_ITOF :
case OP_CONV_FTOI :
return true ; //these look fine.
case OP_STOREP_C : // store a char in a string
return false ; //DPFIXME: dp's bounds check may give false positives with expected uses.
case OP_MULSTORE_F :
2012-01-17 07:57:46 +00:00
case OP_MULSTORE_VF :
2008-10-16 23:04:36 +00:00
case OP_MULSTOREP_F :
2012-01-17 07:57:46 +00:00
case OP_MULSTOREP_VF : // e.v *= f
2008-10-16 23:04:36 +00:00
case OP_DIVSTORE_F :
case OP_DIVSTOREP_F :
case OP_STORE_IF :
case OP_STORE_FI :
2009-08-29 14:56:42 +00:00
case OP_STORE_P :
2008-10-16 23:04:36 +00:00
case OP_STOREP_IF : // store a value to a pointer
case OP_STOREP_FI :
2009-08-29 14:56:42 +00:00
case OP_IFNOT_S :
case OP_IF_S :
2008-10-16 23:04:36 +00:00
return true ;
2011-05-15 13:23:13 +00:00
2009-08-29 14:56:42 +00:00
case OP_IFNOT_F : //added, but not in dp yet
case OP_IF_F :
return false ;
2008-10-16 23:04:36 +00:00
case OP_CP_ITOF :
case OP_CP_FTOI :
return false ; //DPFIXME: These are not bounds checked at all.
case OP_GLOBALADDRESS :
2009-08-29 14:56:42 +00:00
return true ; //DPFIXME: DP will reject these pointers if they are ever used.
2008-10-16 23:04:36 +00:00
case OP_POINTER_ADD :
return true ; //just maths.
case OP_ADD_SF : //(char*)c = (char*)a + (float)b
case OP_SUB_S : //(float)c = (char*)a - (char*)b
return true ;
case OP_LOADP_C : //load character from a string
return false ; //DPFIXME: DP looks like it'll reject these or wrongly allow.
case OP_LOADP_I :
case OP_LOADP_F :
case OP_LOADP_FLD :
case OP_LOADP_ENT :
case OP_LOADP_S :
case OP_LOADP_FNC :
case OP_LOADP_V :
return true ;
2008-11-09 22:29:28 +00:00
case OP_XOR_I :
2008-10-16 23:04:36 +00:00
case OP_RSHIFT_I :
case OP_LSHIFT_I :
return true ;
case OP_FETCH_GBL_F :
case OP_FETCH_GBL_S :
case OP_FETCH_GBL_E :
case OP_FETCH_GBL_FNC :
case OP_FETCH_GBL_V :
return false ; //DPFIXME: DP will not bounds check this properly, it is too permissive.
case OP_CSTATE :
case OP_CWSTATE :
return false ; //DP does not support this hexenc opcode.
case OP_THINKTIME :
return true ; //but it does support this one.
default : //anything I forgot to mention is new.
return false ;
}
2004-08-23 01:38:21 +00:00
}
return false ;
}
2009-07-03 19:02:42 +00:00
# define EXPR_WARN_ABOVE_1 2
# define EXPR_DISALLOW_COMMA 4
------------------------------------------------------------------------
r4169 | acceptthis | 2013-01-17 08:55:12 +0000 (Thu, 17 Jan 2013) | 31 lines
removed MAX_VISEDICTS limit.
PEXT2_REPLACEMENTDELTAS tweaked, now has 4 million entity limit. still not enabled by default.
TE_BEAM now maps to a separate TEQW_BEAM to avoid conflicts with QW.
added android multitouch emulation for windows/rawinput (in_simulatemultitouch).
split topcolor/bottomcolor from scoreboard, for dp's colormap|1024 feature.
now using utf-8 for windows consoles.
qcc warnings/errors now give clickable console links for quick+easy editing.
disabled menutint when the currently active item changes contrast or gamma (for OneManClan).
Added support for drawfont/drawfontscale.
tweaked the qcvm a little to reduce the number of pointers.
.doll file loading. still experimental and will likely crash. requires csqc active, even if its a dummy progs. this will be fixed in time. Still other things that need cleaning up.
windows: gl_font "?" shows the standard windows font-selection dialog, and can be used to select windows fonts. not all work. and you probably don't want to use windings.
fixed splitscreen support when playing mvds. added mini-scoreboards to splitscreen.
editor/debugger now shows asm if there's no linenumber info. also, pressing f1 for help shows the shortcuts.
Added support for .framegroups files for psk(psa) and iqm formats.
True support for ezquake's colour codes. Mutually exclusive with background colours.
path command output slightly more readable.
added support for digest_hex (MD4, SHA1, CRC16).
skingroups now colourmap correctly.
Fix terrain colour hints, and litdata from the wrong bsp.
fix ftp dual-homed issue. support epsv command, and enable ipv6 (eprt still not supported).
remove d3d11 compilation from the makefile. the required headers are not provided by mingw, and are not available to the build bot, so don't bother.
fix v *= v.x and similar opcodes.
fteqcc: fixed support for áéÃóú type chars in names. utf-8 files now properly supported (even with the utf-8 bom/identifier). utf-16 also supported.
fteqcc: fixed '#if 1 == 3 && 4' parsing.
fteqcc: -Werror acts on the warning, rather than as a separate error. Line numbers are thus more readable.
fteqcc: copyright message now includes compile date instead.
fteqccgui: the treeview control is now coloured depending on whether there were warnings/errors in the last compile.
fteqccgui: the output window is now focused and scrolls down as compilation progresses.
pr_dumpplatform command dumps out some pragmas to convert more serious warnings to errors. This is to avoid the infamous 'fteqcc sucks cos my code sucks' issue.
rewrote prespawn/modelist/soundlist code. server tracks progress now.
------------------------------------------------------------------------
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4167 fc73d0e0-1445-4013-8a0c-d673dee63da5
2013-03-12 22:29:40 +00:00
# define EXPR_DISALLOW_ARRAYASSIGN 8
2009-07-03 19:02:42 +00:00
QCC_def_t * QCC_PR_Expression ( int priority , int exprflags ) ;
2004-10-28 07:03:56 +00:00
int QCC_AStatementJumpsTo ( int targ , int first , int last ) ;
2004-12-24 08:45:56 +00:00
pbool QCC_StatementIsAJump ( int stnum , int notifdest ) ;
2004-08-23 01:38:21 +00:00
temp_t * functemps ; //floats/strings/funcs/ents...
//===========================================================================
/*
= = = = = = = = = = = =
PR_Statement
Emits a primitive statement , returning the var it places it ' s value in
= = = = = = = = = = = =
*/
QCC_def_t * QCC_PR_Statement ( QCC_opcode_t * op , QCC_def_t * var_a , QCC_def_t * var_b , QCC_dstatement_t * * outstatement ) ;
2009-06-13 12:25:39 +00:00
static int QCC_ShouldConvert ( QCC_def_t * var , etype_t wanted )
2004-08-23 01:38:21 +00:00
{
2011-09-03 03:49:43 +00:00
/*no conversion needed*/
if ( var - > type - > type = = wanted )
return 0 ;
2004-08-23 01:38:21 +00:00
if ( var - > type - > type = = ev_integer & & wanted = = ev_function )
return 0 ;
2011-09-03 03:49:43 +00:00
if ( var - > type - > type = = ev_integer & & wanted = = ev_pointer )
return 0 ;
/*stuff needs converting*/
2004-08-23 01:38:21 +00:00
if ( var - > type - > type = = ev_pointer & & var - > type - > aux_type )
{
if ( var - > type - > aux_type - > type = = ev_float & & wanted = = ev_integer )
2011-05-15 13:23:13 +00:00
return OP_CP_FTOI ;
2004-08-23 01:38:21 +00:00
if ( var - > type - > aux_type - > type = = ev_integer & & wanted = = ev_float )
return OP_CP_ITOF ;
}
else
{
if ( var - > type - > type = = ev_float & & wanted = = ev_integer )
return OP_CONV_FTOI ;
if ( var - > type - > type = = ev_integer & & wanted = = ev_float )
return OP_CONV_ITOF ;
}
2011-09-03 03:49:43 +00:00
/*impossible*/
2004-08-23 01:38:21 +00:00
return - 1 ;
}
2011-09-03 03:49:43 +00:00
QCC_def_t * QCC_SupplyConversion ( QCC_def_t * var , etype_t wanted , pbool fatal )
2004-08-23 01:38:21 +00:00
{
2011-09-03 03:49:43 +00:00
extern char * basictypenames [ ] ;
2004-08-23 01:38:21 +00:00
int o ;
if ( pr_classtype & & var - > type - > type = = ev_field & & wanted ! = ev_field )
{
if ( pr_classtype )
{ //load self.var into a temp
QCC_def_t * self ;
2012-01-17 07:57:46 +00:00
self = QCC_PR_GetDef ( type_entity , " self " , NULL , true , 0 , false ) ;
2004-08-23 01:38:21 +00:00
switch ( wanted )
{
case ev_float :
return QCC_PR_Statement ( pr_opcodes + OP_LOAD_F , self , var , NULL ) ;
case ev_string :
return QCC_PR_Statement ( pr_opcodes + OP_LOAD_S , self , var , NULL ) ;
case ev_function :
return QCC_PR_Statement ( pr_opcodes + OP_LOAD_FNC , self , var , NULL ) ;
case ev_vector :
return QCC_PR_Statement ( pr_opcodes + OP_LOAD_V , self , var , NULL ) ;
case ev_entity :
return QCC_PR_Statement ( pr_opcodes + OP_LOAD_ENT , self , var , NULL ) ;
default :
QCC_Error ( ERR_INTERNAL , " Inexplicit field load failed, try explicit " ) ;
}
}
}
o = QCC_ShouldConvert ( var , wanted ) ;
2011-09-03 03:49:43 +00:00
if ( o = = 0 ) //type already matches
2004-08-23 01:38:21 +00:00
return var ;
2012-01-17 07:57:46 +00:00
if ( flag_typeexplicit )
------------------------------------------------------------------------
r4169 | acceptthis | 2013-01-17 08:55:12 +0000 (Thu, 17 Jan 2013) | 31 lines
removed MAX_VISEDICTS limit.
PEXT2_REPLACEMENTDELTAS tweaked, now has 4 million entity limit. still not enabled by default.
TE_BEAM now maps to a separate TEQW_BEAM to avoid conflicts with QW.
added android multitouch emulation for windows/rawinput (in_simulatemultitouch).
split topcolor/bottomcolor from scoreboard, for dp's colormap|1024 feature.
now using utf-8 for windows consoles.
qcc warnings/errors now give clickable console links for quick+easy editing.
disabled menutint when the currently active item changes contrast or gamma (for OneManClan).
Added support for drawfont/drawfontscale.
tweaked the qcvm a little to reduce the number of pointers.
.doll file loading. still experimental and will likely crash. requires csqc active, even if its a dummy progs. this will be fixed in time. Still other things that need cleaning up.
windows: gl_font "?" shows the standard windows font-selection dialog, and can be used to select windows fonts. not all work. and you probably don't want to use windings.
fixed splitscreen support when playing mvds. added mini-scoreboards to splitscreen.
editor/debugger now shows asm if there's no linenumber info. also, pressing f1 for help shows the shortcuts.
Added support for .framegroups files for psk(psa) and iqm formats.
True support for ezquake's colour codes. Mutually exclusive with background colours.
path command output slightly more readable.
added support for digest_hex (MD4, SHA1, CRC16).
skingroups now colourmap correctly.
Fix terrain colour hints, and litdata from the wrong bsp.
fix ftp dual-homed issue. support epsv command, and enable ipv6 (eprt still not supported).
remove d3d11 compilation from the makefile. the required headers are not provided by mingw, and are not available to the build bot, so don't bother.
fix v *= v.x and similar opcodes.
fteqcc: fixed support for áéÃóú type chars in names. utf-8 files now properly supported (even with the utf-8 bom/identifier). utf-16 also supported.
fteqcc: fixed '#if 1 == 3 && 4' parsing.
fteqcc: -Werror acts on the warning, rather than as a separate error. Line numbers are thus more readable.
fteqcc: copyright message now includes compile date instead.
fteqccgui: the treeview control is now coloured depending on whether there were warnings/errors in the last compile.
fteqccgui: the output window is now focused and scrolls down as compilation progresses.
pr_dumpplatform command dumps out some pragmas to convert more serious warnings to errors. This is to avoid the infamous 'fteqcc sucks cos my code sucks' issue.
rewrote prespawn/modelist/soundlist code. server tracks progress now.
------------------------------------------------------------------------
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4167 fc73d0e0-1445-4013-8a0c-d673dee63da5
2013-03-12 22:29:40 +00:00
QCC_PR_ParseErrorPrintDef ( ERR_TYPEMISMATCH , var , " Implicit type mismatch. Needed %s, got %s. " , basictypenames [ wanted ] , basictypenames [ var - > type - > type ] ) ;
2011-09-03 03:49:43 +00:00
if ( o < 0 )
{
if ( fatal )
------------------------------------------------------------------------
r4169 | acceptthis | 2013-01-17 08:55:12 +0000 (Thu, 17 Jan 2013) | 31 lines
removed MAX_VISEDICTS limit.
PEXT2_REPLACEMENTDELTAS tweaked, now has 4 million entity limit. still not enabled by default.
TE_BEAM now maps to a separate TEQW_BEAM to avoid conflicts with QW.
added android multitouch emulation for windows/rawinput (in_simulatemultitouch).
split topcolor/bottomcolor from scoreboard, for dp's colormap|1024 feature.
now using utf-8 for windows consoles.
qcc warnings/errors now give clickable console links for quick+easy editing.
disabled menutint when the currently active item changes contrast or gamma (for OneManClan).
Added support for drawfont/drawfontscale.
tweaked the qcvm a little to reduce the number of pointers.
.doll file loading. still experimental and will likely crash. requires csqc active, even if its a dummy progs. this will be fixed in time. Still other things that need cleaning up.
windows: gl_font "?" shows the standard windows font-selection dialog, and can be used to select windows fonts. not all work. and you probably don't want to use windings.
fixed splitscreen support when playing mvds. added mini-scoreboards to splitscreen.
editor/debugger now shows asm if there's no linenumber info. also, pressing f1 for help shows the shortcuts.
Added support for .framegroups files for psk(psa) and iqm formats.
True support for ezquake's colour codes. Mutually exclusive with background colours.
path command output slightly more readable.
added support for digest_hex (MD4, SHA1, CRC16).
skingroups now colourmap correctly.
Fix terrain colour hints, and litdata from the wrong bsp.
fix ftp dual-homed issue. support epsv command, and enable ipv6 (eprt still not supported).
remove d3d11 compilation from the makefile. the required headers are not provided by mingw, and are not available to the build bot, so don't bother.
fix v *= v.x and similar opcodes.
fteqcc: fixed support for áéÃóú type chars in names. utf-8 files now properly supported (even with the utf-8 bom/identifier). utf-16 also supported.
fteqcc: fixed '#if 1 == 3 && 4' parsing.
fteqcc: -Werror acts on the warning, rather than as a separate error. Line numbers are thus more readable.
fteqcc: copyright message now includes compile date instead.
fteqccgui: the treeview control is now coloured depending on whether there were warnings/errors in the last compile.
fteqccgui: the output window is now focused and scrolls down as compilation progresses.
pr_dumpplatform command dumps out some pragmas to convert more serious warnings to errors. This is to avoid the infamous 'fteqcc sucks cos my code sucks' issue.
rewrote prespawn/modelist/soundlist code. server tracks progress now.
------------------------------------------------------------------------
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4167 fc73d0e0-1445-4013-8a0c-d673dee63da5
2013-03-12 22:29:40 +00:00
QCC_PR_ParseErrorPrintDef ( ERR_TYPEMISMATCH , var , " Implicit type mismatch. Needed %s, got %s. " , basictypenames [ wanted ] , basictypenames [ var - > type - > type ] ) ;
2011-09-03 03:49:43 +00:00
else
return var ;
}
2004-08-23 01:38:21 +00:00
return QCC_PR_Statement ( & pr_opcodes [ o ] , var , NULL , NULL ) ; //conversion return value
}
2011-10-03 02:45:44 +00:00
QCC_def_t * QCC_MakeTranslateStringConst ( char * value ) ;
QCC_def_t * QCC_MakeStringConst ( char * value ) ;
QCC_def_t * QCC_MakeFloatConst ( float value ) ;
QCC_def_t * QCC_MakeIntConst ( int value ) ;
QCC_def_t * QCC_MakeVectorConst ( float a , float b , float c ) ;
2004-08-23 01:38:21 +00:00
2013-03-12 22:32:25 +00:00
int tempsused ;
2004-08-23 01:38:21 +00:00
//assistant functions. This can safly be bipassed with the old method for more complex things.
2013-03-12 22:32:25 +00:00
gofs_t QCC_GetFreeLocalOffsetSpace ( unsigned int size )
{
gofs_t ofs = locals_end ;
locals_end + = size ;
return ofs ;
}
gofs_t QCC_GetFreeTempOffsetSpace ( unsigned int size )
{
gofs_t ofs = FIRST_TEMP + tempsused ;
tempsused + = size ;
return ofs ;
}
gofs_t QCC_GetFreeGlobalOffsetSpace ( unsigned int size )
2004-08-23 01:38:21 +00:00
{
int ofs ;
2011-05-15 13:23:13 +00:00
2004-08-23 01:38:21 +00:00
ofs = numpr_globals ;
numpr_globals + = size ;
if ( numpr_globals > = MAX_REGS )
{
2013-03-12 22:32:25 +00:00
if ( ! opt_overlaptemps | | ! opt_locals_overlapping )
2004-08-23 01:38:21 +00:00
QCC_Error ( ERR_TOOMANYGLOBALS , " numpr_globals exceeded MAX_REGS - you'll need to use more optimisations " ) ;
else
QCC_Error ( ERR_TOOMANYGLOBALS , " numpr_globals exceeded MAX_REGS " ) ;
}
return ofs ;
}
static QCC_def_t * QCC_GetTemp ( QCC_type_t * type )
{
//#define CRAZYTEMPOPTS //not worth it. saves 2 temps with hexen2 (without even touching numpr_globals)
QCC_def_t * var_c ;
temp_t * t ;
# ifdef CRAZYTEMPOPTS
temp_t * best = NULL ;
# endif
var_c = ( void * ) qccHunkAlloc ( sizeof ( QCC_def_t ) ) ;
2011-05-15 13:23:13 +00:00
memset ( var_c , 0 , sizeof ( QCC_def_t ) ) ;
2004-08-23 01:38:21 +00:00
var_c - > type = type ;
var_c - > name = " temp " ;
if ( opt_overlaptemps ) //don't exceed. This lets us allocate a huge block, and still be able to compile smegging big funcs.
{
for ( t = functemps ; t ; t = t - > next )
{
if ( ! t - > used & & t - > size = = type - > size )
{
# ifdef CRAZYTEMPOPTS
best = t ;
if ( t - > scope = = pr_scope )
# endif
break ;
}
}
# ifdef CRAZYTEMPOPTS
t = best ;
# endif
if ( t & & t - > scope & & t - > scope ! = pr_scope )
2013-03-12 22:32:25 +00:00
QCC_Error ( ERR_INTERNAL , " Internal error: temp has scope not equal to current scope " ) ;
2004-08-23 01:38:21 +00:00
if ( ! t )
{
//allocate a new one
t = qccHunkAlloc ( sizeof ( temp_t ) ) ;
t - > size = type - > size ;
t - > next = functemps ;
functemps = t ;
2011-05-15 13:23:13 +00:00
2013-03-12 22:32:25 +00:00
t - > ofs = QCC_GetFreeTempOffsetSpace ( t - > size ) ;
2004-08-23 01:38:21 +00:00
numtemps + = t - > size ;
}
else
optres_overlaptemps + = t - > size ;
//use a previous one.
var_c - > ofs = t - > ofs ;
var_c - > temp = t ;
t - > lastfunc = pr_scope ;
}
2005-12-14 21:03:18 +00:00
else
{
// we're not going to reallocate any temps so allocate permanently
2013-03-12 22:32:25 +00:00
var_c - > ofs = QCC_GetFreeTempOffsetSpace ( type - > size ) ;
2005-12-14 21:03:18 +00:00
numtemps + = type - > size ;
}
2004-08-23 01:38:21 +00:00
var_c - > s_file = s_file ;
var_c - > s_line = pr_source_line ;
if ( var_c - > temp )
var_c - > temp - > used = true ;
return var_c ;
}
//nothing else references this temp.
static void QCC_FreeTemp ( QCC_def_t * t )
{
if ( t & & t - > temp )
t - > temp - > used = false ;
}
static void QCC_UnFreeTemp ( QCC_def_t * t )
{
if ( t - > temp )
t - > temp - > used = true ;
}
//We've just parsed a statement.
//We can gaurentee that any used temps are now not used.
2004-08-25 03:41:27 +00:00
# ifdef _DEBUG
2004-08-23 01:38:21 +00:00
static void QCC_FreeTemps ( void )
{
temp_t * t ;
2009-04-19 00:50:42 +00:00
if ( def_ret . temp & & def_ret . temp - > used )
{
QCC_PR_ParseWarning ( WARN_DEBUGGING , " Return value still in use in %s " , pr_scope - > name ) ;
def_ret . temp - > used = false ;
}
2004-08-23 01:38:21 +00:00
t = functemps ;
while ( t )
{
2004-09-02 12:58:56 +00:00
if ( t - > used & & ! pr_error_count ) //don't print this after an error jump out.
2012-02-05 01:38:51 +00:00
QCC_PR_ParseWarning ( WARN_DEBUGGING , " Internal: temp(ofs %i) was not released in %s. This implies miscompilation. " , t - > ofs , pr_scope - > name ) ;
t - > used = false ;
2004-08-23 01:38:21 +00:00
t = t - > next ;
}
}
2004-08-25 03:41:27 +00:00
# else
# define QCC_FreeTemps()
# endif
2011-03-12 13:51:40 +00:00
void QCC_PurgeTemps ( void )
{
functemps = NULL ;
}
2004-08-23 01:38:21 +00:00
//temps that are still in use over a function call can be considered dodgy.
//we need to remap these to locally defined temps, on return from the function so we know we got them all.
static void QCC_LockActiveTemps ( void )
{
temp_t * t ;
t = functemps ;
while ( t )
{
if ( t - > used )
t - > scope = pr_scope ;
t = t - > next ;
}
2011-05-15 13:23:13 +00:00
2004-08-23 01:38:21 +00:00
}
2010-12-22 00:13:49 +00:00
static void QCC_LockTemp ( QCC_def_t * d )
{
if ( d - > temp & & d - > temp - > used )
d - > temp - > scope = pr_scope ;
}
2012-03-18 20:07:03 +00:00
static void QCC_ForceLockTempForOffset ( int ofs )
{
temp_t * t ;
for ( t = functemps ; t ; t = t - > next )
if ( t - > ofs = = ofs /* && t->used */ )
t - > scope = pr_scope ;
}
2010-12-22 00:13:49 +00:00
2004-08-23 01:38:21 +00:00
static void QCC_RemapLockedTemp ( temp_t * t , int firststatement , int laststatement )
{
# ifdef WRITEASM
char buffer [ 128 ] ;
# endif
QCC_def_t * def ;
int newofs ;
QCC_dstatement_t * st ;
int i ;
newofs = 0 ;
for ( i = firststatement , st = & statements [ i ] ; i < laststatement ; i + + , st + + )
{
2012-07-05 19:42:36 +00:00
if ( pr_opcodes [ st - > op ] . type_a & & st - > a > = t - > ofs & & st - > a < t - > ofs + t - > size )
2004-08-23 01:38:21 +00:00
{
if ( ! newofs )
{
2013-03-12 22:32:25 +00:00
newofs = QCC_GetFreeLocalOffsetSpace ( t - > size ) ;
2004-08-23 01:38:21 +00:00
numtemps + = t - > size ;
2013-03-12 22:32:25 +00:00
def = QCC_PR_DummyDef ( type_float , NULL , pr_scope , t - > size , newofs , false , 0 ) ;
2004-08-23 01:38:21 +00:00
def - > nextlocal = pr . localvars ;
# ifdef WRITEASM
2004-11-13 17:18:34 +00:00
sprintf ( buffer , " locked_%i " , t - > ofs ) ;
2004-08-23 01:38:21 +00:00
def - > name = qccHunkAlloc ( strlen ( buffer ) + 1 ) ;
strcpy ( def - > name , buffer ) ;
# endif
pr . localvars = def ;
}
2012-07-05 19:42:36 +00:00
st - > a = st - > a - t - > ofs + newofs ;
2004-08-23 01:38:21 +00:00
}
2012-07-05 19:42:36 +00:00
if ( pr_opcodes [ st - > op ] . type_b & & st - > b > = t - > ofs & & st - > b < t - > ofs + t - > size )
2004-08-23 01:38:21 +00:00
{
if ( ! newofs )
{
2013-03-12 22:32:25 +00:00
newofs = QCC_GetFreeLocalOffsetSpace ( t - > size ) ;
2004-08-23 01:38:21 +00:00
numtemps + = t - > size ;
2013-03-12 22:32:25 +00:00
def = QCC_PR_DummyDef ( type_float , NULL , pr_scope , t - > size , newofs , false , 0 ) ;
2004-08-23 01:38:21 +00:00
def - > nextlocal = pr . localvars ;
# ifdef WRITEASM
2004-11-13 17:18:34 +00:00
sprintf ( buffer , " locked_%i " , t - > ofs ) ;
2004-08-23 01:38:21 +00:00
def - > name = qccHunkAlloc ( strlen ( buffer ) + 1 ) ;
strcpy ( def - > name , buffer ) ;
# endif
pr . localvars = def ;
}
2012-07-05 19:42:36 +00:00
st - > b = st - > b - t - > ofs + newofs ;
2004-08-23 01:38:21 +00:00
}
2012-07-05 19:42:36 +00:00
if ( pr_opcodes [ st - > op ] . type_c & & st - > c > = t - > ofs & & st - > c < t - > ofs + t - > size )
2004-08-23 01:38:21 +00:00
{
if ( ! newofs )
{
2013-03-12 22:32:25 +00:00
newofs = QCC_GetFreeLocalOffsetSpace ( t - > size ) ;
2004-08-23 01:38:21 +00:00
numtemps + = t - > size ;
2013-03-12 22:32:25 +00:00
def = QCC_PR_DummyDef ( type_float , NULL , pr_scope , t - > size , newofs , false , 0 ) ;
2004-08-23 01:38:21 +00:00
def - > nextlocal = pr . localvars ;
# ifdef WRITEASM
2004-11-13 17:18:34 +00:00
sprintf ( buffer , " locked_%i " , t - > ofs ) ;
2004-08-23 01:38:21 +00:00
def - > name = qccHunkAlloc ( strlen ( buffer ) + 1 ) ;
strcpy ( def - > name , buffer ) ;
# endif
pr . localvars = def ;
}
2012-07-05 19:42:36 +00:00
st - > c = st - > c - t - > ofs + newofs ;
2004-08-23 01:38:21 +00:00
}
}
}
static void QCC_RemapLockedTemps ( int firststatement , int laststatement )
{
temp_t * t ;
t = functemps ;
while ( t )
{
2013-03-12 22:32:25 +00:00
if ( t - > scope )
2004-08-23 01:38:21 +00:00
{
QCC_RemapLockedTemp ( t , firststatement , laststatement ) ;
t - > scope = NULL ;
t - > lastfunc = NULL ;
}
t = t - > next ;
}
}
static void QCC_fprintfLocals ( FILE * f , gofs_t paramstart , gofs_t paramend )
{
QCC_def_t * var ;
temp_t * t ;
int i ;
for ( var = pr . localvars ; var ; var = var - > nextlocal )
{
if ( var - > ofs > = paramstart & & var - > ofs < paramend )
continue ;
2012-01-17 07:57:46 +00:00
if ( var - > arraysize )
2011-09-03 03:49:43 +00:00
fprintf ( f , " local %s %s[%i]; \n " , TypeName ( var - > type ) , var - > name , var - > arraysize ) ;
else
fprintf ( f , " local %s %s; \n " , TypeName ( var - > type ) , var - > name ) ;
2004-08-23 01:38:21 +00:00
}
for ( t = functemps , i = 0 ; t ; t = t - > next , i + + )
{
if ( t - > lastfunc = = pr_scope )
{
fprintf ( f , " local %s temp_%i; \n " , ( t - > size = = 1 ) ? " float " : " vector " , i ) ;
}
}
}
# ifdef WRITEASM
void QCC_WriteAsmFunction ( QCC_def_t * sc , unsigned int firststatement , gofs_t firstparm ) ;
static const char * QCC_VarAtOffset ( unsigned int ofs , unsigned int size )
{
static char message [ 1024 ] ;
QCC_def_t * var ;
//check the temps
temp_t * t ;
int i ;
for ( t = functemps , i = 0 ; t ; t = t - > next , i + + )
{
if ( ofs > = t - > ofs & & ofs < t - > ofs + t - > size )
{
if ( size < t - > size )
2011-10-03 02:45:44 +00:00
sprintf ( message , " temp_%i_%c " , t - > ofs , ' x ' + ( ofs - t - > ofs ) % 3 ) ;
2004-08-23 01:38:21 +00:00
else
2011-10-03 02:45:44 +00:00
sprintf ( message , " temp_%i " , t - > ofs ) ;
2004-08-23 01:38:21 +00:00
return message ;
}
}
for ( var = pr . localvars ; var ; var = var - > nextlocal )
{
if ( var - > scope & & var - > scope ! = pr_scope )
continue ; //this should be an error
if ( ofs > = var - > ofs & & ofs < var - > ofs + var - > type - > size )
{
if ( * var - > name )
{
if ( ! STRCMP ( var - > name , " IMMEDIATE " ) ) //continue, don't get bogged down by multiple bits of code
continue ;
if ( size < var - > type - > size )
sprintf ( message , " %s_%c " , var - > name , ' x ' + ( ofs - var - > ofs ) % 3 ) ;
else
sprintf ( message , " %s " , var - > name ) ;
return message ;
}
}
}
for ( var = pr . def_head . next ; var ; var = var - > next )
{
if ( var - > scope & & var - > scope ! = pr_scope )
continue ;
if ( ofs > = var - > ofs & & ofs < var - > ofs + var - > type - > size )
{
if ( * var - > name )
{
if ( ! STRCMP ( var - > name , " IMMEDIATE " ) )
{
switch ( var - > type - > type )
{
case ev_string :
sprintf ( message , " \" %.1020s \" " , & strings [ ( ( int * ) qcc_pr_globals ) [ var - > ofs ] ] ) ;
return message ;
case ev_integer :
sprintf ( message , " %i " , ( ( int * ) qcc_pr_globals ) [ var - > ofs ] ) ;
return message ;
case ev_float :
sprintf ( message , " %f " , qcc_pr_globals [ var - > ofs ] ) ;
return message ;
case ev_vector :
sprintf ( message , " '%f %f %f' " , qcc_pr_globals [ var - > ofs ] , qcc_pr_globals [ var - > ofs + 1 ] , qcc_pr_globals [ var - > ofs + 2 ] ) ;
return message ;
default :
sprintf ( message , " IMMEDIATE " ) ;
return message ;
}
}
if ( size < var - > type - > size )
sprintf ( message , " %s_%c " , var - > name , ' x ' + ( ofs - var - > ofs ) % 3 ) ;
else
sprintf ( message , " %s " , var - > name ) ;
return message ;
}
}
}
if ( size > = 3 )
{
if ( ofs > = OFS_RETURN & & ofs < OFS_PARM0 )
sprintf ( message , " return " ) ;
else if ( ofs > = OFS_PARM0 & & ofs < RESERVED_OFS )
sprintf ( message , " parm%i " , ( ofs - OFS_PARM0 ) / 3 ) ;
else
sprintf ( message , " offset_%i " , ofs ) ;
}
else
{
if ( ofs > = OFS_RETURN & & ofs < OFS_PARM0 )
sprintf ( message , " return_%c " , ' x ' + ofs - OFS_RETURN ) ;
else if ( ofs > = OFS_PARM0 & & ofs < RESERVED_OFS )
sprintf ( message , " parm%i_%c " , ( ofs - OFS_PARM0 ) / 3 , ' x ' + ( ofs - OFS_PARM0 ) % 3 ) ;
else
sprintf ( message , " offset_%i " , ofs ) ;
}
return message ;
}
# endif
2011-09-03 03:49:43 +00:00
QCC_dstatement_t * QCC_PR_SimpleStatement ( int op , int var_a , int var_b , int var_c , int force ) ;
2011-10-03 02:45:44 +00:00
QCC_def_t * QCC_PR_Statement ( QCC_opcode_t * op , QCC_def_t * var_a , QCC_def_t * var_b , QCC_dstatement_t * * outstatement )
2004-08-23 01:38:21 +00:00
{
QCC_dstatement_t * statement ;
2004-10-13 07:24:59 +00:00
QCC_def_t * var_c = NULL , * temp = NULL ;
2004-08-23 01:38:21 +00:00
if ( outstatement = = ( QCC_dstatement_t * * ) 0xffffffff )
outstatement = NULL ;
2011-09-03 03:49:43 +00:00
else if ( op - > priority ! = - 1 & & op - > priority ! = CONDITION_PRIORITY )
2004-08-23 01:38:21 +00:00
{
if ( op - > associative ! = ASSOC_LEFT )
{
2011-09-03 03:49:43 +00:00
if ( op - > type_a ! = & type_pointer )
var_b = QCC_SupplyConversion ( var_b , ( * op - > type_a ) - > type , false ) ;
2004-08-23 01:38:21 +00:00
}
else
{
if ( var_a )
2011-09-03 03:49:43 +00:00
var_a = QCC_SupplyConversion ( var_a , ( * op - > type_a ) - > type , false ) ;
2004-08-23 01:38:21 +00:00
if ( var_b )
2011-09-03 03:49:43 +00:00
var_b = QCC_SupplyConversion ( var_b , ( * op - > type_b ) - > type , false ) ;
2004-08-23 01:38:21 +00:00
}
}
2004-12-30 12:47:43 +00:00
if ( var_a )
{
var_a - > references + + ;
QCC_FreeTemp ( var_a ) ;
}
if ( var_b )
{
var_b - > references + + ;
QCC_FreeTemp ( var_b ) ;
}
2004-08-23 01:38:21 +00:00
if ( keyword_class & & var_a & & var_b )
{
if ( var_a - > type - > type = = ev_entity & & var_b - > type - > type = = ev_entity )
if ( var_a - > type ! = var_b - > type )
if ( strcmp ( var_a - > type - > name , var_b - > type - > name ) )
2006-09-28 14:55:05 +00:00
QCC_PR_ParseWarning ( 0 , " Implicit cast from '%s' to '%s' " , var_a - > type - > name , var_b - > type - > name ) ;
2004-08-23 01:38:21 +00:00
}
//maths operators
2009-07-03 19:02:42 +00:00
if ( opt_constantarithmatic )
{
if ( var_a & & var_a - > constant )
{
if ( var_b & & var_b - > constant )
{
//both are constants
switch ( op - pr_opcodes ) //improve some of the maths.
{
2011-10-03 02:45:44 +00:00
case OP_LOADA_F :
case OP_LOADA_V :
case OP_LOADA_S :
case OP_LOADA_ENT :
case OP_LOADA_FLD :
case OP_LOADA_FNC :
case OP_LOADA_I :
{
QCC_def_t * nd ;
nd = ( void * ) qccHunkAlloc ( sizeof ( QCC_def_t ) ) ;
memset ( nd , 0 , sizeof ( QCC_def_t ) ) ;
nd - > type = var_a - > type ;
nd - > ofs = var_a - > ofs + G_INT ( var_b - > ofs ) ;
nd - > temp = var_a - > temp ;
nd - > constant = true ;
nd - > name = var_a - > name ;
return nd ;
}
break ;
2011-07-08 18:59:48 +00:00
case OP_BITOR_F :
2009-07-03 19:02:42 +00:00
optres_constantarithmatic + + ;
2011-10-03 02:45:44 +00:00
return QCC_MakeFloatConst ( ( float ) ( ( int ) G_FLOAT ( var_a - > ofs ) | ( int ) G_FLOAT ( var_b - > ofs ) ) ) ;
2011-07-08 18:59:48 +00:00
case OP_BITAND_F :
2009-07-03 19:02:42 +00:00
optres_constantarithmatic + + ;
2011-10-03 02:45:44 +00:00
return QCC_MakeFloatConst ( ( float ) ( ( int ) G_FLOAT ( var_a - > ofs ) & ( int ) G_FLOAT ( var_b - > ofs ) ) ) ;
2009-07-03 19:02:42 +00:00
case OP_MUL_F :
optres_constantarithmatic + + ;
2011-10-03 02:45:44 +00:00
return QCC_MakeFloatConst ( G_FLOAT ( var_a - > ofs ) * G_FLOAT ( var_b - > ofs ) ) ;
2009-07-03 19:02:42 +00:00
case OP_DIV_F :
optres_constantarithmatic + + ;
2011-10-03 02:45:44 +00:00
return QCC_MakeFloatConst ( G_FLOAT ( var_a - > ofs ) / G_FLOAT ( var_b - > ofs ) ) ;
2009-07-03 19:02:42 +00:00
case OP_ADD_F :
optres_constantarithmatic + + ;
2011-10-03 02:45:44 +00:00
return QCC_MakeFloatConst ( G_FLOAT ( var_a - > ofs ) + G_FLOAT ( var_b - > ofs ) ) ;
2009-07-03 19:02:42 +00:00
case OP_SUB_F :
optres_constantarithmatic + + ;
2011-10-03 02:45:44 +00:00
return QCC_MakeFloatConst ( G_FLOAT ( var_a - > ofs ) - G_FLOAT ( var_b - > ofs ) ) ;
2009-07-03 19:02:42 +00:00
case OP_BITOR_I :
optres_constantarithmatic + + ;
2011-10-03 02:45:44 +00:00
return QCC_MakeIntConst ( G_INT ( var_a - > ofs ) | G_INT ( var_b - > ofs ) ) ;
2009-07-03 19:02:42 +00:00
case OP_BITAND_I :
optres_constantarithmatic + + ;
2011-10-03 02:45:44 +00:00
return QCC_MakeIntConst ( G_INT ( var_a - > ofs ) & G_INT ( var_b - > ofs ) ) ;
2009-07-03 19:02:42 +00:00
case OP_MUL_I :
optres_constantarithmatic + + ;
2011-10-03 02:45:44 +00:00
return QCC_MakeIntConst ( G_INT ( var_a - > ofs ) * G_INT ( var_b - > ofs ) ) ;
2009-07-03 19:02:42 +00:00
case OP_DIV_I :
optres_constantarithmatic + + ;
------------------------------------------------------------------------
r4169 | acceptthis | 2013-01-17 08:55:12 +0000 (Thu, 17 Jan 2013) | 31 lines
removed MAX_VISEDICTS limit.
PEXT2_REPLACEMENTDELTAS tweaked, now has 4 million entity limit. still not enabled by default.
TE_BEAM now maps to a separate TEQW_BEAM to avoid conflicts with QW.
added android multitouch emulation for windows/rawinput (in_simulatemultitouch).
split topcolor/bottomcolor from scoreboard, for dp's colormap|1024 feature.
now using utf-8 for windows consoles.
qcc warnings/errors now give clickable console links for quick+easy editing.
disabled menutint when the currently active item changes contrast or gamma (for OneManClan).
Added support for drawfont/drawfontscale.
tweaked the qcvm a little to reduce the number of pointers.
.doll file loading. still experimental and will likely crash. requires csqc active, even if its a dummy progs. this will be fixed in time. Still other things that need cleaning up.
windows: gl_font "?" shows the standard windows font-selection dialog, and can be used to select windows fonts. not all work. and you probably don't want to use windings.
fixed splitscreen support when playing mvds. added mini-scoreboards to splitscreen.
editor/debugger now shows asm if there's no linenumber info. also, pressing f1 for help shows the shortcuts.
Added support for .framegroups files for psk(psa) and iqm formats.
True support for ezquake's colour codes. Mutually exclusive with background colours.
path command output slightly more readable.
added support for digest_hex (MD4, SHA1, CRC16).
skingroups now colourmap correctly.
Fix terrain colour hints, and litdata from the wrong bsp.
fix ftp dual-homed issue. support epsv command, and enable ipv6 (eprt still not supported).
remove d3d11 compilation from the makefile. the required headers are not provided by mingw, and are not available to the build bot, so don't bother.
fix v *= v.x and similar opcodes.
fteqcc: fixed support for áéÃóú type chars in names. utf-8 files now properly supported (even with the utf-8 bom/identifier). utf-16 also supported.
fteqcc: fixed '#if 1 == 3 && 4' parsing.
fteqcc: -Werror acts on the warning, rather than as a separate error. Line numbers are thus more readable.
fteqcc: copyright message now includes compile date instead.
fteqccgui: the treeview control is now coloured depending on whether there were warnings/errors in the last compile.
fteqccgui: the output window is now focused and scrolls down as compilation progresses.
pr_dumpplatform command dumps out some pragmas to convert more serious warnings to errors. This is to avoid the infamous 'fteqcc sucks cos my code sucks' issue.
rewrote prespawn/modelist/soundlist code. server tracks progress now.
------------------------------------------------------------------------
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4167 fc73d0e0-1445-4013-8a0c-d673dee63da5
2013-03-12 22:29:40 +00:00
if ( G_INT ( var_b - > ofs ) = = 0 )
{
QCC_PR_ParseWarning ( WARN_CONSTANTCOMPARISON , " Division by constant 0 " ) ;
return QCC_MakeIntConst ( 0 ) ;
}
else
return QCC_MakeIntConst ( G_INT ( var_a - > ofs ) / G_INT ( var_b - > ofs ) ) ;
2009-07-03 19:02:42 +00:00
case OP_ADD_I :
optres_constantarithmatic + + ;
2011-10-03 02:45:44 +00:00
return QCC_MakeIntConst ( G_INT ( var_a - > ofs ) + G_INT ( var_b - > ofs ) ) ;
2009-07-03 19:02:42 +00:00
case OP_SUB_I :
optres_constantarithmatic + + ;
2011-10-03 02:45:44 +00:00
return QCC_MakeIntConst ( G_INT ( var_a - > ofs ) - G_INT ( var_b - > ofs ) ) ;
2009-07-03 19:02:42 +00:00
2012-12-04 19:37:57 +00:00
case OP_ADD_IF :
optres_constantarithmatic + + ;
return QCC_MakeFloatConst ( G_INT ( var_a - > ofs ) + G_FLOAT ( var_b - > ofs ) ) ;
case OP_ADD_FI :
optres_constantarithmatic + + ;
return QCC_MakeFloatConst ( G_FLOAT ( var_a - > ofs ) + G_INT ( var_b - > ofs ) ) ;
2011-07-08 18:59:48 +00:00
case OP_AND_F :
2009-07-03 19:02:42 +00:00
optres_constantarithmatic + + ;
2011-10-03 02:45:44 +00:00
return QCC_MakeIntConst ( G_INT ( var_a - > ofs ) & & G_INT ( var_b - > ofs ) ) ;
2011-07-08 18:59:48 +00:00
case OP_OR_F :
2009-07-03 19:02:42 +00:00
optres_constantarithmatic + + ;
2011-10-03 02:45:44 +00:00
return QCC_MakeIntConst ( G_INT ( var_a - > ofs ) | | G_INT ( var_b - > ofs ) ) ;
2009-07-03 19:02:42 +00:00
case OP_MUL_V : //mul_f is actually a dot-product
optres_constantarithmatic + + ;
2011-10-03 02:45:44 +00:00
return QCC_MakeFloatConst ( G_FLOAT ( var_a - > ofs ) * G_FLOAT ( var_b - > ofs + 0 ) +
2009-07-03 19:02:42 +00:00
G_FLOAT ( var_a - > ofs ) * G_FLOAT ( var_b - > ofs + 1 ) +
G_FLOAT ( var_a - > ofs ) * G_FLOAT ( var_b - > ofs + 2 ) ) ;
case OP_MUL_FV :
optres_constantarithmatic + + ;
2011-10-03 02:45:44 +00:00
return QCC_MakeVectorConst ( G_FLOAT ( var_a - > ofs ) * G_FLOAT ( var_b - > ofs + 0 ) ,
2009-07-03 19:02:42 +00:00
G_FLOAT ( var_a - > ofs ) * G_FLOAT ( var_b - > ofs + 1 ) ,
G_FLOAT ( var_a - > ofs ) * G_FLOAT ( var_b - > ofs + 2 ) ) ;
case OP_MUL_VF :
optres_constantarithmatic + + ;
2011-10-03 02:45:44 +00:00
return QCC_MakeVectorConst ( G_FLOAT ( var_a - > ofs + 0 ) * G_FLOAT ( var_b - > ofs ) ,
2009-07-03 19:02:42 +00:00
G_FLOAT ( var_a - > ofs + 1 ) * G_FLOAT ( var_b - > ofs ) ,
G_FLOAT ( var_a - > ofs + 2 ) * G_FLOAT ( var_b - > ofs ) ) ;
case OP_ADD_V :
optres_constantarithmatic + + ;
2011-10-03 02:45:44 +00:00
return QCC_MakeVectorConst ( G_FLOAT ( var_a - > ofs + 0 ) + G_FLOAT ( var_b - > ofs + 0 ) ,
2009-07-03 19:02:42 +00:00
G_FLOAT ( var_a - > ofs + 1 ) + G_FLOAT ( var_b - > ofs + 1 ) ,
G_FLOAT ( var_a - > ofs + 2 ) + G_FLOAT ( var_b - > ofs + 2 ) ) ;
case OP_SUB_V :
optres_constantarithmatic + + ;
2011-10-03 02:45:44 +00:00
return QCC_MakeVectorConst ( G_FLOAT ( var_a - > ofs + 0 ) - G_FLOAT ( var_b - > ofs + 0 ) ,
2009-07-03 19:02:42 +00:00
G_FLOAT ( var_a - > ofs + 1 ) - G_FLOAT ( var_b - > ofs + 1 ) ,
G_FLOAT ( var_a - > ofs + 2 ) - G_FLOAT ( var_b - > ofs + 2 ) ) ;
}
}
else
{
//a is const, b is not
switch ( op - pr_opcodes )
{
2011-08-16 04:12:15 +00:00
case OP_CONV_FTOI :
optres_constantarithmatic + + ;
2011-10-03 02:45:44 +00:00
return QCC_MakeIntConst ( G_FLOAT ( var_a - > ofs ) ) ;
2011-08-16 04:12:15 +00:00
case OP_CONV_ITOF :
optres_constantarithmatic + + ;
2011-10-03 02:45:44 +00:00
return QCC_MakeFloatConst ( G_INT ( var_a - > ofs ) ) ;
2011-07-08 18:59:48 +00:00
case OP_BITOR_F :
case OP_OR_F :
2009-07-03 19:02:42 +00:00
case OP_ADD_F :
if ( G_FLOAT ( var_a - > ofs ) = = 0 )
{
optres_constantarithmatic + + ;
QCC_UnFreeTemp ( var_b ) ;
return var_b ;
}
break ;
case OP_MUL_F :
if ( G_FLOAT ( var_a - > ofs ) = = 1 )
{
optres_constantarithmatic + + ;
QCC_UnFreeTemp ( var_b ) ;
return var_b ;
}
break ;
2011-07-08 18:59:48 +00:00
case OP_BITAND_F :
case OP_AND_F :
2009-07-03 19:02:42 +00:00
if ( G_FLOAT ( var_a - > ofs ) ! = 0 )
{
optres_constantarithmatic + + ;
QCC_UnFreeTemp ( var_b ) ;
return var_b ;
}
break ;
2004-08-23 01:38:21 +00:00
2009-07-03 19:02:42 +00:00
case OP_BITOR_I :
case OP_OR_I :
case OP_ADD_I :
if ( G_INT ( var_a - > ofs ) = = 0 )
{
optres_constantarithmatic + + ;
QCC_UnFreeTemp ( var_b ) ;
return var_b ;
}
break ;
case OP_MUL_I :
if ( G_INT ( var_a - > ofs ) = = 1 )
{
optres_constantarithmatic + + ;
QCC_UnFreeTemp ( var_b ) ;
return var_b ;
}
break ;
case OP_BITAND_I :
case OP_AND_I :
if ( G_INT ( var_a - > ofs ) ! = 0 )
{
optres_constantarithmatic + + ;
QCC_UnFreeTemp ( var_b ) ;
return var_b ;
}
break ;
}
}
}
else if ( var_b & & var_b - > constant )
{
//b is const, a is not
switch ( op - pr_opcodes )
{
2011-10-03 02:45:44 +00:00
case OP_LOADA_F :
case OP_LOADA_V :
case OP_LOADA_S :
case OP_LOADA_ENT :
case OP_LOADA_FLD :
case OP_LOADA_FNC :
case OP_LOADA_I :
{
QCC_def_t * nd ;
nd = ( void * ) qccHunkAlloc ( sizeof ( QCC_def_t ) ) ;
memset ( nd , 0 , sizeof ( QCC_def_t ) ) ;
nd - > type = var_a - > type ;
nd - > ofs = var_a - > ofs + G_INT ( var_b - > ofs ) ;
nd - > temp = var_a - > temp ;
nd - > constant = false ;
nd - > name = var_a - > name ;
return nd ;
}
break ;
2011-07-08 18:59:48 +00:00
case OP_BITOR_F :
case OP_OR_F :
2009-07-03 19:02:42 +00:00
case OP_SUB_F :
case OP_ADD_F :
if ( G_FLOAT ( var_b - > ofs ) = = 0 )
{
optres_constantarithmatic + + ;
QCC_UnFreeTemp ( var_a ) ;
return var_a ;
}
break ;
case OP_DIV_F :
case OP_MUL_F :
if ( G_FLOAT ( var_b - > ofs ) = = 1 )
{
optres_constantarithmatic + + ;
QCC_UnFreeTemp ( var_a ) ;
return var_a ;
}
break ;
//no bitand_f, I don't trust the casts
2011-07-08 18:59:48 +00:00
case OP_AND_F :
2009-07-03 19:02:42 +00:00
if ( G_FLOAT ( var_b - > ofs ) ! = 0 )
{
optres_constantarithmatic + + ;
QCC_UnFreeTemp ( var_a ) ;
return var_a ;
}
break ;
case OP_BITOR_I :
case OP_OR_I :
case OP_SUB_I :
case OP_ADD_I :
if ( G_INT ( var_b - > ofs ) = = 0 )
{
optres_constantarithmatic + + ;
QCC_UnFreeTemp ( var_a ) ;
return var_a ;
}
break ;
case OP_DIV_I :
case OP_MUL_I :
if ( G_INT ( var_b - > ofs ) = = 1 )
{
optres_constantarithmatic + + ;
QCC_UnFreeTemp ( var_a ) ;
return var_a ;
}
break ;
case OP_BITAND_I :
if ( G_INT ( var_b - > ofs ) = = 0xffffffff )
{
optres_constantarithmatic + + ;
QCC_UnFreeTemp ( var_a ) ;
return var_a ;
}
case OP_AND_I :
2011-09-03 03:49:43 +00:00
if ( G_INT ( var_b - > ofs ) = = 0 )
2009-07-03 19:02:42 +00:00
{
optres_constantarithmatic + + ;
QCC_UnFreeTemp ( var_a ) ;
return var_a ;
}
break ;
}
2004-08-23 01:38:21 +00:00
}
}
switch ( op - pr_opcodes )
{
2011-09-03 03:49:43 +00:00
case OP_LOADA_F :
case OP_LOADA_V :
case OP_LOADA_S :
case OP_LOADA_ENT :
case OP_LOADA_FLD :
case OP_LOADA_FNC :
case OP_LOADA_I :
break ;
2011-07-08 18:59:48 +00:00
case OP_AND_F :
2004-08-23 01:38:21 +00:00
if ( var_a - > ofs = = var_b - > ofs )
2005-09-28 16:57:10 +00:00
QCC_PR_ParseWarning ( WARN_CONSTANTCOMPARISON , " Parameter offsets for && are the same " ) ;
2004-08-23 01:38:21 +00:00
if ( var_a - > constant | | var_b - > constant )
2005-09-28 16:57:10 +00:00
QCC_PR_ParseWarning ( WARN_CONSTANTCOMPARISON , " Result of comparison is constant " ) ;
2004-08-23 01:38:21 +00:00
break ;
2011-07-08 18:59:48 +00:00
case OP_OR_F :
2004-08-23 01:38:21 +00:00
if ( var_a - > ofs = = var_b - > ofs )
2005-09-28 16:57:10 +00:00
QCC_PR_ParseWarning ( WARN_CONSTANTCOMPARISON , " Parameters for || are the same " ) ;
2004-08-23 01:38:21 +00:00
if ( var_a - > constant | | var_b - > constant )
2005-09-28 16:57:10 +00:00
QCC_PR_ParseWarning ( WARN_CONSTANTCOMPARISON , " Result of comparison is constant " ) ;
2004-08-23 01:38:21 +00:00
break ;
case OP_EQ_F :
case OP_EQ_S :
case OP_EQ_E :
case OP_EQ_FNC :
2005-06-14 04:52:10 +00:00
// if (opt_shortenifnots)
// if (var_b->constant && ((int*)qcc_pr_globals)[var_b->ofs]==0) // (a == 0) becomes (!a)
// op = &pr_opcodes[(op - pr_opcodes) - OP_EQ_F + OP_NOT_F];
case OP_EQ_V :
2004-08-23 01:38:21 +00:00
case OP_NE_F :
case OP_NE_V :
case OP_NE_S :
case OP_NE_E :
case OP_NE_FNC :
2011-07-08 18:59:48 +00:00
case OP_LE_F :
case OP_GE_F :
case OP_LT_F :
case OP_GT_F :
2004-08-23 01:38:21 +00:00
if ( ( var_a - > constant & & var_b - > constant & & ! var_a - > temp & & ! var_b - > temp ) | | var_a - > ofs = = var_b - > ofs )
2005-09-28 16:57:10 +00:00
QCC_PR_ParseWarning ( WARN_CONSTANTCOMPARISON , " Result of comparison is constant " ) ;
2004-08-23 01:38:21 +00:00
break ;
2009-08-29 14:56:42 +00:00
case OP_IF_S :
case OP_IFNOT_S :
case OP_IF_F :
case OP_IFNOT_F :
2011-07-08 18:59:48 +00:00
case OP_IF_I :
case OP_IFNOT_I :
2004-11-09 06:02:02 +00:00
// if (var_a->type->type == ev_function && !var_a->temp)
2005-09-28 16:57:10 +00:00
// QCC_PR_ParseWarning(WARN_CONSTANTCOMPARISON, "Result of comparison is constant");
2004-11-09 06:02:02 +00:00
if ( var_a - > constant & & ! var_a - > temp )
2005-09-28 16:57:10 +00:00
QCC_PR_ParseWarning ( WARN_CONSTANTCOMPARISON , " Result of comparison is constant " ) ;
2004-08-23 01:38:21 +00:00
break ;
default :
break ;
}
if ( numstatements )
{ //optimise based on last statement.
2011-07-08 18:59:48 +00:00
if ( op - pr_opcodes = = OP_IFNOT_I )
2004-08-23 01:38:21 +00:00
{
if ( opt_shortenifnots & & var_a & & ( statements [ numstatements - 1 ] . op = = OP_NOT_F | | statements [ numstatements - 1 ] . op = = OP_NOT_FNC | | statements [ numstatements - 1 ] . op = = OP_NOT_ENT ) )
{
if ( statements [ numstatements - 1 ] . c = = var_a - > ofs )
{
static QCC_def_t nvara ;
2013-03-12 22:35:33 +00:00
if ( statements [ numstatements - 1 ] . op = = OP_NOT_F & & QCC_OPCodeValid ( & pr_opcodes [ OP_IF_F ] ) )
2009-08-29 14:56:42 +00:00
op = & pr_opcodes [ OP_IF_F ] ;
else
2011-07-08 18:59:48 +00:00
op = & pr_opcodes [ OP_IF_I ] ;
2004-08-23 01:38:21 +00:00
numstatements - - ;
QCC_FreeTemp ( var_a ) ;
memcpy ( & nvara , var_a , sizeof ( nvara ) ) ;
nvara . ofs = statements [ numstatements ] . a ;
var_a = & nvara ;
optres_shortenifnots + + ;
}
}
}
2009-08-29 14:56:42 +00:00
else if ( op - pr_opcodes = = OP_IFNOT_F )
{
if ( opt_shortenifnots & & var_a & & statements [ numstatements - 1 ] . op = = OP_NOT_F )
{
if ( statements [ numstatements - 1 ] . c = = var_a - > ofs )
{
static QCC_def_t nvara ;
op = & pr_opcodes [ OP_IF_F ] ;
numstatements - - ;
QCC_FreeTemp ( var_a ) ;
memcpy ( & nvara , var_a , sizeof ( nvara ) ) ;
nvara . ofs = statements [ numstatements ] . a ;
var_a = & nvara ;
optres_shortenifnots + + ;
}
}
}
else if ( op - pr_opcodes = = OP_IFNOT_S )
2004-08-23 01:38:21 +00:00
{
if ( opt_shortenifnots & & var_a & & statements [ numstatements - 1 ] . op = = OP_NOT_S )
{
if ( statements [ numstatements - 1 ] . c = = var_a - > ofs )
{
static QCC_def_t nvara ;
2009-08-29 14:56:42 +00:00
op = & pr_opcodes [ OP_IF_S ] ;
2004-08-23 01:38:21 +00:00
numstatements - - ;
QCC_FreeTemp ( var_a ) ;
memcpy ( & nvara , var_a , sizeof ( nvara ) ) ;
nvara . ofs = statements [ numstatements ] . a ;
var_a = & nvara ;
optres_shortenifnots + + ;
}
}
}
2009-08-29 14:56:42 +00:00
else if ( ( ( unsigned ) ( ( op - pr_opcodes ) - OP_STORE_F ) < 6 ) | | ( op - pr_opcodes ) = = OP_STORE_P )
2004-08-23 01:38:21 +00:00
{
2008-07-10 20:38:17 +00:00
// remove assignments if what should be assigned is the 3rd operand of the previous statement?
// don't if it's a call, callH, switch or case
// && var_a->ofs >RESERVED_OFS)
if ( OpAssignsToC ( statements [ numstatements - 1 ] . op ) & &
opt_assignments & & var_a & & var_a - > ofs = = statements [ numstatements - 1 ] . c )
2004-08-23 01:38:21 +00:00
{
if ( var_a - > type - > type = = var_b - > type - > type )
{
if ( var_a - > temp )
{
statement = & statements [ numstatements - 1 ] ;
statement - > c = var_b - > ofs ;
if ( var_a - > type - > type ! = var_b - > type - > type )
QCC_PR_ParseWarning ( 0 , " store type mismatch " ) ;
var_b - > references + + ;
var_a - > references - - ;
QCC_FreeTemp ( var_a ) ;
optres_assignments + + ;
simplestore = true ;
QCC_UnFreeTemp ( var_b ) ;
return var_b ;
}
}
}
}
}
simplestore = false ;
2011-05-15 13:23:13 +00:00
2004-08-23 01:38:21 +00:00
statement = & statements [ numstatements ] ;
numstatements + + ;
if ( ! QCC_OPCodeValid ( op ) )
{
switch ( op - pr_opcodes )
{
2012-01-28 10:30:44 +00:00
case OP_LOADA_STRUCT :
/*emit this anyway. if it reaches runtime then you messed up.
this is valid only if you do & foo [ 0 ] */
------------------------------------------------------------------------
r4169 | acceptthis | 2013-01-17 08:55:12 +0000 (Thu, 17 Jan 2013) | 31 lines
removed MAX_VISEDICTS limit.
PEXT2_REPLACEMENTDELTAS tweaked, now has 4 million entity limit. still not enabled by default.
TE_BEAM now maps to a separate TEQW_BEAM to avoid conflicts with QW.
added android multitouch emulation for windows/rawinput (in_simulatemultitouch).
split topcolor/bottomcolor from scoreboard, for dp's colormap|1024 feature.
now using utf-8 for windows consoles.
qcc warnings/errors now give clickable console links for quick+easy editing.
disabled menutint when the currently active item changes contrast or gamma (for OneManClan).
Added support for drawfont/drawfontscale.
tweaked the qcvm a little to reduce the number of pointers.
.doll file loading. still experimental and will likely crash. requires csqc active, even if its a dummy progs. this will be fixed in time. Still other things that need cleaning up.
windows: gl_font "?" shows the standard windows font-selection dialog, and can be used to select windows fonts. not all work. and you probably don't want to use windings.
fixed splitscreen support when playing mvds. added mini-scoreboards to splitscreen.
editor/debugger now shows asm if there's no linenumber info. also, pressing f1 for help shows the shortcuts.
Added support for .framegroups files for psk(psa) and iqm formats.
True support for ezquake's colour codes. Mutually exclusive with background colours.
path command output slightly more readable.
added support for digest_hex (MD4, SHA1, CRC16).
skingroups now colourmap correctly.
Fix terrain colour hints, and litdata from the wrong bsp.
fix ftp dual-homed issue. support epsv command, and enable ipv6 (eprt still not supported).
remove d3d11 compilation from the makefile. the required headers are not provided by mingw, and are not available to the build bot, so don't bother.
fix v *= v.x and similar opcodes.
fteqcc: fixed support for áéÃóú type chars in names. utf-8 files now properly supported (even with the utf-8 bom/identifier). utf-16 also supported.
fteqcc: fixed '#if 1 == 3 && 4' parsing.
fteqcc: -Werror acts on the warning, rather than as a separate error. Line numbers are thus more readable.
fteqcc: copyright message now includes compile date instead.
fteqccgui: the treeview control is now coloured depending on whether there were warnings/errors in the last compile.
fteqccgui: the output window is now focused and scrolls down as compilation progresses.
pr_dumpplatform command dumps out some pragmas to convert more serious warnings to errors. This is to avoid the infamous 'fteqcc sucks cos my code sucks' issue.
rewrote prespawn/modelist/soundlist code. server tracks progress now.
------------------------------------------------------------------------
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4167 fc73d0e0-1445-4013-8a0c-d673dee63da5
2013-03-12 22:29:40 +00:00
// QCC_PR_ParseWarning(0, "OP_LOADA_STRUCT: cannot emulate");
break ;
case OP_ADD_I :
{
QCC_def_t * arg [ 2 ] = { var_a , var_b } ;
numstatements - - ;
def_parms [ 0 ] . type = type_integer ;
def_parms [ 1 ] . type = type_integer ;
var_c = QCC_PR_GenerateFunctionCall ( QCC_PR_GetDef ( type_function , " AddInt " , NULL , true , 0 , false ) , arg , 2 ) ;
var_c - > type = type_integer ;
return var_c ;
}
break ;
case OP_SUB_I :
{
QCC_def_t * arg [ 2 ] = { var_a , var_b } ;
numstatements - - ;
def_parms [ 0 ] . type = type_integer ;
def_parms [ 1 ] . type = type_integer ;
var_c = QCC_PR_GenerateFunctionCall ( QCC_PR_GetDef ( type_function , " SubInt " , NULL , true , 0 , false ) , arg , 2 ) ;
var_c - > type = type_integer ;
return var_c ;
}
break ;
case OP_MUL_I :
{
QCC_def_t * arg [ 2 ] = { var_a , var_b } ;
numstatements - - ;
def_parms [ 0 ] . type = type_integer ;
def_parms [ 1 ] . type = type_integer ;
var_c = QCC_PR_GenerateFunctionCall ( QCC_PR_GetDef ( type_function , " MulInt " , NULL , true , 0 , false ) , arg , 2 ) ;
var_c - > type = type_integer ;
return var_c ;
}
break ;
case OP_DIV_I :
{
QCC_def_t * arg [ 2 ] = { var_a , var_b } ;
numstatements - - ;
def_parms [ 0 ] . type = type_integer ;
def_parms [ 1 ] . type = type_integer ;
var_c = QCC_PR_GenerateFunctionCall ( QCC_PR_GetDef ( type_function , " DivInt " , NULL , true , 0 , false ) , arg , 2 ) ;
var_c - > type = type_integer ;
return var_c ;
}
2012-01-28 10:30:44 +00:00
break ;
------------------------------------------------------------------------
r4169 | acceptthis | 2013-01-17 08:55:12 +0000 (Thu, 17 Jan 2013) | 31 lines
removed MAX_VISEDICTS limit.
PEXT2_REPLACEMENTDELTAS tweaked, now has 4 million entity limit. still not enabled by default.
TE_BEAM now maps to a separate TEQW_BEAM to avoid conflicts with QW.
added android multitouch emulation for windows/rawinput (in_simulatemultitouch).
split topcolor/bottomcolor from scoreboard, for dp's colormap|1024 feature.
now using utf-8 for windows consoles.
qcc warnings/errors now give clickable console links for quick+easy editing.
disabled menutint when the currently active item changes contrast or gamma (for OneManClan).
Added support for drawfont/drawfontscale.
tweaked the qcvm a little to reduce the number of pointers.
.doll file loading. still experimental and will likely crash. requires csqc active, even if its a dummy progs. this will be fixed in time. Still other things that need cleaning up.
windows: gl_font "?" shows the standard windows font-selection dialog, and can be used to select windows fonts. not all work. and you probably don't want to use windings.
fixed splitscreen support when playing mvds. added mini-scoreboards to splitscreen.
editor/debugger now shows asm if there's no linenumber info. also, pressing f1 for help shows the shortcuts.
Added support for .framegroups files for psk(psa) and iqm formats.
True support for ezquake's colour codes. Mutually exclusive with background colours.
path command output slightly more readable.
added support for digest_hex (MD4, SHA1, CRC16).
skingroups now colourmap correctly.
Fix terrain colour hints, and litdata from the wrong bsp.
fix ftp dual-homed issue. support epsv command, and enable ipv6 (eprt still not supported).
remove d3d11 compilation from the makefile. the required headers are not provided by mingw, and are not available to the build bot, so don't bother.
fix v *= v.x and similar opcodes.
fteqcc: fixed support for áéÃóú type chars in names. utf-8 files now properly supported (even with the utf-8 bom/identifier). utf-16 also supported.
fteqcc: fixed '#if 1 == 3 && 4' parsing.
fteqcc: -Werror acts on the warning, rather than as a separate error. Line numbers are thus more readable.
fteqcc: copyright message now includes compile date instead.
fteqccgui: the treeview control is now coloured depending on whether there were warnings/errors in the last compile.
fteqccgui: the output window is now focused and scrolls down as compilation progresses.
pr_dumpplatform command dumps out some pragmas to convert more serious warnings to errors. This is to avoid the infamous 'fteqcc sucks cos my code sucks' issue.
rewrote prespawn/modelist/soundlist code. server tracks progress now.
------------------------------------------------------------------------
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4167 fc73d0e0-1445-4013-8a0c-d673dee63da5
2013-03-12 22:29:40 +00:00
case OP_CONV_ITOF :
case OP_STORE_IF :
op = pr_opcodes + OP_STORE_F ;
if ( var_a - > constant )
var_a = QCC_MakeFloatConst ( G_INT ( var_a - > ofs ) ) ;
else
{
numstatements - - ;
def_parms [ 0 ] . type = type_integer ;
var_a = QCC_PR_GenerateFunctionCall ( QCC_PR_GetDef ( type_function , " itof " , NULL , true , 0 , false ) , & var_a , 1 ) ;
var_a - > type = type_float ;
statement = & statements [ numstatements ] ;
numstatements + + ;
}
break ;
case OP_CONV_FTOI :
case OP_STORE_FI :
op = pr_opcodes + OP_STORE_I ;
if ( var_a - > constant )
var_a = QCC_MakeFloatConst ( G_INT ( var_a - > ofs ) ) ;
else
{
numstatements - - ;
def_parms [ 0 ] . type = type_float ;
var_a = QCC_PR_GenerateFunctionCall ( QCC_PR_GetDef ( type_function , " ftoi " , NULL , true , 0 , false ) , & var_a , 1 ) ;
var_a - > type = type_integer ;
statement = & statements [ numstatements ] ;
numstatements + + ;
}
break ;
case OP_STORE_I :
op = pr_opcodes + OP_STORE_F ;
break ;
2012-01-28 10:30:44 +00:00
2009-08-29 14:56:42 +00:00
case OP_IF_S :
2012-01-17 07:57:46 +00:00
var_c = QCC_PR_GetDef ( type_string , " string_null " , NULL , true , 0 , false ) ;
2004-08-23 01:38:21 +00:00
numstatements - - ;
2004-10-20 13:45:19 +00:00
var_a = QCC_PR_Statement ( & pr_opcodes [ OP_NE_S ] , var_a , var_c , NULL ) ;
2004-08-23 01:38:21 +00:00
statement = & statements [ numstatements ] ;
numstatements + + ;
QCC_FreeTemp ( var_a ) ;
2011-07-08 18:59:48 +00:00
op = & pr_opcodes [ OP_IF_I ] ;
2004-08-23 01:38:21 +00:00
break ;
2009-08-29 14:56:42 +00:00
case OP_IFNOT_S :
2012-01-17 07:57:46 +00:00
var_c = QCC_PR_GetDef ( type_string , " string_null " , NULL , true , 0 , false ) ;
2004-08-23 01:38:21 +00:00
numstatements - - ;
var_a = QCC_PR_Statement ( & pr_opcodes [ OP_NE_S ] , var_a , var_c , NULL ) ;
statement = & statements [ numstatements ] ;
numstatements + + ;
QCC_FreeTemp ( var_a ) ;
2011-07-08 18:59:48 +00:00
op = & pr_opcodes [ OP_IFNOT_I ] ;
2004-08-23 01:38:21 +00:00
break ;
2009-08-29 14:56:42 +00:00
case OP_IF_F :
2011-10-03 02:45:44 +00:00
var_c = QCC_MakeFloatConst ( 0 ) ;
2009-08-29 14:56:42 +00:00
numstatements - - ;
var_a = QCC_PR_Statement ( & pr_opcodes [ OP_NE_F ] , var_a , var_c , NULL ) ;
statement = & statements [ numstatements ] ;
numstatements + + ;
QCC_FreeTemp ( var_a ) ;
2011-07-08 18:59:48 +00:00
op = & pr_opcodes [ OP_IF_I ] ;
2009-08-29 14:56:42 +00:00
break ;
case OP_IFNOT_F :
2011-10-03 02:45:44 +00:00
var_c = QCC_MakeFloatConst ( 0 ) ;
2009-08-29 14:56:42 +00:00
numstatements - - ;
var_a = QCC_PR_Statement ( & pr_opcodes [ OP_NE_F ] , var_a , var_c , NULL ) ;
statement = & statements [ numstatements ] ;
numstatements + + ;
QCC_FreeTemp ( var_a ) ;
2011-07-08 18:59:48 +00:00
op = & pr_opcodes [ OP_IFNOT_I ] ;
2009-08-29 14:56:42 +00:00
break ;
2004-08-23 01:38:21 +00:00
case OP_ADDSTORE_F :
op = & pr_opcodes [ OP_ADD_F ] ;
var_c = var_b ;
var_b = var_a ;
var_a = var_c ;
var_c = var_a ;
break ;
2011-11-08 06:00:35 +00:00
case OP_ADDSTORE_I :
op = & pr_opcodes [ OP_ADD_I ] ;
var_c = var_b ;
var_b = var_a ;
var_a = var_c ;
var_c = var_a ;
break ;
2008-11-09 22:29:28 +00:00
case OP_ADDSTORE_FI :
op = & pr_opcodes [ OP_ADD_FI ] ;
var_c = var_b ;
var_b = var_a ;
var_a = var_c ;
var_c = var_a ;
break ;
case OP_ADDSTORE_IF :
op = & pr_opcodes [ OP_ADD_IF ] ;
var_c = var_b ;
var_b = var_a ;
var_a = var_c ;
var_c = var_a ;
break ;
2004-08-23 01:38:21 +00:00
case OP_SUBSTORE_F :
op = & pr_opcodes [ OP_SUB_F ] ;
var_c = var_b ;
var_b = var_a ;
var_a = var_c ;
var_c = var_a ;
break ;
2008-11-09 22:29:28 +00:00
case OP_SUBSTORE_FI :
op = & pr_opcodes [ OP_SUB_FI ] ;
var_c = var_b ;
var_b = var_a ;
var_a = var_c ;
var_c = var_a ;
break ;
case OP_SUBSTORE_IF :
op = & pr_opcodes [ OP_SUB_IF ] ;
var_c = var_b ;
var_b = var_a ;
var_a = var_c ;
var_c = var_a ;
break ;
------------------------------------------------------------------------
r4169 | acceptthis | 2013-01-17 08:55:12 +0000 (Thu, 17 Jan 2013) | 31 lines
removed MAX_VISEDICTS limit.
PEXT2_REPLACEMENTDELTAS tweaked, now has 4 million entity limit. still not enabled by default.
TE_BEAM now maps to a separate TEQW_BEAM to avoid conflicts with QW.
added android multitouch emulation for windows/rawinput (in_simulatemultitouch).
split topcolor/bottomcolor from scoreboard, for dp's colormap|1024 feature.
now using utf-8 for windows consoles.
qcc warnings/errors now give clickable console links for quick+easy editing.
disabled menutint when the currently active item changes contrast or gamma (for OneManClan).
Added support for drawfont/drawfontscale.
tweaked the qcvm a little to reduce the number of pointers.
.doll file loading. still experimental and will likely crash. requires csqc active, even if its a dummy progs. this will be fixed in time. Still other things that need cleaning up.
windows: gl_font "?" shows the standard windows font-selection dialog, and can be used to select windows fonts. not all work. and you probably don't want to use windings.
fixed splitscreen support when playing mvds. added mini-scoreboards to splitscreen.
editor/debugger now shows asm if there's no linenumber info. also, pressing f1 for help shows the shortcuts.
Added support for .framegroups files for psk(psa) and iqm formats.
True support for ezquake's colour codes. Mutually exclusive with background colours.
path command output slightly more readable.
added support for digest_hex (MD4, SHA1, CRC16).
skingroups now colourmap correctly.
Fix terrain colour hints, and litdata from the wrong bsp.
fix ftp dual-homed issue. support epsv command, and enable ipv6 (eprt still not supported).
remove d3d11 compilation from the makefile. the required headers are not provided by mingw, and are not available to the build bot, so don't bother.
fix v *= v.x and similar opcodes.
fteqcc: fixed support for áéÃóú type chars in names. utf-8 files now properly supported (even with the utf-8 bom/identifier). utf-16 also supported.
fteqcc: fixed '#if 1 == 3 && 4' parsing.
fteqcc: -Werror acts on the warning, rather than as a separate error. Line numbers are thus more readable.
fteqcc: copyright message now includes compile date instead.
fteqccgui: the treeview control is now coloured depending on whether there were warnings/errors in the last compile.
fteqccgui: the output window is now focused and scrolls down as compilation progresses.
pr_dumpplatform command dumps out some pragmas to convert more serious warnings to errors. This is to avoid the infamous 'fteqcc sucks cos my code sucks' issue.
rewrote prespawn/modelist/soundlist code. server tracks progress now.
------------------------------------------------------------------------
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4167 fc73d0e0-1445-4013-8a0c-d673dee63da5
2013-03-12 22:29:40 +00:00
case OP_SUBSTORE_I :
op = & pr_opcodes [ OP_SUB_I ] ;
var_c = var_b ;
var_b = var_a ;
var_a = var_c ;
var_c = var_a ;
break ;
case OP_BINARYNOT_I :
op = & pr_opcodes [ OP_SUB_I ] ;
var_b = var_a ;
var_a = QCC_MakeIntConst ( ~ 0 ) ;
break ;
case OP_BINARYNOT_F :
op = & pr_opcodes [ OP_SUB_F ] ;
var_b = var_a ;
var_a = QCC_MakeFloatConst ( 0xffffff ) ; //due to fpu precision, we only use 24 bits.
break ;
2004-08-23 01:38:21 +00:00
case OP_DIVSTORE_F :
op = & pr_opcodes [ OP_DIV_F ] ;
var_c = var_b ;
var_b = var_a ;
var_a = var_c ;
var_c = var_a ;
break ;
2008-11-09 22:29:28 +00:00
case OP_DIVSTORE_FI :
op = & pr_opcodes [ OP_DIV_FI ] ;
var_c = var_b ;
var_b = var_a ;
var_a = var_c ;
var_c = var_a ;
break ;
case OP_DIVSTORE_IF :
op = & pr_opcodes [ OP_DIV_IF ] ;
var_c = var_b ;
var_b = var_a ;
var_a = var_c ;
var_c = var_a ;
break ;
------------------------------------------------------------------------
r4169 | acceptthis | 2013-01-17 08:55:12 +0000 (Thu, 17 Jan 2013) | 31 lines
removed MAX_VISEDICTS limit.
PEXT2_REPLACEMENTDELTAS tweaked, now has 4 million entity limit. still not enabled by default.
TE_BEAM now maps to a separate TEQW_BEAM to avoid conflicts with QW.
added android multitouch emulation for windows/rawinput (in_simulatemultitouch).
split topcolor/bottomcolor from scoreboard, for dp's colormap|1024 feature.
now using utf-8 for windows consoles.
qcc warnings/errors now give clickable console links for quick+easy editing.
disabled menutint when the currently active item changes contrast or gamma (for OneManClan).
Added support for drawfont/drawfontscale.
tweaked the qcvm a little to reduce the number of pointers.
.doll file loading. still experimental and will likely crash. requires csqc active, even if its a dummy progs. this will be fixed in time. Still other things that need cleaning up.
windows: gl_font "?" shows the standard windows font-selection dialog, and can be used to select windows fonts. not all work. and you probably don't want to use windings.
fixed splitscreen support when playing mvds. added mini-scoreboards to splitscreen.
editor/debugger now shows asm if there's no linenumber info. also, pressing f1 for help shows the shortcuts.
Added support for .framegroups files for psk(psa) and iqm formats.
True support for ezquake's colour codes. Mutually exclusive with background colours.
path command output slightly more readable.
added support for digest_hex (MD4, SHA1, CRC16).
skingroups now colourmap correctly.
Fix terrain colour hints, and litdata from the wrong bsp.
fix ftp dual-homed issue. support epsv command, and enable ipv6 (eprt still not supported).
remove d3d11 compilation from the makefile. the required headers are not provided by mingw, and are not available to the build bot, so don't bother.
fix v *= v.x and similar opcodes.
fteqcc: fixed support for áéÃóú type chars in names. utf-8 files now properly supported (even with the utf-8 bom/identifier). utf-16 also supported.
fteqcc: fixed '#if 1 == 3 && 4' parsing.
fteqcc: -Werror acts on the warning, rather than as a separate error. Line numbers are thus more readable.
fteqcc: copyright message now includes compile date instead.
fteqccgui: the treeview control is now coloured depending on whether there were warnings/errors in the last compile.
fteqccgui: the output window is now focused and scrolls down as compilation progresses.
pr_dumpplatform command dumps out some pragmas to convert more serious warnings to errors. This is to avoid the infamous 'fteqcc sucks cos my code sucks' issue.
rewrote prespawn/modelist/soundlist code. server tracks progress now.
------------------------------------------------------------------------
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4167 fc73d0e0-1445-4013-8a0c-d673dee63da5
2013-03-12 22:29:40 +00:00
case OP_DIVSTORE_I :
op = & pr_opcodes [ OP_DIV_I ] ;
var_c = var_b ;
var_b = var_a ;
var_a = var_c ;
var_c = var_a ;
break ;
2004-08-23 01:38:21 +00:00
case OP_MULSTORE_F :
op = & pr_opcodes [ OP_MUL_F ] ;
var_c = var_b ;
var_b = var_a ;
var_a = var_c ;
var_c = var_a ;
break ;
2008-11-09 22:29:28 +00:00
case OP_MULSTORE_IF :
op = & pr_opcodes [ OP_MUL_IF ] ;
var_c = var_b ;
var_b = var_a ;
var_a = var_c ;
var_c = var_a ;
break ;
case OP_MULSTORE_FI :
op = & pr_opcodes [ OP_MUL_FI ] ;
var_c = var_b ;
var_b = var_a ;
var_a = var_c ;
var_c = var_a ;
break ;
2004-08-23 01:38:21 +00:00
case OP_ADDSTORE_V :
op = & pr_opcodes [ OP_ADD_V ] ;
var_c = var_b ;
var_b = var_a ;
var_a = var_c ;
var_c = var_a ;
break ;
case OP_SUBSTORE_V :
op = & pr_opcodes [ OP_SUB_V ] ;
var_c = var_b ;
var_b = var_a ;
var_a = var_c ;
var_c = var_a ;
break ;
2012-01-17 07:57:46 +00:00
case OP_MULSTORE_VF :
2009-09-18 18:39:11 +00:00
op = & pr_opcodes [ OP_MUL_VF ] ;
2004-08-23 01:38:21 +00:00
var_c = var_b ;
var_b = var_a ;
var_a = var_c ;
var_c = var_a ;
break ;
2012-01-17 07:57:46 +00:00
case OP_MULSTORE_VI :
op = & pr_opcodes [ OP_MUL_VI ] ;
var_c = var_b ;
var_b = var_a ;
var_a = var_c ;
var_c = var_a ;
break ;
2004-08-23 01:38:21 +00:00
2008-11-09 22:29:28 +00:00
case OP_BITSET_I :
op = & pr_opcodes [ OP_BITOR_I ] ;
var_c = var_b ;
var_b = var_a ;
var_a = var_c ;
var_c = var_a ;
break ;
2004-08-23 01:38:21 +00:00
case OP_BITSET :
2011-07-08 18:59:48 +00:00
op = & pr_opcodes [ OP_BITOR_F ] ;
2004-08-23 01:38:21 +00:00
var_c = var_b ;
var_b = var_a ;
var_a = var_c ;
var_c = var_a ;
break ;
2012-02-13 09:24:01 +00:00
case OP_STOREP_P :
op = & pr_opcodes [ OP_STOREP_I ] ;
break ;
2004-08-23 01:38:21 +00:00
case OP_BITCLR :
//b = var, a = bit field.
QCC_UnFreeTemp ( var_a ) ;
QCC_UnFreeTemp ( var_b ) ;
numstatements - - ;
2011-07-08 18:59:48 +00:00
var_c = QCC_PR_Statement ( & pr_opcodes [ OP_BITAND_F ] , var_b , var_a , NULL ) ;
2004-08-23 01:38:21 +00:00
QCC_FreeTemp ( var_c ) ;
statement = & statements [ numstatements ] ;
numstatements + + ;
2011-05-15 13:23:13 +00:00
2004-08-23 01:38:21 +00:00
QCC_FreeTemp ( var_a ) ;
QCC_FreeTemp ( var_b ) ;
op = & pr_opcodes [ OP_SUB_F ] ;
var_a = var_b ;
var_b = var_c ;
var_c = var_a ;
break ;
2008-11-09 22:29:28 +00:00
case OP_SUBSTOREP_FI :
case OP_SUBSTOREP_IF :
case OP_ADDSTOREP_FI :
case OP_ADDSTOREP_IF :
case OP_MULSTOREP_FI :
case OP_MULSTOREP_IF :
case OP_DIVSTOREP_FI :
case OP_DIVSTOREP_IF :
2012-01-17 07:57:46 +00:00
case OP_MULSTOREP_VF :
case OP_MULSTOREP_VI :
2011-10-03 02:45:44 +00:00
case OP_SUBSTOREP_V :
case OP_ADDSTOREP_V :
2008-11-09 22:29:28 +00:00
2004-08-23 01:38:21 +00:00
case OP_SUBSTOREP_F :
2012-01-28 10:30:44 +00:00
case OP_SUBSTOREP_I :
case OP_ADDSTOREP_I :
2004-08-23 01:38:21 +00:00
case OP_ADDSTOREP_F :
case OP_MULSTOREP_F :
case OP_DIVSTOREP_F :
case OP_BITSETP :
2008-11-09 22:29:28 +00:00
case OP_BITSETP_I :
2004-08-23 01:38:21 +00:00
case OP_BITCLRP :
// QCC_PR_ParseWarning(0, "XSTOREP_F emulation is still experimental");
QCC_UnFreeTemp ( var_a ) ;
QCC_UnFreeTemp ( var_b ) ;
//don't chain these... this expansion is not the same.
{
int st ;
2010-12-22 00:13:49 +00:00
int need_lock = false ;
2012-01-28 10:30:44 +00:00
if ( var_b - > temp )
2004-08-23 01:38:21 +00:00
{
2012-01-28 10:30:44 +00:00
for ( st = numstatements - 2 ; st > = 0 ; st - - )
{
if ( statements [ st ] . op = = OP_ADDRESS )
if ( statements [ st ] . c = = var_b - > ofs )
break ;
2005-01-04 08:22:31 +00:00
2012-01-28 10:30:44 +00:00
if ( ( statements [ st ] . op > = OP_CALL0 & & statements [ st ] . op < = OP_CALL8 ) | | ( statements [ st ] . op > = OP_CALL1H & & statements [ st ] . op < = OP_CALL8H ) )
need_lock = true ;
2010-12-22 00:13:49 +00:00
2012-01-28 10:30:44 +00:00
if ( statements [ st ] . c = = var_b - > ofs )
{
st = - 1 ;
break ;
}
}
2004-08-23 01:38:21 +00:00
}
2012-01-28 10:30:44 +00:00
else
st = - 1 ;
2004-08-23 01:38:21 +00:00
var_c = QCC_GetTemp ( * op - > type_c ) ;
2012-01-28 10:30:44 +00:00
if ( st < 0 )
{
/*generate new OP_LOADP instruction*/
statement - > op = ( ( * op - > type_c ) - > type = = ev_vector ) ? OP_LOADP_V : OP_LOADP_F ;
statement - > a = var_b - > ofs ;
statement - > b = var_c - > ofs ;
statement - > c = 0 ;
}
else
{
/*it came from an OP_ADDRESS - st says the instruction*/
if ( need_lock )
2012-03-18 20:07:03 +00:00
{
QCC_ForceLockTempForOffset ( statements [ st ] . a ) ;
QCC_ForceLockTempForOffset ( statements [ st ] . b ) ;
2012-01-28 10:30:44 +00:00
QCC_LockTemp ( var_c ) ; /*that temp needs to be preserved over calls*/
2012-03-18 20:07:03 +00:00
}
2012-01-28 10:30:44 +00:00
/*generate new OP_ADDRESS instruction - FIXME: the arguments may have changed since the original instruction*/
statement_linenums [ statement - statements ] = statement_linenums [ st ] ;
statement - > op = OP_ADDRESS ;
statement - > a = statements [ st ] . a ;
statement - > b = statements [ st ] . b ;
statement - > c = statements [ st ] . c ;
/*convert old one to an OP_LOAD*/
2012-11-27 03:23:19 +00:00
statement_linenums [ st ] = pr_token_line_last ;
2012-01-28 10:30:44 +00:00
statements [ st ] . op = ( ( * op - > type_c ) - > type = = ev_vector ) ? OP_LOAD_V : OP_LOAD_F ;
statements [ st ] . a = statements [ st ] . a ;
statements [ st ] . b = statements [ st ] . b ;
statements [ st ] . c = var_c - > ofs ;
}
2004-08-23 01:38:21 +00:00
}
statement = & statements [ numstatements ] ;
numstatements + + ;
2012-11-27 03:23:19 +00:00
statement_linenums [ statement - statements ] = pr_token_line_last ;
2004-08-23 01:38:21 +00:00
switch ( op - pr_opcodes )
{
2011-10-03 02:45:44 +00:00
case OP_SUBSTOREP_V :
statement - > op = OP_SUB_V ;
break ;
case OP_ADDSTOREP_V :
statement - > op = OP_ADD_V ;
break ;
2012-01-17 07:57:46 +00:00
case OP_MULSTOREP_VF :
2011-10-03 02:45:44 +00:00
statement - > op = OP_MUL_VF ;
break ;
2012-01-17 07:57:46 +00:00
case OP_MULSTOREP_VI :
statement - > op = OP_MUL_VI ;
break ;
2004-08-23 01:38:21 +00:00
case OP_SUBSTOREP_F :
statement - > op = OP_SUB_F ;
break ;
2012-01-28 10:30:44 +00:00
case OP_SUBSTOREP_I :
statement - > op = OP_SUB_I ;
break ;
2008-11-09 22:29:28 +00:00
case OP_SUBSTOREP_IF :
statement - > op = OP_SUB_IF ;
break ;
case OP_SUBSTOREP_FI :
statement - > op = OP_SUB_FI ;
break ;
case OP_ADDSTOREP_IF :
statement - > op = OP_ADD_IF ;
break ;
case OP_ADDSTOREP_FI :
statement - > op = OP_ADD_FI ;
break ;
case OP_MULSTOREP_IF :
statement - > op = OP_MUL_IF ;
break ;
case OP_MULSTOREP_FI :
statement - > op = OP_MUL_FI ;
break ;
case OP_DIVSTOREP_IF :
statement - > op = OP_DIV_IF ;
break ;
case OP_DIVSTOREP_FI :
statement - > op = OP_DIV_FI ;
break ;
2004-08-23 01:38:21 +00:00
case OP_ADDSTOREP_F :
statement - > op = OP_ADD_F ;
break ;
2012-01-28 10:30:44 +00:00
case OP_ADDSTOREP_I :
statement - > op = OP_ADD_I ;
break ;
2004-08-23 01:38:21 +00:00
case OP_MULSTOREP_F :
statement - > op = OP_MUL_F ;
break ;
case OP_DIVSTOREP_F :
statement - > op = OP_DIV_F ;
break ;
case OP_BITSETP :
2011-07-08 18:59:48 +00:00
statement - > op = OP_BITOR_F ;
2004-08-23 01:38:21 +00:00
break ;
2008-11-09 22:29:28 +00:00
case OP_BITSETP_I :
statement - > op = OP_BITOR_I ;
break ;
2004-08-23 01:38:21 +00:00
case OP_BITCLRP :
//float pointer float
temp = QCC_GetTemp ( type_float ) ;
2011-07-08 18:59:48 +00:00
statement - > op = OP_BITAND_F ;
2004-08-23 01:38:21 +00:00
statement - > a = var_c ? var_c - > ofs : 0 ;
statement - > b = var_a ? var_a - > ofs : 0 ;
statement - > c = temp - > ofs ;
statement = & statements [ numstatements ] ;
numstatements + + ;
2012-11-27 03:23:19 +00:00
statement_linenums [ statement - statements ] = pr_token_line_last ;
2004-08-23 01:38:21 +00:00
statement - > op = OP_SUB_F ;
//t = c & i
//c = c - t
break ;
default : //no way will this be hit...
QCC_PR_ParseError ( ERR_INTERNAL , " opcode invalid 3 times %i " , op - pr_opcodes ) ;
}
if ( op - pr_opcodes = = OP_BITCLRP )
{
statement - > a = var_c ? var_c - > ofs : 0 ;
statement - > b = temp ? temp - > ofs : 0 ;
statement - > c = var_c - > ofs ;
QCC_FreeTemp ( temp ) ;
var_b = var_b ; //this is the ptr.
2004-11-06 14:27:03 +00:00
QCC_FreeTemp ( var_a ) ;
2004-08-23 01:38:21 +00:00
var_a = var_c ; //this is the value.
}
else
{
statement - > a = var_c ? var_c - > ofs : 0 ;
statement - > b = var_a ? var_a - > ofs : 0 ;
statement - > c = var_c - > ofs ;
var_b = var_b ; //this is the ptr.
2004-11-06 14:27:03 +00:00
QCC_FreeTemp ( var_a ) ;
2004-08-23 01:38:21 +00:00
var_a = var_c ; //this is the value.
}
2011-10-03 02:45:44 +00:00
op = & pr_opcodes [ ( ( * op - > type_c ) - > type = = ev_vector ) ? OP_STOREP_V : OP_STOREP_F ] ;
2004-08-23 01:38:21 +00:00
QCC_FreeTemp ( var_c ) ;
var_c = NULL ;
QCC_FreeTemp ( var_b ) ;
statement = & statements [ numstatements ] ;
numstatements + + ;
break ;
default :
2004-11-04 04:19:10 +00:00
QCC_PR_ParseError ( ERR_BADEXTENSION , " Opcode \" %s|%s \" not valid for target " , op - > name , op - > opname ) ;
2004-08-23 01:38:21 +00:00
break ;
}
}
if ( outstatement )
* outstatement = statement ;
2011-05-15 13:23:13 +00:00
2012-11-27 03:23:19 +00:00
statement_linenums [ statement - statements ] = pr_token_line_last ;
2004-08-23 01:38:21 +00:00
statement - > op = op - pr_opcodes ;
statement - > a = var_a ? var_a - > ofs : 0 ;
statement - > b = var_b ? var_b - > ofs : 0 ;
if ( var_c ! = NULL )
{
statement - > c = var_c - > ofs ;
}
else if ( op - > type_c = = & type_void | | op - > associative = = ASSOC_RIGHT | | op - > type_c = = NULL )
{
var_c = NULL ;
statement - > c = 0 ; // ifs, gotos, and assignments
// don't need vars allocated
}
else
{ // allocate result space
var_c = QCC_GetTemp ( * op - > type_c ) ;
statement - > c = var_c - > ofs ;
if ( op - > type_b = = & type_field )
{
var_c - > name = var_b - > name ;
var_c - > s_file = var_b - > s_file ;
var_c - > s_line = var_b - > s_line ;
}
}
2005-04-23 19:55:49 +00:00
if ( ( op - pr_opcodes > = OP_LOAD_F & & op - pr_opcodes < = OP_LOAD_FNC ) | |
op - pr_opcodes = = OP_LOAD_I )
{
if ( var_b - > constant = = 2 )
var_c - > constant = true ;
}
2004-08-23 01:38:21 +00:00
if ( ! var_c )
{
if ( var_a )
QCC_UnFreeTemp ( var_a ) ;
return var_a ;
}
return var_c ;
}
/*
= = = = = = = = = = = =
QCC_PR_SimpleStatement
Emits a primitive statement , returning the var it places it ' s value in
= = = = = = = = = = = =
*/
2006-01-28 06:41:20 +00:00
QCC_dstatement_t * QCC_PR_SimpleStatement ( int op , int var_a , int var_b , int var_c , int force )
2004-08-23 01:38:21 +00:00
{
QCC_dstatement_t * statement ;
2006-01-28 06:41:20 +00:00
if ( ! force & & ! QCC_OPCodeValid ( pr_opcodes + op ) )
2004-08-23 01:38:21 +00:00
{
QCC_PR_ParseError ( ERR_BADEXTENSION , " Opcode \" %s|%s \" not valid for target \n " , pr_opcodes [ op ] . name , pr_opcodes [ op ] . opname ) ;
}
2012-11-27 03:23:19 +00:00
statement_linenums [ numstatements ] = pr_token_line_last ;
2004-08-23 01:38:21 +00:00
statement = & statements [ numstatements ] ;
numstatements + + ;
statement - > op = op ;
statement - > a = var_a ;
statement - > b = var_b ;
statement - > c = var_c ;
return statement ;
}
2006-01-28 06:41:20 +00:00
void QCC_PR_Statement3 ( QCC_opcode_t * op , QCC_def_t * var_a , QCC_def_t * var_b , QCC_def_t * var_c , int force )
2004-08-23 01:38:21 +00:00
{
2011-05-15 13:23:13 +00:00
QCC_dstatement_t * statement ;
2004-08-23 01:38:21 +00:00
2006-01-28 06:41:20 +00:00
if ( ! force & & ! QCC_OPCodeValid ( op ) )
2004-08-23 01:38:21 +00:00
{
// outputversion = op->extension;
// if (noextensions)
QCC_PR_ParseError ( ERR_BADEXTENSION , " Opcode \" %s|%s \" not valid for target \n " , op - > name , op - > opname ) ;
}
2011-05-15 13:23:13 +00:00
statement = & statements [ numstatements ] ;
2004-08-23 01:38:21 +00:00
numstatements + + ;
2011-05-15 13:23:13 +00:00
2012-11-27 03:23:19 +00:00
statement_linenums [ statement - statements ] = pr_token_line_last ;
2004-08-23 01:38:21 +00:00
statement - > op = op - pr_opcodes ;
statement - > a = var_a ? var_a - > ofs : 0 ;
statement - > b = var_b ? var_b - > ofs : 0 ;
statement - > c = var_c ? var_c - > ofs : 0 ;
}
/*
= = = = = = = = = = = =
PR_ParseImmediate
Looks for a preexisting constant
= = = = = = = = = = = =
*/
QCC_def_t * QCC_PR_ParseImmediate ( void )
{
QCC_def_t * cn ;
if ( pr_immediate_type = = type_float )
{
2011-10-03 02:45:44 +00:00
cn = QCC_MakeFloatConst ( pr_immediate . _float ) ;
2004-08-23 01:38:21 +00:00
QCC_PR_Lex ( ) ;
return cn ;
}
if ( pr_immediate_type = = type_integer )
{
2011-10-03 02:45:44 +00:00
cn = QCC_MakeIntConst ( pr_immediate . _int ) ;
2004-08-23 01:38:21 +00:00
QCC_PR_Lex ( ) ;
return cn ;
}
if ( pr_immediate_type = = type_string )
{
2011-07-30 14:14:56 +00:00
char tmp [ 8192 ] ;
strcpy ( tmp , pr_immediate_string ) ;
for ( ; ; )
{
QCC_PR_Lex ( ) ;
if ( pr_token_type = = tt_immediate & & pr_token_type = = tt_immediate )
strcat ( tmp , pr_immediate_string ) ;
else
break ;
}
2011-10-03 02:45:44 +00:00
cn = QCC_MakeStringConst ( tmp ) ;
2004-08-23 01:38:21 +00:00
return cn ;
}
// check for a constant with the same value
for ( cn = pr . def_head . next ; cn ; cn = cn - > next ) //FIXME - hashtable.
{
if ( ! cn - > initialized )
continue ;
if ( ! cn - > constant )
continue ;
if ( cn - > type ! = pr_immediate_type )
continue ;
if ( pr_immediate_type = = type_string )
{
if ( ! STRCMP ( G_STRING ( cn - > ofs ) , pr_immediate_string ) )
{
QCC_PR_Lex ( ) ;
return cn ;
}
}
else if ( pr_immediate_type = = type_float )
{
if ( G_FLOAT ( cn - > ofs ) = = pr_immediate . _float )
{
QCC_PR_Lex ( ) ;
return cn ;
}
}
else if ( pr_immediate_type = = type_integer )
2011-05-15 13:23:13 +00:00
{
2004-08-23 01:38:21 +00:00
if ( G_INT ( cn - > ofs ) = = pr_immediate . _int )
{
QCC_PR_Lex ( ) ;
return cn ;
}
}
else if ( pr_immediate_type = = type_vector )
{
if ( ( G_FLOAT ( cn - > ofs ) = = pr_immediate . vector [ 0 ] )
& & ( G_FLOAT ( cn - > ofs + 1 ) = = pr_immediate . vector [ 1 ] )
& & ( G_FLOAT ( cn - > ofs + 2 ) = = pr_immediate . vector [ 2 ] ) )
{
QCC_PR_Lex ( ) ;
return cn ;
}
}
2011-05-15 13:23:13 +00:00
else
2004-08-23 01:38:21 +00:00
QCC_PR_ParseError ( ERR_BADIMMEDIATETYPE , " weird immediate type " ) ;
}
// allocate a new one
cn = ( void * ) qccHunkAlloc ( sizeof ( QCC_def_t ) ) ;
cn - > next = NULL ;
pr . def_tail - > next = cn ;
pr . def_tail = cn ;
cn - > type = pr_immediate_type ;
cn - > name = " IMMEDIATE " ;
cn - > constant = true ;
cn - > initialized = 1 ;
cn - > scope = NULL ; // always share immediates
// copy the immediate to the global area
2013-03-12 22:32:25 +00:00
cn - > ofs = QCC_GetFreeGlobalOffsetSpace ( type_size [ pr_immediate_type - > type ] ) ;
2004-08-23 01:38:21 +00:00
if ( pr_immediate_type = = type_string )
pr_immediate . string = QCC_CopyString ( pr_immediate_string ) ;
2011-05-15 13:23:13 +00:00
2004-08-23 01:38:21 +00:00
memcpy ( qcc_pr_globals + cn - > ofs , & pr_immediate , 4 * type_size [ pr_immediate_type - > type ] ) ;
2011-05-15 13:23:13 +00:00
2004-08-23 01:38:21 +00:00
QCC_PR_Lex ( ) ;
return cn ;
}
void QCC_PrecacheSound ( QCC_def_t * e , int ch )
{
char * n ;
int i ;
if ( e - > type - > type ! = ev_string )
return ;
2011-05-15 13:23:13 +00:00
2004-08-23 01:38:21 +00:00
if ( ! e - > ofs | | e - > temp | | ! e - > constant )
return ;
n = G_STRING ( e - > ofs ) ;
if ( ! * n )
return ;
for ( i = 0 ; i < numsounds ; i + + )
2013-03-12 22:35:33 +00:00
if ( ! STRCMP ( n , precache_sound [ i ] . name ) )
2004-08-23 01:38:21 +00:00
return ;
------------------------------------------------------------------------
r4169 | acceptthis | 2013-01-17 08:55:12 +0000 (Thu, 17 Jan 2013) | 31 lines
removed MAX_VISEDICTS limit.
PEXT2_REPLACEMENTDELTAS tweaked, now has 4 million entity limit. still not enabled by default.
TE_BEAM now maps to a separate TEQW_BEAM to avoid conflicts with QW.
added android multitouch emulation for windows/rawinput (in_simulatemultitouch).
split topcolor/bottomcolor from scoreboard, for dp's colormap|1024 feature.
now using utf-8 for windows consoles.
qcc warnings/errors now give clickable console links for quick+easy editing.
disabled menutint when the currently active item changes contrast or gamma (for OneManClan).
Added support for drawfont/drawfontscale.
tweaked the qcvm a little to reduce the number of pointers.
.doll file loading. still experimental and will likely crash. requires csqc active, even if its a dummy progs. this will be fixed in time. Still other things that need cleaning up.
windows: gl_font "?" shows the standard windows font-selection dialog, and can be used to select windows fonts. not all work. and you probably don't want to use windings.
fixed splitscreen support when playing mvds. added mini-scoreboards to splitscreen.
editor/debugger now shows asm if there's no linenumber info. also, pressing f1 for help shows the shortcuts.
Added support for .framegroups files for psk(psa) and iqm formats.
True support for ezquake's colour codes. Mutually exclusive with background colours.
path command output slightly more readable.
added support for digest_hex (MD4, SHA1, CRC16).
skingroups now colourmap correctly.
Fix terrain colour hints, and litdata from the wrong bsp.
fix ftp dual-homed issue. support epsv command, and enable ipv6 (eprt still not supported).
remove d3d11 compilation from the makefile. the required headers are not provided by mingw, and are not available to the build bot, so don't bother.
fix v *= v.x and similar opcodes.
fteqcc: fixed support for áéÃóú type chars in names. utf-8 files now properly supported (even with the utf-8 bom/identifier). utf-16 also supported.
fteqcc: fixed '#if 1 == 3 && 4' parsing.
fteqcc: -Werror acts on the warning, rather than as a separate error. Line numbers are thus more readable.
fteqcc: copyright message now includes compile date instead.
fteqccgui: the treeview control is now coloured depending on whether there were warnings/errors in the last compile.
fteqccgui: the output window is now focused and scrolls down as compilation progresses.
pr_dumpplatform command dumps out some pragmas to convert more serious warnings to errors. This is to avoid the infamous 'fteqcc sucks cos my code sucks' issue.
rewrote prespawn/modelist/soundlist code. server tracks progress now.
------------------------------------------------------------------------
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4167 fc73d0e0-1445-4013-8a0c-d673dee63da5
2013-03-12 22:29:40 +00:00
if ( numsounds = = QCC_MAX_SOUNDS )
2004-08-23 01:38:21 +00:00
return ;
// QCC_Error ("PrecacheSound: numsounds == MAX_SOUNDS");
2013-03-12 22:35:33 +00:00
strcpy ( precache_sound [ i ] . name , n ) ;
2004-08-23 01:38:21 +00:00
if ( ch > = ' 1 ' & & ch < = ' 9 ' )
2013-03-12 22:35:33 +00:00
precache_sound [ i ] . block = ch - ' 0 ' ;
2004-08-23 01:38:21 +00:00
else
2013-03-12 22:35:33 +00:00
precache_sound [ i ] . block = 1 ;
2004-08-23 01:38:21 +00:00
numsounds + + ;
}
void QCC_PrecacheModel ( QCC_def_t * e , int ch )
{
char * n ;
int i ;
if ( e - > type - > type ! = ev_string )
return ;
2011-05-15 13:23:13 +00:00
2004-08-23 01:38:21 +00:00
if ( ! e - > ofs | | e - > temp | | ! e - > constant )
2011-05-15 13:23:13 +00:00
return ;
2004-08-23 01:38:21 +00:00
n = G_STRING ( e - > ofs ) ;
if ( ! * n )
return ;
for ( i = 0 ; i < nummodels ; i + + )
2013-03-12 22:35:33 +00:00
if ( ! STRCMP ( n , precache_model [ i ] . name ) )
2004-08-23 01:38:21 +00:00
{
2013-03-12 22:35:33 +00:00
if ( ! precache_model [ i ] . block )
2004-08-23 01:38:21 +00:00
{
if ( ch > = ' 1 ' & & ch < = ' 9 ' )
2013-03-12 22:35:33 +00:00
precache_model [ i ] . block = ch - ' 0 ' ;
2004-08-23 01:38:21 +00:00
else
2013-03-12 22:35:33 +00:00
precache_model [ i ] . block = 1 ;
2004-08-23 01:38:21 +00:00
}
return ;
}
------------------------------------------------------------------------
r4169 | acceptthis | 2013-01-17 08:55:12 +0000 (Thu, 17 Jan 2013) | 31 lines
removed MAX_VISEDICTS limit.
PEXT2_REPLACEMENTDELTAS tweaked, now has 4 million entity limit. still not enabled by default.
TE_BEAM now maps to a separate TEQW_BEAM to avoid conflicts with QW.
added android multitouch emulation for windows/rawinput (in_simulatemultitouch).
split topcolor/bottomcolor from scoreboard, for dp's colormap|1024 feature.
now using utf-8 for windows consoles.
qcc warnings/errors now give clickable console links for quick+easy editing.
disabled menutint when the currently active item changes contrast or gamma (for OneManClan).
Added support for drawfont/drawfontscale.
tweaked the qcvm a little to reduce the number of pointers.
.doll file loading. still experimental and will likely crash. requires csqc active, even if its a dummy progs. this will be fixed in time. Still other things that need cleaning up.
windows: gl_font "?" shows the standard windows font-selection dialog, and can be used to select windows fonts. not all work. and you probably don't want to use windings.
fixed splitscreen support when playing mvds. added mini-scoreboards to splitscreen.
editor/debugger now shows asm if there's no linenumber info. also, pressing f1 for help shows the shortcuts.
Added support for .framegroups files for psk(psa) and iqm formats.
True support for ezquake's colour codes. Mutually exclusive with background colours.
path command output slightly more readable.
added support for digest_hex (MD4, SHA1, CRC16).
skingroups now colourmap correctly.
Fix terrain colour hints, and litdata from the wrong bsp.
fix ftp dual-homed issue. support epsv command, and enable ipv6 (eprt still not supported).
remove d3d11 compilation from the makefile. the required headers are not provided by mingw, and are not available to the build bot, so don't bother.
fix v *= v.x and similar opcodes.
fteqcc: fixed support for áéÃóú type chars in names. utf-8 files now properly supported (even with the utf-8 bom/identifier). utf-16 also supported.
fteqcc: fixed '#if 1 == 3 && 4' parsing.
fteqcc: -Werror acts on the warning, rather than as a separate error. Line numbers are thus more readable.
fteqcc: copyright message now includes compile date instead.
fteqccgui: the treeview control is now coloured depending on whether there were warnings/errors in the last compile.
fteqccgui: the output window is now focused and scrolls down as compilation progresses.
pr_dumpplatform command dumps out some pragmas to convert more serious warnings to errors. This is to avoid the infamous 'fteqcc sucks cos my code sucks' issue.
rewrote prespawn/modelist/soundlist code. server tracks progress now.
------------------------------------------------------------------------
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4167 fc73d0e0-1445-4013-8a0c-d673dee63da5
2013-03-12 22:29:40 +00:00
if ( nummodels = = QCC_MAX_MODELS )
2004-08-23 01:38:21 +00:00
return ;
// QCC_Error ("PrecacheModels: nummodels == MAX_MODELS");
2013-03-12 22:35:33 +00:00
strcpy ( precache_model [ i ] . name , n ) ;
2004-08-23 01:38:21 +00:00
if ( ch > = ' 1 ' & & ch < = ' 9 ' )
2013-03-12 22:35:33 +00:00
precache_model [ i ] . block = ch - ' 0 ' ;
2004-08-23 01:38:21 +00:00
else
2013-03-12 22:35:33 +00:00
precache_model [ i ] . block = 1 ;
precache_model [ i ] . filename = strings + s_file ;
precache_model [ i ] . fileline = pr_source_line ;
2004-08-23 01:38:21 +00:00
nummodels + + ;
}
void QCC_SetModel ( QCC_def_t * e )
{
char * n ;
int i ;
if ( e - > type - > type ! = ev_string )
return ;
2011-05-15 13:23:13 +00:00
2004-08-23 01:38:21 +00:00
if ( ! e - > ofs | | e - > temp | | ! e - > constant )
2011-05-15 13:23:13 +00:00
return ;
2004-08-23 01:38:21 +00:00
n = G_STRING ( e - > ofs ) ;
if ( ! * n )
return ;
for ( i = 0 ; i < nummodels ; i + + )
2013-03-12 22:35:33 +00:00
if ( ! STRCMP ( n , precache_model [ i ] . name ) )
2004-08-23 01:38:21 +00:00
{
2013-03-12 22:35:33 +00:00
precache_model [ i ] . used + + ;
2004-08-23 01:38:21 +00:00
return ;
}
------------------------------------------------------------------------
r4169 | acceptthis | 2013-01-17 08:55:12 +0000 (Thu, 17 Jan 2013) | 31 lines
removed MAX_VISEDICTS limit.
PEXT2_REPLACEMENTDELTAS tweaked, now has 4 million entity limit. still not enabled by default.
TE_BEAM now maps to a separate TEQW_BEAM to avoid conflicts with QW.
added android multitouch emulation for windows/rawinput (in_simulatemultitouch).
split topcolor/bottomcolor from scoreboard, for dp's colormap|1024 feature.
now using utf-8 for windows consoles.
qcc warnings/errors now give clickable console links for quick+easy editing.
disabled menutint when the currently active item changes contrast or gamma (for OneManClan).
Added support for drawfont/drawfontscale.
tweaked the qcvm a little to reduce the number of pointers.
.doll file loading. still experimental and will likely crash. requires csqc active, even if its a dummy progs. this will be fixed in time. Still other things that need cleaning up.
windows: gl_font "?" shows the standard windows font-selection dialog, and can be used to select windows fonts. not all work. and you probably don't want to use windings.
fixed splitscreen support when playing mvds. added mini-scoreboards to splitscreen.
editor/debugger now shows asm if there's no linenumber info. also, pressing f1 for help shows the shortcuts.
Added support for .framegroups files for psk(psa) and iqm formats.
True support for ezquake's colour codes. Mutually exclusive with background colours.
path command output slightly more readable.
added support for digest_hex (MD4, SHA1, CRC16).
skingroups now colourmap correctly.
Fix terrain colour hints, and litdata from the wrong bsp.
fix ftp dual-homed issue. support epsv command, and enable ipv6 (eprt still not supported).
remove d3d11 compilation from the makefile. the required headers are not provided by mingw, and are not available to the build bot, so don't bother.
fix v *= v.x and similar opcodes.
fteqcc: fixed support for áéÃóú type chars in names. utf-8 files now properly supported (even with the utf-8 bom/identifier). utf-16 also supported.
fteqcc: fixed '#if 1 == 3 && 4' parsing.
fteqcc: -Werror acts on the warning, rather than as a separate error. Line numbers are thus more readable.
fteqcc: copyright message now includes compile date instead.
fteqccgui: the treeview control is now coloured depending on whether there were warnings/errors in the last compile.
fteqccgui: the output window is now focused and scrolls down as compilation progresses.
pr_dumpplatform command dumps out some pragmas to convert more serious warnings to errors. This is to avoid the infamous 'fteqcc sucks cos my code sucks' issue.
rewrote prespawn/modelist/soundlist code. server tracks progress now.
------------------------------------------------------------------------
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4167 fc73d0e0-1445-4013-8a0c-d673dee63da5
2013-03-12 22:29:40 +00:00
if ( nummodels = = QCC_MAX_MODELS )
2004-08-23 01:38:21 +00:00
return ;
2013-03-12 22:35:33 +00:00
strcpy ( precache_model [ i ] . name , n ) ;
precache_model [ i ] . block = 0 ;
precache_model [ i ] . used = 1 ;
precache_model [ i ] . filename = strings + s_file ;
precache_model [ i ] . fileline = pr_source_line ;
2004-08-23 01:38:21 +00:00
nummodels + + ;
}
void QCC_PrecacheTexture ( QCC_def_t * e , int ch )
{
char * n ;
int i ;
if ( e - > type - > type ! = ev_string )
return ;
2011-05-15 13:23:13 +00:00
2004-08-23 01:38:21 +00:00
if ( ! e - > ofs | | e - > temp | | ! e - > constant )
return ;
n = G_STRING ( e - > ofs ) ;
if ( ! * n )
return ;
for ( i = 0 ; i < numtextures ; i + + )
2013-03-12 22:35:33 +00:00
if ( ! STRCMP ( n , precache_texture [ i ] . name ) )
2004-08-23 01:38:21 +00:00
return ;
------------------------------------------------------------------------
r4169 | acceptthis | 2013-01-17 08:55:12 +0000 (Thu, 17 Jan 2013) | 31 lines
removed MAX_VISEDICTS limit.
PEXT2_REPLACEMENTDELTAS tweaked, now has 4 million entity limit. still not enabled by default.
TE_BEAM now maps to a separate TEQW_BEAM to avoid conflicts with QW.
added android multitouch emulation for windows/rawinput (in_simulatemultitouch).
split topcolor/bottomcolor from scoreboard, for dp's colormap|1024 feature.
now using utf-8 for windows consoles.
qcc warnings/errors now give clickable console links for quick+easy editing.
disabled menutint when the currently active item changes contrast or gamma (for OneManClan).
Added support for drawfont/drawfontscale.
tweaked the qcvm a little to reduce the number of pointers.
.doll file loading. still experimental and will likely crash. requires csqc active, even if its a dummy progs. this will be fixed in time. Still other things that need cleaning up.
windows: gl_font "?" shows the standard windows font-selection dialog, and can be used to select windows fonts. not all work. and you probably don't want to use windings.
fixed splitscreen support when playing mvds. added mini-scoreboards to splitscreen.
editor/debugger now shows asm if there's no linenumber info. also, pressing f1 for help shows the shortcuts.
Added support for .framegroups files for psk(psa) and iqm formats.
True support for ezquake's colour codes. Mutually exclusive with background colours.
path command output slightly more readable.
added support for digest_hex (MD4, SHA1, CRC16).
skingroups now colourmap correctly.
Fix terrain colour hints, and litdata from the wrong bsp.
fix ftp dual-homed issue. support epsv command, and enable ipv6 (eprt still not supported).
remove d3d11 compilation from the makefile. the required headers are not provided by mingw, and are not available to the build bot, so don't bother.
fix v *= v.x and similar opcodes.
fteqcc: fixed support for áéÃóú type chars in names. utf-8 files now properly supported (even with the utf-8 bom/identifier). utf-16 also supported.
fteqcc: fixed '#if 1 == 3 && 4' parsing.
fteqcc: -Werror acts on the warning, rather than as a separate error. Line numbers are thus more readable.
fteqcc: copyright message now includes compile date instead.
fteqccgui: the treeview control is now coloured depending on whether there were warnings/errors in the last compile.
fteqccgui: the output window is now focused and scrolls down as compilation progresses.
pr_dumpplatform command dumps out some pragmas to convert more serious warnings to errors. This is to avoid the infamous 'fteqcc sucks cos my code sucks' issue.
rewrote prespawn/modelist/soundlist code. server tracks progress now.
------------------------------------------------------------------------
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4167 fc73d0e0-1445-4013-8a0c-d673dee63da5
2013-03-12 22:29:40 +00:00
if ( nummodels = = QCC_MAX_MODELS )
2004-08-23 01:38:21 +00:00
return ;
// QCC_Error ("PrecacheTextures: numtextures == MAX_TEXTURES");
2013-03-12 22:35:33 +00:00
strcpy ( precache_texture [ i ] . name , n ) ;
2004-08-23 01:38:21 +00:00
if ( ch > = ' 1 ' & & ch < = ' 9 ' )
2013-03-12 22:35:33 +00:00
precache_texture [ i ] . block = ch - ' 0 ' ;
2004-08-23 01:38:21 +00:00
else
2013-03-12 22:35:33 +00:00
precache_texture [ i ] . block = 1 ;
2004-08-23 01:38:21 +00:00
numtextures + + ;
}
void QCC_PrecacheFile ( QCC_def_t * e , int ch )
{
char * n ;
int i ;
if ( e - > type - > type ! = ev_string )
return ;
2011-05-15 13:23:13 +00:00
2004-08-23 01:38:21 +00:00
if ( ! e - > ofs | | e - > temp | | ! e - > constant )
return ;
n = G_STRING ( e - > ofs ) ;
if ( ! * n )
return ;
for ( i = 0 ; i < numfiles ; i + + )
2013-03-12 22:35:33 +00:00
if ( ! STRCMP ( n , precache_file [ i ] . name ) )
2004-08-23 01:38:21 +00:00
return ;
------------------------------------------------------------------------
r4169 | acceptthis | 2013-01-17 08:55:12 +0000 (Thu, 17 Jan 2013) | 31 lines
removed MAX_VISEDICTS limit.
PEXT2_REPLACEMENTDELTAS tweaked, now has 4 million entity limit. still not enabled by default.
TE_BEAM now maps to a separate TEQW_BEAM to avoid conflicts with QW.
added android multitouch emulation for windows/rawinput (in_simulatemultitouch).
split topcolor/bottomcolor from scoreboard, for dp's colormap|1024 feature.
now using utf-8 for windows consoles.
qcc warnings/errors now give clickable console links for quick+easy editing.
disabled menutint when the currently active item changes contrast or gamma (for OneManClan).
Added support for drawfont/drawfontscale.
tweaked the qcvm a little to reduce the number of pointers.
.doll file loading. still experimental and will likely crash. requires csqc active, even if its a dummy progs. this will be fixed in time. Still other things that need cleaning up.
windows: gl_font "?" shows the standard windows font-selection dialog, and can be used to select windows fonts. not all work. and you probably don't want to use windings.
fixed splitscreen support when playing mvds. added mini-scoreboards to splitscreen.
editor/debugger now shows asm if there's no linenumber info. also, pressing f1 for help shows the shortcuts.
Added support for .framegroups files for psk(psa) and iqm formats.
True support for ezquake's colour codes. Mutually exclusive with background colours.
path command output slightly more readable.
added support for digest_hex (MD4, SHA1, CRC16).
skingroups now colourmap correctly.
Fix terrain colour hints, and litdata from the wrong bsp.
fix ftp dual-homed issue. support epsv command, and enable ipv6 (eprt still not supported).
remove d3d11 compilation from the makefile. the required headers are not provided by mingw, and are not available to the build bot, so don't bother.
fix v *= v.x and similar opcodes.
fteqcc: fixed support for áéÃóú type chars in names. utf-8 files now properly supported (even with the utf-8 bom/identifier). utf-16 also supported.
fteqcc: fixed '#if 1 == 3 && 4' parsing.
fteqcc: -Werror acts on the warning, rather than as a separate error. Line numbers are thus more readable.
fteqcc: copyright message now includes compile date instead.
fteqccgui: the treeview control is now coloured depending on whether there were warnings/errors in the last compile.
fteqccgui: the output window is now focused and scrolls down as compilation progresses.
pr_dumpplatform command dumps out some pragmas to convert more serious warnings to errors. This is to avoid the infamous 'fteqcc sucks cos my code sucks' issue.
rewrote prespawn/modelist/soundlist code. server tracks progress now.
------------------------------------------------------------------------
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4167 fc73d0e0-1445-4013-8a0c-d673dee63da5
2013-03-12 22:29:40 +00:00
if ( numfiles = = QCC_MAX_FILES )
2004-08-23 01:38:21 +00:00
return ;
// QCC_Error ("PrecacheFile: numfiles == MAX_FILES");
2013-03-12 22:35:33 +00:00
strcpy ( precache_file [ i ] . name , n ) ;
2004-08-23 01:38:21 +00:00
if ( ch > = ' 1 ' & & ch < = ' 9 ' )
2013-03-12 22:35:33 +00:00
precache_file [ i ] . block = ch - ' 0 ' ;
2004-08-23 01:38:21 +00:00
else
2013-03-12 22:35:33 +00:00
precache_file [ i ] . block = 1 ;
2004-08-23 01:38:21 +00:00
numfiles + + ;
}
void QCC_PrecacheFileOptimised ( char * n , int ch )
{
int i ;
for ( i = 0 ; i < numfiles ; i + + )
2013-03-12 22:35:33 +00:00
if ( ! STRCMP ( n , precache_file [ i ] . name ) )
2004-08-23 01:38:21 +00:00
return ;
------------------------------------------------------------------------
r4169 | acceptthis | 2013-01-17 08:55:12 +0000 (Thu, 17 Jan 2013) | 31 lines
removed MAX_VISEDICTS limit.
PEXT2_REPLACEMENTDELTAS tweaked, now has 4 million entity limit. still not enabled by default.
TE_BEAM now maps to a separate TEQW_BEAM to avoid conflicts with QW.
added android multitouch emulation for windows/rawinput (in_simulatemultitouch).
split topcolor/bottomcolor from scoreboard, for dp's colormap|1024 feature.
now using utf-8 for windows consoles.
qcc warnings/errors now give clickable console links for quick+easy editing.
disabled menutint when the currently active item changes contrast or gamma (for OneManClan).
Added support for drawfont/drawfontscale.
tweaked the qcvm a little to reduce the number of pointers.
.doll file loading. still experimental and will likely crash. requires csqc active, even if its a dummy progs. this will be fixed in time. Still other things that need cleaning up.
windows: gl_font "?" shows the standard windows font-selection dialog, and can be used to select windows fonts. not all work. and you probably don't want to use windings.
fixed splitscreen support when playing mvds. added mini-scoreboards to splitscreen.
editor/debugger now shows asm if there's no linenumber info. also, pressing f1 for help shows the shortcuts.
Added support for .framegroups files for psk(psa) and iqm formats.
True support for ezquake's colour codes. Mutually exclusive with background colours.
path command output slightly more readable.
added support for digest_hex (MD4, SHA1, CRC16).
skingroups now colourmap correctly.
Fix terrain colour hints, and litdata from the wrong bsp.
fix ftp dual-homed issue. support epsv command, and enable ipv6 (eprt still not supported).
remove d3d11 compilation from the makefile. the required headers are not provided by mingw, and are not available to the build bot, so don't bother.
fix v *= v.x and similar opcodes.
fteqcc: fixed support for áéÃóú type chars in names. utf-8 files now properly supported (even with the utf-8 bom/identifier). utf-16 also supported.
fteqcc: fixed '#if 1 == 3 && 4' parsing.
fteqcc: -Werror acts on the warning, rather than as a separate error. Line numbers are thus more readable.
fteqcc: copyright message now includes compile date instead.
fteqccgui: the treeview control is now coloured depending on whether there were warnings/errors in the last compile.
fteqccgui: the output window is now focused and scrolls down as compilation progresses.
pr_dumpplatform command dumps out some pragmas to convert more serious warnings to errors. This is to avoid the infamous 'fteqcc sucks cos my code sucks' issue.
rewrote prespawn/modelist/soundlist code. server tracks progress now.
------------------------------------------------------------------------
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4167 fc73d0e0-1445-4013-8a0c-d673dee63da5
2013-03-12 22:29:40 +00:00
if ( numfiles = = QCC_MAX_FILES )
2004-08-23 01:38:21 +00:00
return ;
// QCC_Error ("PrecacheFile: numfiles == MAX_FILES");
2013-03-12 22:35:33 +00:00
strcpy ( precache_file [ i ] . name , n ) ;
2004-08-23 01:38:21 +00:00
if ( ch > = ' 1 ' & & ch < = ' 9 ' )
2013-03-12 22:35:33 +00:00
precache_file [ i ] . block = ch - ' 0 ' ;
2004-08-23 01:38:21 +00:00
else
2013-03-12 22:35:33 +00:00
precache_file [ i ] . block = 1 ;
2004-08-23 01:38:21 +00:00
numfiles + + ;
}
2009-04-19 00:50:42 +00:00
QCC_def_t * QCC_PR_GenerateFunctionCall ( QCC_def_t * func , QCC_def_t * arglist [ ] , int argcount ) //warning, the func could have no name set if it's a field call.
{
QCC_def_t * d , * oldret , * oself ;
int i ;
QCC_type_t * t ;
int extraparms = false ;
int np ;
int laststatement = numstatements ;
int callconvention ;
QCC_dstatement_t * st ;
func - > timescalled + + ;
if ( QCC_OPCodeValid ( & pr_opcodes [ OP_CALL1H ] ) )
callconvention = OP_CALL1H ; //FTE extended
else
callconvention = OP_CALL1 ; //standard
t = func - > type ;
if ( t - > type = = ev_variant )
{
t - > aux_type = type_variant ;
}
if ( t - > type ! = ev_function & & t - > type ! = ev_variant )
{
QCC_PR_ParseErrorPrintDef ( ERR_NOTAFUNCTION , func , " not a function " ) ;
}
// copy the arguments to the global parameter variables
if ( t - > type = = ev_variant )
{
extraparms = true ;
np = 0 ;
}
else if ( t - > num_parms < 0 )
{
extraparms = true ;
np = ( t - > num_parms * - 1 ) - 1 ;
}
else
np = t - > num_parms ;
2011-05-15 13:23:13 +00:00
2009-04-19 00:50:42 +00:00
if ( strchr ( func - > name , ' : ' ) & & laststatement & & statements [ laststatement - 1 ] . op = = OP_LOAD_FNC & & statements [ laststatement - 1 ] . c = = func - > ofs )
{ //we're entering OO code with a different self.
//eg: other.touch(self)
//FIXME: problems could occur with hexen2 calling conventions when parm0/1 is 'self'
//thiscall. copy the right ent into 'self' (if it's not the same offset)
2012-01-17 07:57:46 +00:00
d = QCC_PR_GetDef ( type_entity , " self " , NULL , true , 0 , false ) ;
2009-04-19 00:50:42 +00:00
if ( statements [ laststatement - 1 ] . a ! = d - > ofs )
{
oself = QCC_GetTemp ( type_entity ) ;
//oself = self
QCC_PR_SimpleStatement ( OP_STORE_ENT , d - > ofs , oself - > ofs , 0 , false ) ;
//self = other
QCC_PR_SimpleStatement ( OP_STORE_ENT , statements [ laststatement - 1 ] . a , d - > ofs , 0 , false ) ;
//if the args refered to self, update them to refer to oself instead
//(as self is now set to 'other')
for ( i = 0 ; i < argcount ; i + + )
{
if ( arglist [ i ] - > ofs = = d - > ofs )
{
arglist [ i ] = oself ;
}
}
}
else
{
//it was self.func() anyway
oself = NULL ;
d = NULL ;
}
}
else
{ //regular func call
oself = NULL ;
d = NULL ;
}
// write the arguments (except for first two if hexenc)
for ( i = 0 ; i < argcount ; i + + )
{
if ( i > = MAX_PARMS )
d = extra_parms [ i - MAX_PARMS ] ;
else
d = & def_parms [ i ] ;
if ( callconvention = = OP_CALL1H )
if ( i < 2 )
{
//first two args are passed in the call opcode, so don't need to be copied
arglist [ i ] - > references + + ;
d - > references + + ;
2011-10-03 02:45:44 +00:00
/*don't free these temps yet, free them after the return check*/
2009-04-19 00:50:42 +00:00
continue ;
}
2012-02-13 09:24:01 +00:00
if ( arglist [ i ] - > type - > size = = 3 | | ! opt_nonvec_parms )
2009-04-19 00:50:42 +00:00
QCC_FreeTemp ( QCC_PR_Statement ( & pr_opcodes [ OP_STORE_V ] , arglist [ i ] , d , ( QCC_dstatement_t * * ) 0xffffffff ) ) ;
else
{
d - > type = arglist [ i ] - > type ;
QCC_FreeTemp ( QCC_PR_Statement ( & pr_opcodes [ OP_STORE_F ] , arglist [ i ] , d , ( QCC_dstatement_t * * ) 0xffffffff ) ) ;
optres_nonvec_parms + + ;
}
}
//if the return value was in use, save it off now, so that it doesn't get clobbered
if ( def_ret . temp - > used )
oldret = QCC_GetTemp ( def_ret . type ) ;
2011-10-03 02:45:44 +00:00
else
oldret = NULL ;
/*can free temps used for arguments now*/
if ( callconvention = = OP_CALL1H )
{
for ( i = 0 ; i < argcount & & i < 2 ; i + + )
QCC_FreeTemp ( arglist [ i ] ) ;
}
if ( oldret & & ! def_ret . temp - > used )
{
QCC_FreeTemp ( oldret ) ;
oldret = NULL ;
}
else if ( def_ret . temp - > used )
{
2009-04-19 00:50:42 +00:00
if ( def_ret . type - > size = = 3 )
2011-10-03 02:45:44 +00:00
QCC_FreeTemp ( QCC_PR_Statement ( & pr_opcodes [ OP_STORE_V ] , & def_ret , oldret , ( void * ) 0xffffffff ) ) ;
2009-04-19 00:50:42 +00:00
else
2011-10-03 02:45:44 +00:00
QCC_FreeTemp ( QCC_PR_Statement ( & pr_opcodes [ OP_STORE_F ] , & def_ret , oldret , ( void * ) 0xffffffff ) ) ;
2009-04-19 00:50:42 +00:00
QCC_UnFreeTemp ( oldret ) ;
QCC_UnFreeTemp ( & def_ret ) ;
QCC_PR_ParseWarning ( WARN_FIXEDRETURNVALUECONFLICT , " Return value conflict - output is inefficient " ) ;
}
else
oldret = NULL ;
//we dont need to lock the local containing the function index because its thrown away after the call anyway
//(if a function is called in the argument list then it'll be locked as part of that call)
QCC_FreeTemp ( func ) ;
QCC_LockActiveTemps ( ) ; //any temps before are likly to be used with the return value.
QCC_UnFreeTemp ( func ) ;
//generate the call
if ( argcount > MAX_PARMS )
QCC_FreeTemp ( QCC_PR_Statement ( & pr_opcodes [ callconvention - 1 + MAX_PARMS ] , func , 0 , ( QCC_dstatement_t * * ) & st ) ) ;
else if ( argcount )
QCC_FreeTemp ( QCC_PR_Statement ( & pr_opcodes [ callconvention - 1 + argcount ] , func , 0 , ( QCC_dstatement_t * * ) & st ) ) ;
else
QCC_FreeTemp ( QCC_PR_Statement ( & pr_opcodes [ OP_CALL0 ] , func , 0 , ( QCC_dstatement_t * * ) & st ) ) ;
if ( callconvention = = OP_CALL1H )
{
if ( argcount )
{
st - > b = arglist [ 0 ] - > ofs ;
// QCC_FreeTemp(param[0]);
if ( argcount > 1 )
{
st - > c = arglist [ 1 ] - > ofs ;
// QCC_FreeTemp(param[1]);
}
}
}
2011-05-15 13:23:13 +00:00
2009-04-19 00:50:42 +00:00
//restore the class owner
if ( oself )
2013-03-12 22:32:25 +00:00
{
2009-04-19 00:50:42 +00:00
QCC_PR_SimpleStatement ( OP_STORE_ENT , oself - > ofs , d - > ofs , 0 , false ) ;
2013-03-12 22:32:25 +00:00
QCC_FreeTemp ( oself ) ;
}
2009-04-19 00:50:42 +00:00
if ( oldret )
{
2011-10-03 02:45:44 +00:00
if ( oldret - > temp & & ! oldret - > temp - > used )
QCC_PR_ParseWarning ( 0 , " Ret was freed \n " ) ;
2009-05-11 00:17:31 +00:00
2009-04-19 00:50:42 +00:00
//if we preserved the ofs_ret global, restore it here
if ( t - > type = = ev_variant )
{
d = QCC_GetTemp ( type_variant ) ;
2011-10-03 02:45:44 +00:00
QCC_FreeTemp ( QCC_PR_Statement ( pr_opcodes + OP_STORE_F , & def_ret , d , ( void * ) 0xffffffff ) ) ;
2009-04-19 00:50:42 +00:00
}
else
{
d = QCC_GetTemp ( t - > aux_type ) ;
if ( t - > aux_type - > size = = 3 )
2011-10-03 02:45:44 +00:00
QCC_FreeTemp ( QCC_PR_Statement ( pr_opcodes + OP_STORE_V , & def_ret , d , ( void * ) 0xffffffff ) ) ;
2009-04-19 00:50:42 +00:00
else
2011-10-03 02:45:44 +00:00
QCC_FreeTemp ( QCC_PR_Statement ( pr_opcodes + OP_STORE_F , & def_ret , d , ( void * ) 0xffffffff ) ) ;
2009-04-19 00:50:42 +00:00
}
if ( def_ret . type - > size = = 3 )
2011-10-03 02:45:44 +00:00
QCC_FreeTemp ( QCC_PR_Statement ( pr_opcodes + OP_STORE_V , oldret , & def_ret , ( void * ) 0xffffffff ) ) ;
2009-04-19 00:50:42 +00:00
else
2011-10-03 02:45:44 +00:00
QCC_FreeTemp ( QCC_PR_Statement ( pr_opcodes + OP_STORE_F , oldret , & def_ret , ( void * ) 0xffffffff ) ) ;
2009-04-19 00:50:42 +00:00
QCC_FreeTemp ( oldret ) ;
QCC_UnFreeTemp ( & def_ret ) ;
QCC_UnFreeTemp ( d ) ;
return d ;
}
if ( t - > type = = ev_variant )
def_ret . type = type_variant ;
else
def_ret . type = t - > aux_type ;
if ( def_ret . temp - > used )
QCC_PR_ParseWarning ( WARN_FIXEDRETURNVALUECONFLICT , " Return value conflict - output is inefficient " ) ;
def_ret . temp - > used = true ;
return & def_ret ;
}
2004-08-23 01:38:21 +00:00
/*
= = = = = = = = = = = =
PR_ParseFunctionCall
= = = = = = = = = = = =
*/
QCC_def_t * QCC_PR_ParseFunctionCall ( QCC_def_t * func ) //warning, the func could have no name set if it's a field call.
{
2013-03-12 22:47:42 +00:00
QCC_def_t * e , * d , * oself , * out ;
2009-04-19 00:50:42 +00:00
int arg ;
2004-08-23 01:38:21 +00:00
QCC_type_t * t , * p ;
int extraparms = false ;
int np ;
int callconvention ;
QCC_def_t * param [ MAX_PARMS + MAX_EXTRA_PARMS ] ;
func - > timescalled + + ;
if ( QCC_OPCodeValid ( & pr_opcodes [ OP_CALL1H ] ) )
callconvention = OP_CALL1H ; //FTE extended
else
2004-11-13 17:18:34 +00:00
callconvention = OP_CALL1 ; //standard
2004-08-23 01:38:21 +00:00
t = func - > type ;
2005-02-28 07:16:19 +00:00
if ( t - > type = = ev_variant )
{
t - > aux_type = type_variant ;
}
if ( t - > type ! = ev_function & & t - > type ! = ev_variant )
2004-08-23 01:38:21 +00:00
{
QCC_PR_ParseErrorPrintDef ( ERR_NOTAFUNCTION , func , " not a function " ) ;
}
2005-02-28 07:16:19 +00:00
if ( ! t - > num_parms & & t - > type ! = ev_variant ) //intrinsics. These base functions have variable arguments. I would check for (...) args too, but that might be used for extended builtin functionality. (this code wouldn't compile otherwise)
2004-08-23 01:38:21 +00:00
{
2011-09-03 03:49:43 +00:00
if ( ! strcmp ( func - > name , " sizeof " ) )
{
QCC_type_t * t ;
2011-10-03 02:45:44 +00:00
if ( ! func - > initialized )
func - > initialized = 3 ;
2011-09-03 03:49:43 +00:00
func - > references + + ;
2012-10-08 04:36:10 +00:00
t = QCC_PR_ParseType ( false , true ) ;
if ( t )
{
QCC_PR_Expect ( " ) " ) ;
return QCC_MakeIntConst ( t - > size * 4 ) ;
}
else
{
------------------------------------------------------------------------
r4169 | acceptthis | 2013-01-17 08:55:12 +0000 (Thu, 17 Jan 2013) | 31 lines
removed MAX_VISEDICTS limit.
PEXT2_REPLACEMENTDELTAS tweaked, now has 4 million entity limit. still not enabled by default.
TE_BEAM now maps to a separate TEQW_BEAM to avoid conflicts with QW.
added android multitouch emulation for windows/rawinput (in_simulatemultitouch).
split topcolor/bottomcolor from scoreboard, for dp's colormap|1024 feature.
now using utf-8 for windows consoles.
qcc warnings/errors now give clickable console links for quick+easy editing.
disabled menutint when the currently active item changes contrast or gamma (for OneManClan).
Added support for drawfont/drawfontscale.
tweaked the qcvm a little to reduce the number of pointers.
.doll file loading. still experimental and will likely crash. requires csqc active, even if its a dummy progs. this will be fixed in time. Still other things that need cleaning up.
windows: gl_font "?" shows the standard windows font-selection dialog, and can be used to select windows fonts. not all work. and you probably don't want to use windings.
fixed splitscreen support when playing mvds. added mini-scoreboards to splitscreen.
editor/debugger now shows asm if there's no linenumber info. also, pressing f1 for help shows the shortcuts.
Added support for .framegroups files for psk(psa) and iqm formats.
True support for ezquake's colour codes. Mutually exclusive with background colours.
path command output slightly more readable.
added support for digest_hex (MD4, SHA1, CRC16).
skingroups now colourmap correctly.
Fix terrain colour hints, and litdata from the wrong bsp.
fix ftp dual-homed issue. support epsv command, and enable ipv6 (eprt still not supported).
remove d3d11 compilation from the makefile. the required headers are not provided by mingw, and are not available to the build bot, so don't bother.
fix v *= v.x and similar opcodes.
fteqcc: fixed support for áéÃóú type chars in names. utf-8 files now properly supported (even with the utf-8 bom/identifier). utf-16 also supported.
fteqcc: fixed '#if 1 == 3 && 4' parsing.
fteqcc: -Werror acts on the warning, rather than as a separate error. Line numbers are thus more readable.
fteqcc: copyright message now includes compile date instead.
fteqccgui: the treeview control is now coloured depending on whether there were warnings/errors in the last compile.
fteqccgui: the output window is now focused and scrolls down as compilation progresses.
pr_dumpplatform command dumps out some pragmas to convert more serious warnings to errors. This is to avoid the infamous 'fteqcc sucks cos my code sucks' issue.
rewrote prespawn/modelist/soundlist code. server tracks progress now.
------------------------------------------------------------------------
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4167 fc73d0e0-1445-4013-8a0c-d673dee63da5
2013-03-12 22:29:40 +00:00
int sz ;
2012-10-08 04:36:10 +00:00
int oldstcount = numstatements ;
e = QCC_PR_Expression ( TOP_PRIORITY , EXPR_DISALLOW_COMMA ) ;
//the term should not have side effects, or generate any actual statements.
numstatements = oldstcount ;
QCC_PR_Expect ( " ) " ) ;
if ( ! e )
QCC_PR_ParseErrorPrintDef ( ERR_NOTAFUNCTION , func , " sizeof term not supported " ) ;
------------------------------------------------------------------------
r4169 | acceptthis | 2013-01-17 08:55:12 +0000 (Thu, 17 Jan 2013) | 31 lines
removed MAX_VISEDICTS limit.
PEXT2_REPLACEMENTDELTAS tweaked, now has 4 million entity limit. still not enabled by default.
TE_BEAM now maps to a separate TEQW_BEAM to avoid conflicts with QW.
added android multitouch emulation for windows/rawinput (in_simulatemultitouch).
split topcolor/bottomcolor from scoreboard, for dp's colormap|1024 feature.
now using utf-8 for windows consoles.
qcc warnings/errors now give clickable console links for quick+easy editing.
disabled menutint when the currently active item changes contrast or gamma (for OneManClan).
Added support for drawfont/drawfontscale.
tweaked the qcvm a little to reduce the number of pointers.
.doll file loading. still experimental and will likely crash. requires csqc active, even if its a dummy progs. this will be fixed in time. Still other things that need cleaning up.
windows: gl_font "?" shows the standard windows font-selection dialog, and can be used to select windows fonts. not all work. and you probably don't want to use windings.
fixed splitscreen support when playing mvds. added mini-scoreboards to splitscreen.
editor/debugger now shows asm if there's no linenumber info. also, pressing f1 for help shows the shortcuts.
Added support for .framegroups files for psk(psa) and iqm formats.
True support for ezquake's colour codes. Mutually exclusive with background colours.
path command output slightly more readable.
added support for digest_hex (MD4, SHA1, CRC16).
skingroups now colourmap correctly.
Fix terrain colour hints, and litdata from the wrong bsp.
fix ftp dual-homed issue. support epsv command, and enable ipv6 (eprt still not supported).
remove d3d11 compilation from the makefile. the required headers are not provided by mingw, and are not available to the build bot, so don't bother.
fix v *= v.x and similar opcodes.
fteqcc: fixed support for áéÃóú type chars in names. utf-8 files now properly supported (even with the utf-8 bom/identifier). utf-16 also supported.
fteqcc: fixed '#if 1 == 3 && 4' parsing.
fteqcc: -Werror acts on the warning, rather than as a separate error. Line numbers are thus more readable.
fteqcc: copyright message now includes compile date instead.
fteqccgui: the treeview control is now coloured depending on whether there were warnings/errors in the last compile.
fteqccgui: the output window is now focused and scrolls down as compilation progresses.
pr_dumpplatform command dumps out some pragmas to convert more serious warnings to errors. This is to avoid the infamous 'fteqcc sucks cos my code sucks' issue.
rewrote prespawn/modelist/soundlist code. server tracks progress now.
------------------------------------------------------------------------
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4167 fc73d0e0-1445-4013-8a0c-d673dee63da5
2013-03-12 22:29:40 +00:00
if ( ! e - > arraysize )
sz = 1 ;
else
sz = e - > arraysize ;
sz * = e - > type - > size ;
sz * = 4 ;
QCC_FreeTemp ( e ) ;
return QCC_MakeIntConst ( sz ) ;
2012-10-08 04:36:10 +00:00
}
2011-10-03 02:45:44 +00:00
}
if ( ! strcmp ( func - > name , " _ " ) )
{
if ( ! func - > initialized )
func - > initialized = 3 ;
func - > references + + ;
if ( pr_token_type = = tt_immediate & & pr_immediate_type - > type = = ev_string )
{
d = QCC_MakeTranslateStringConst ( pr_immediate_string ) ;
QCC_PR_Lex ( ) ;
}
else
2013-03-12 22:47:42 +00:00
{
2011-10-03 02:45:44 +00:00
QCC_PR_ParseErrorPrintDef ( ERR_TYPEMISMATCHPARM , func , " _() intrinsic accepts only a string immediate " , 1 ) ;
2013-03-12 22:47:42 +00:00
d = NULL ;
}
2011-10-03 02:45:44 +00:00
QCC_PR_Expect ( " ) " ) ;
return d ;
2011-09-03 03:49:43 +00:00
}
2004-08-23 01:38:21 +00:00
if ( ! strcmp ( func - > name , " random " ) )
{
2013-03-12 22:47:42 +00:00
QCC_def_t * old = NULL ;
2011-10-03 02:45:44 +00:00
if ( ! func - > initialized )
func - > initialized = 3 ;
2004-08-23 01:38:21 +00:00
func - > references + + ;
2005-03-20 02:57:11 +00:00
if ( ! QCC_PR_CheckToken ( " ) " ) )
2004-08-23 01:38:21 +00:00
{
2009-07-03 19:02:42 +00:00
e = QCC_PR_Expression ( TOP_PRIORITY , EXPR_DISALLOW_COMMA ) ;
2004-08-23 01:38:21 +00:00
if ( e - > type - > type ! = ev_float )
QCC_PR_ParseErrorPrintDef ( ERR_TYPEMISMATCHPARM , func , " type mismatch on parm %i " , 1 ) ;
2005-03-20 02:57:11 +00:00
if ( ! QCC_PR_CheckToken ( " ) " ) )
2004-08-23 01:38:21 +00:00
{
QCC_PR_Expect ( " , " ) ;
2009-07-03 19:02:42 +00:00
d = QCC_PR_Expression ( TOP_PRIORITY , EXPR_DISALLOW_COMMA ) ;
2004-08-23 01:38:21 +00:00
if ( d - > type - > type ! = ev_float )
QCC_PR_ParseErrorPrintDef ( ERR_TYPEMISMATCHPARM , func , " type mismatch on parm %i " , 2 ) ;
QCC_PR_Expect ( " ) " ) ;
}
else
d = NULL ;
}
else
{
e = NULL ;
d = NULL ;
}
2011-09-03 03:49:43 +00:00
out = & def_ret ;
2004-08-23 01:38:21 +00:00
if ( QCC_OPCodeValid ( & pr_opcodes [ OP_RAND0 ] ) )
{
2011-09-03 03:49:43 +00:00
if ( qcc_targetformat ! = QCF_HEXEN2 )
2009-05-24 18:56:05 +00:00
out = QCC_GetTemp ( type_float ) ;
2011-09-03 03:49:43 +00:00
else if ( out - > temp - > used )
{
old = QCC_GetTemp ( out - > type ) ;
if ( def_ret . type - > size = = 3 )
QCC_FreeTemp ( QCC_PR_Statement ( & pr_opcodes [ OP_STORE_V ] , out , old , NULL ) ) ;
else
QCC_FreeTemp ( QCC_PR_Statement ( & pr_opcodes [ OP_STORE_F ] , out , old , NULL ) ) ;
QCC_UnFreeTemp ( old ) ;
QCC_UnFreeTemp ( out ) ;
QCC_PR_ParseWarning ( WARN_FIXEDRETURNVALUECONFLICT , " Return value conflict - output is inefficient " ) ;
}
2009-05-24 18:56:05 +00:00
else
2011-09-03 03:49:43 +00:00
old = NULL ;
2011-05-15 13:23:13 +00:00
2004-08-23 01:38:21 +00:00
if ( e )
{
if ( d )
2009-05-24 18:56:05 +00:00
QCC_PR_SimpleStatement ( OP_RAND2 , e - > ofs , d - > ofs , out - > ofs , false ) ;
2004-08-23 01:38:21 +00:00
else
2009-05-24 18:56:05 +00:00
QCC_PR_SimpleStatement ( OP_RAND1 , e - > ofs , 0 , out - > ofs , false ) ;
2004-08-23 01:38:21 +00:00
}
else
2009-05-24 18:56:05 +00:00
QCC_PR_SimpleStatement ( OP_RAND0 , 0 , 0 , out - > ofs , false ) ;
2004-08-23 01:38:21 +00:00
}
else
{
2011-09-03 03:49:43 +00:00
if ( out - > temp - > used )
2009-05-24 18:56:05 +00:00
{
2011-09-03 03:49:43 +00:00
old = QCC_GetTemp ( out - > type ) ;
2009-05-24 18:56:05 +00:00
if ( def_ret . type - > size = = 3 )
2011-09-03 03:49:43 +00:00
QCC_FreeTemp ( QCC_PR_Statement ( & pr_opcodes [ OP_STORE_V ] , out , old , NULL ) ) ;
2009-05-24 18:56:05 +00:00
else
2011-09-03 03:49:43 +00:00
QCC_FreeTemp ( QCC_PR_Statement ( & pr_opcodes [ OP_STORE_F ] , out , old , NULL ) ) ;
2009-05-24 18:56:05 +00:00
QCC_UnFreeTemp ( old ) ;
2011-09-03 03:49:43 +00:00
QCC_UnFreeTemp ( out ) ;
2009-05-24 18:56:05 +00:00
QCC_PR_ParseWarning ( WARN_FIXEDRETURNVALUECONFLICT , " Return value conflict - output is inefficient " ) ;
}
else
old = NULL ;
2011-05-15 13:23:13 +00:00
2004-08-23 01:38:21 +00:00
if ( e )
{
if ( d )
{
QCC_dstatement_t * st ;
QCC_def_t * t ;
2006-01-28 06:41:20 +00:00
QCC_PR_SimpleStatement ( OP_CALL0 , func - > ofs , 0 , 0 , false ) ;
2004-08-23 01:38:21 +00:00
if ( ( ! d - > constant | | ! e - > constant ) & & G_FLOAT ( d - > ofs ) > = G_FLOAT ( d - > ofs ) )
{
2011-07-08 18:59:48 +00:00
t = QCC_PR_Statement ( & pr_opcodes [ OP_GT_F ] , d , e , NULL ) ;
QCC_FreeTemp ( QCC_PR_Statement ( & pr_opcodes [ OP_IFNOT_I ] , t , 0 , & st ) ) ;
2004-08-23 01:38:21 +00:00
st - > b = 3 ;
t = QCC_PR_Statement ( & pr_opcodes [ OP_SUB_F ] , d , e , NULL ) ;
2006-01-28 06:41:20 +00:00
QCC_PR_SimpleStatement ( OP_MUL_F , OFS_RETURN , t - > ofs , OFS_RETURN , false ) ;
2004-08-23 01:38:21 +00:00
QCC_FreeTemp ( t ) ;
2006-01-28 06:41:20 +00:00
QCC_PR_SimpleStatement ( OP_ADD_F , OFS_RETURN , e - > ofs , OFS_RETURN , false ) ;
2004-08-23 01:38:21 +00:00
QCC_FreeTemp ( QCC_PR_Statement ( & pr_opcodes [ OP_GOTO ] , 0 , 0 , & st ) ) ;
st - > a = 3 ;
}
2011-05-15 13:23:13 +00:00
2004-08-23 01:38:21 +00:00
t = QCC_PR_Statement ( & pr_opcodes [ OP_SUB_F ] , e , d , NULL ) ;
2006-01-28 06:41:20 +00:00
QCC_PR_SimpleStatement ( OP_MUL_F , OFS_RETURN , t - > ofs , OFS_RETURN , false ) ;
2004-08-23 01:38:21 +00:00
QCC_FreeTemp ( t ) ;
2006-01-28 06:41:20 +00:00
QCC_PR_SimpleStatement ( OP_ADD_F , OFS_RETURN , d - > ofs , OFS_RETURN , false ) ;
2004-08-23 01:38:21 +00:00
}
else
{
2006-01-28 06:41:20 +00:00
QCC_PR_SimpleStatement ( OP_CALL0 , func - > ofs , 0 , 0 , false ) ;
QCC_PR_SimpleStatement ( OP_MUL_F , OFS_RETURN , e - > ofs , OFS_RETURN , false ) ;
2004-08-23 01:38:21 +00:00
}
}
else
2006-01-28 06:41:20 +00:00
QCC_PR_SimpleStatement ( OP_CALL0 , func - > ofs , 0 , 0 , false ) ;
2004-08-23 01:38:21 +00:00
}
if ( e )
{
QCC_FreeTemp ( e ) ;
e - > references + + ;
}
if ( d )
{
d - > references + + ;
QCC_FreeTemp ( d ) ;
}
if ( old )
{
d = QCC_GetTemp ( type_float ) ;
QCC_FreeTemp ( QCC_PR_Statement ( pr_opcodes + OP_STORE_F , & def_ret , d , NULL ) ) ;
if ( def_ret . type - > size = = 3 )
QCC_FreeTemp ( QCC_PR_Statement ( pr_opcodes + OP_STORE_V , old , & def_ret , NULL ) ) ;
else
QCC_FreeTemp ( QCC_PR_Statement ( pr_opcodes + OP_STORE_F , old , & def_ret , NULL ) ) ;
QCC_FreeTemp ( old ) ;
2009-05-24 18:56:05 +00:00
QCC_UnFreeTemp ( d ) ;
QCC_UnFreeTemp ( & def_ret ) ;
2004-08-23 01:38:21 +00:00
return d ;
}
2011-09-03 03:49:43 +00:00
if ( out = = & def_ret )
{
if ( out - > temp - > used )
QCC_PR_ParseWarning ( 0 , " Return value conflict - output is likly to be invalid " ) ;
out - > temp - > used = true ;
out - > type = type_float ;
}
return out ;
2004-08-23 01:38:21 +00:00
}
if ( ! strcmp ( func - > name , " randomv " ) )
{
2013-03-12 22:47:42 +00:00
QCC_def_t * old ;
2009-05-24 18:56:05 +00:00
out = NULL ;
2011-10-03 02:45:44 +00:00
if ( ! func - > initialized )
func - > initialized = 3 ;
2004-08-23 01:38:21 +00:00
func - > references + + ;
2005-03-20 02:57:11 +00:00
if ( ! QCC_PR_CheckToken ( " ) " ) )
2004-08-23 01:38:21 +00:00
{
2009-07-03 19:02:42 +00:00
e = QCC_PR_Expression ( TOP_PRIORITY , EXPR_DISALLOW_COMMA ) ;
2004-08-23 01:38:21 +00:00
if ( e - > type - > type ! = ev_vector )
QCC_PR_ParseErrorPrintDef ( ERR_TYPEMISMATCHPARM , func , " type mismatch on parm %i " , 1 ) ;
2005-03-20 02:57:11 +00:00
if ( ! QCC_PR_CheckToken ( " ) " ) )
2004-08-23 01:38:21 +00:00
{
QCC_PR_Expect ( " , " ) ;
2009-07-03 19:02:42 +00:00
d = QCC_PR_Expression ( TOP_PRIORITY , EXPR_DISALLOW_COMMA ) ;
2004-08-23 01:38:21 +00:00
if ( d - > type - > type ! = ev_vector )
QCC_PR_ParseErrorPrintDef ( ERR_TYPEMISMATCHPARM , func , " type mismatch on parm %i " , 2 ) ;
QCC_PR_Expect ( " ) " ) ;
}
else
d = NULL ;
}
else
{
e = NULL ;
d = NULL ;
}
if ( QCC_OPCodeValid ( & pr_opcodes [ OP_RANDV0 ] ) )
{
2013-03-12 22:47:42 +00:00
old = NULL ;
2009-05-24 18:56:05 +00:00
if ( def_ret . temp - > used )
out = QCC_GetTemp ( type_vector ) ;
else
out = & def_ret ;
2011-05-15 13:23:13 +00:00
2004-08-23 01:38:21 +00:00
if ( e )
{
if ( d )
2009-05-24 18:56:05 +00:00
QCC_PR_SimpleStatement ( OP_RANDV2 , e - > ofs , d - > ofs , out - > ofs , false ) ;
2004-08-23 01:38:21 +00:00
else
2009-05-24 18:56:05 +00:00
QCC_PR_SimpleStatement ( OP_RANDV1 , e - > ofs , 0 , out - > ofs , false ) ;
2004-08-23 01:38:21 +00:00
}
else
2009-05-24 18:56:05 +00:00
QCC_PR_SimpleStatement ( OP_RANDV0 , 0 , 0 , out - > ofs , false ) ;
2004-08-23 01:38:21 +00:00
}
else
{
2009-05-24 18:56:05 +00:00
if ( def_ret . temp - > used )
{
old = QCC_GetTemp ( def_ret . type ) ;
if ( def_ret . type - > size = = 3 )
QCC_PR_Statement ( & pr_opcodes [ OP_STORE_V ] , & def_ret , old , NULL ) ;
else
QCC_PR_Statement ( & pr_opcodes [ OP_STORE_F ] , & def_ret , old , NULL ) ;
QCC_UnFreeTemp ( old ) ;
QCC_UnFreeTemp ( & def_ret ) ;
QCC_PR_ParseWarning ( WARN_FIXEDRETURNVALUECONFLICT , " Return value conflict - output is inefficient " ) ;
}
else
old = NULL ;
2011-05-15 13:23:13 +00:00
2004-08-23 01:38:21 +00:00
if ( e )
{
if ( d )
{
QCC_def_t * t ;
2006-01-28 06:41:20 +00:00
QCC_PR_SimpleStatement ( OP_CALL0 , func - > ofs , 0 , 0 , false ) ;
2004-08-23 01:38:21 +00:00
if ( ( ! d - > constant | | ! e - > constant ) & & G_FLOAT ( d - > ofs ) > = G_FLOAT ( d - > ofs ) )
{
t = QCC_GetTemp ( type_float ) ;
2011-07-08 18:59:48 +00:00
QCC_PR_SimpleStatement ( OP_GT_F , d - > ofs + 2 , e - > ofs + 2 , t - > ofs , false ) ;
QCC_PR_SimpleStatement ( OP_IFNOT_I , t - > ofs , 3 , 0 , false ) ;
2004-08-23 01:38:21 +00:00
2006-01-28 06:41:20 +00:00
QCC_PR_SimpleStatement ( OP_SUB_F , d - > ofs + 2 , e - > ofs + 2 , t - > ofs , false ) ;
QCC_PR_SimpleStatement ( OP_MUL_F , OFS_RETURN , t - > ofs , OFS_RETURN + 2 , false ) ;
2004-08-23 01:38:21 +00:00
QCC_FreeTemp ( t ) ;
2006-01-28 06:41:20 +00:00
QCC_PR_SimpleStatement ( OP_ADD_F , OFS_RETURN , e - > ofs + 2 , OFS_RETURN + 2 , false ) ;
2004-08-23 01:38:21 +00:00
2006-01-28 06:41:20 +00:00
QCC_PR_SimpleStatement ( OP_GOTO , 3 , 0 , 0 , false ) ;
2004-08-23 01:38:21 +00:00
}
2011-05-15 13:23:13 +00:00
2004-08-23 01:38:21 +00:00
t = QCC_GetTemp ( type_float ) ;
2006-01-28 06:41:20 +00:00
QCC_PR_SimpleStatement ( OP_SUB_F , d - > ofs + 2 , e - > ofs + 2 , t - > ofs , false ) ;
QCC_PR_SimpleStatement ( OP_MUL_F , OFS_RETURN , t - > ofs , OFS_RETURN + 2 , false ) ;
2004-08-23 01:38:21 +00:00
QCC_FreeTemp ( t ) ;
2006-01-28 06:41:20 +00:00
QCC_PR_SimpleStatement ( OP_ADD_F , OFS_RETURN , d - > ofs + 2 , OFS_RETURN + 2 , false ) ;
2004-08-23 01:38:21 +00:00
2011-05-15 13:23:13 +00:00
2006-01-28 06:41:20 +00:00
QCC_PR_SimpleStatement ( OP_CALL0 , func - > ofs , 0 , 0 , false ) ;
2004-08-23 01:38:21 +00:00
if ( ( ! d - > constant | | ! e - > constant ) & & G_FLOAT ( d - > ofs ) > = G_FLOAT ( d - > ofs ) )
{
t = QCC_GetTemp ( type_float ) ;
2011-07-08 18:59:48 +00:00
QCC_PR_SimpleStatement ( OP_GT_F , d - > ofs + 1 , e - > ofs + 1 , t - > ofs , false ) ;
QCC_PR_SimpleStatement ( OP_IFNOT_I , t - > ofs , 3 , 0 , false ) ;
2004-08-23 01:38:21 +00:00
2006-01-28 06:41:20 +00:00
QCC_PR_SimpleStatement ( OP_SUB_F , d - > ofs + 1 , e - > ofs + 1 , t - > ofs , false ) ;
QCC_PR_SimpleStatement ( OP_MUL_F , OFS_RETURN , t - > ofs , OFS_RETURN + 1 , false ) ;
2004-08-23 01:38:21 +00:00
QCC_FreeTemp ( t ) ;
2006-01-28 06:41:20 +00:00
QCC_PR_SimpleStatement ( OP_ADD_F , OFS_RETURN , e - > ofs + 1 , OFS_RETURN + 1 , false ) ;
2004-08-23 01:38:21 +00:00
2006-01-28 06:41:20 +00:00
QCC_PR_SimpleStatement ( OP_GOTO , 3 , 0 , 0 , false ) ;
2004-08-23 01:38:21 +00:00
}
2011-05-15 13:23:13 +00:00
2004-08-23 01:38:21 +00:00
t = QCC_GetTemp ( type_float ) ;
2006-01-28 06:41:20 +00:00
QCC_PR_SimpleStatement ( OP_SUB_F , d - > ofs + 1 , e - > ofs + 1 , t - > ofs , false ) ;
QCC_PR_SimpleStatement ( OP_MUL_F , OFS_RETURN , t - > ofs , OFS_RETURN + 1 , false ) ;
2004-08-23 01:38:21 +00:00
QCC_FreeTemp ( t ) ;
2006-01-28 06:41:20 +00:00
QCC_PR_SimpleStatement ( OP_ADD_F , OFS_RETURN , d - > ofs + 1 , OFS_RETURN + 1 , false ) ;
2004-08-23 01:38:21 +00:00
2006-01-28 06:41:20 +00:00
QCC_PR_SimpleStatement ( OP_CALL0 , func - > ofs , 0 , 0 , false ) ;
2004-08-23 01:38:21 +00:00
if ( ( ! d - > constant | | ! e - > constant ) & & G_FLOAT ( d - > ofs ) > = G_FLOAT ( d - > ofs ) )
{
t = QCC_GetTemp ( type_float ) ;
2011-07-08 18:59:48 +00:00
QCC_PR_SimpleStatement ( OP_GT_F , d - > ofs , e - > ofs , t - > ofs , false ) ;
QCC_PR_SimpleStatement ( OP_IFNOT_I , t - > ofs , 3 , 0 , false ) ;
2004-08-23 01:38:21 +00:00
2006-01-28 06:41:20 +00:00
QCC_PR_SimpleStatement ( OP_SUB_F , d - > ofs , e - > ofs , t - > ofs , false ) ;
QCC_PR_SimpleStatement ( OP_MUL_F , OFS_RETURN , t - > ofs , OFS_RETURN , false ) ;
2004-08-23 01:38:21 +00:00
QCC_FreeTemp ( t ) ;
2006-01-28 06:41:20 +00:00
QCC_PR_SimpleStatement ( OP_ADD_F , OFS_RETURN , e - > ofs , OFS_RETURN , false ) ;
2004-08-23 01:38:21 +00:00
2006-01-28 06:41:20 +00:00
QCC_PR_SimpleStatement ( OP_GOTO , 3 , 0 , 0 , false ) ;
2004-08-23 01:38:21 +00:00
}
2011-05-15 13:23:13 +00:00
2004-08-23 01:38:21 +00:00
t = QCC_GetTemp ( type_float ) ;
2006-01-28 06:41:20 +00:00
QCC_PR_SimpleStatement ( OP_SUB_F , d - > ofs , e - > ofs , t - > ofs , false ) ;
QCC_PR_SimpleStatement ( OP_MUL_F , OFS_RETURN , t - > ofs , OFS_RETURN , false ) ;
2004-08-23 01:38:21 +00:00
QCC_FreeTemp ( t ) ;
2006-01-28 06:41:20 +00:00
QCC_PR_SimpleStatement ( OP_ADD_F , OFS_RETURN , d - > ofs , OFS_RETURN , false ) ;
2004-08-23 01:38:21 +00:00
}
else
{
2006-01-28 06:41:20 +00:00
QCC_PR_SimpleStatement ( OP_CALL0 , func - > ofs , 0 , 0 , false ) ;
QCC_PR_SimpleStatement ( OP_MUL_F , OFS_RETURN , e - > ofs , OFS_RETURN + 2 , false ) ;
QCC_PR_SimpleStatement ( OP_CALL0 , func - > ofs , 0 , 0 , false ) ;
QCC_PR_SimpleStatement ( OP_MUL_F , OFS_RETURN , e - > ofs , OFS_RETURN + 1 , false ) ;
QCC_PR_SimpleStatement ( OP_CALL0 , func - > ofs , 0 , 0 , false ) ;
QCC_PR_SimpleStatement ( OP_MUL_F , OFS_RETURN , e - > ofs , OFS_RETURN , false ) ;
2004-08-23 01:38:21 +00:00
}
}
else
{
2006-01-28 06:41:20 +00:00
QCC_PR_SimpleStatement ( OP_CALL0 , func - > ofs , 0 , 0 , false ) ;
QCC_PR_SimpleStatement ( OP_STORE_F , OFS_RETURN , OFS_RETURN + 2 , 0 , false ) ;
QCC_PR_SimpleStatement ( OP_CALL0 , func - > ofs , 0 , 0 , false ) ;
QCC_PR_SimpleStatement ( OP_STORE_F , OFS_RETURN , OFS_RETURN + 1 , 0 , false ) ;
QCC_PR_SimpleStatement ( OP_CALL0 , func - > ofs , 0 , 0 , false ) ;
2004-08-23 01:38:21 +00:00
}
}
if ( e )
{
QCC_FreeTemp ( e ) ;
e - > references + + ;
}
if ( d )
{
d - > references + + ;
QCC_FreeTemp ( d ) ;
}
if ( old )
{
2004-11-09 06:02:02 +00:00
d = QCC_GetTemp ( type_vector ) ;
QCC_FreeTemp ( QCC_PR_Statement ( pr_opcodes + OP_STORE_V , & def_ret , d , NULL ) ) ;
2004-08-23 01:38:21 +00:00
if ( def_ret . type - > size = = 3 )
2004-11-09 06:02:02 +00:00
{
2004-08-23 01:38:21 +00:00
QCC_PR_Statement ( pr_opcodes + OP_STORE_V , old , & def_ret , NULL ) ;
2004-11-09 06:02:02 +00:00
}
2004-08-23 01:38:21 +00:00
else
2004-11-09 06:02:02 +00:00
{
2004-08-23 01:38:21 +00:00
QCC_PR_Statement ( pr_opcodes + OP_STORE_F , old , & def_ret , NULL ) ;
2004-11-09 06:02:02 +00:00
}
2004-08-23 01:38:21 +00:00
QCC_FreeTemp ( old ) ;
2009-05-24 18:56:05 +00:00
QCC_UnFreeTemp ( d ) ;
QCC_UnFreeTemp ( & def_ret ) ;
2004-08-23 01:38:21 +00:00
return d ;
}
if ( def_ret . temp - > used )
QCC_PR_ParseWarning ( 0 , " Return value conflict - output is likly to be invalid " ) ;
def_ret . temp - > used = true ;
def_ret . type = type_vector ;
return & def_ret ;
}
else if ( ! strcmp ( func - > name , " spawn " ) )
{
2013-03-12 22:47:42 +00:00
QCC_def_t * old ;
2004-08-23 01:38:21 +00:00
QCC_type_t * rettype ;
2005-03-20 02:57:11 +00:00
if ( QCC_PR_CheckToken ( " ) " ) )
2004-08-23 01:38:21 +00:00
{
rettype = type_entity ;
}
else
{
rettype = QCC_TypeForName ( QCC_PR_ParseName ( ) ) ;
if ( ! rettype | | rettype - > type ! = ev_entity )
QCC_PR_ParseError ( ERR_NOTANAME , " Spawn operator with undefined class " ) ;
QCC_PR_Expect ( " ) " ) ;
}
2011-05-15 13:23:13 +00:00
2009-05-24 18:56:05 +00:00
if ( def_ret . temp - > used )
{
old = QCC_GetTemp ( def_ret . type ) ;
if ( def_ret . type - > size = = 3 )
QCC_PR_Statement ( & pr_opcodes [ OP_STORE_V ] , & def_ret , old , NULL ) ;
else
QCC_PR_Statement ( & pr_opcodes [ OP_STORE_F ] , & def_ret , old , NULL ) ;
QCC_UnFreeTemp ( old ) ;
QCC_UnFreeTemp ( & def_ret ) ;
QCC_PR_ParseWarning ( WARN_FIXEDRETURNVALUECONFLICT , " Return value conflict - output is inefficient " ) ;
}
else
old = NULL ;
/*
2004-08-23 01:38:21 +00:00
if ( def_ret . temp - > used )
QCC_PR_ParseWarning ( 0 , " Return value conflict - output is likly to be invalid " ) ;
def_ret . temp - > used = true ;
2009-05-24 18:56:05 +00:00
*/
2004-08-23 01:38:21 +00:00
if ( rettype ! = type_entity )
{
char genfunc [ 2048 ] ;
sprintf ( genfunc , " Class*%s " , rettype - > name ) ;
2012-01-17 07:57:46 +00:00
func = QCC_PR_GetDef ( type_function , genfunc , NULL , true , 0 , false ) ;
2004-08-23 01:38:21 +00:00
func - > references + + ;
}
2006-01-28 06:41:20 +00:00
QCC_PR_SimpleStatement ( OP_CALL0 , func - > ofs , 0 , 0 , false ) ;
2009-05-24 18:56:05 +00:00
if ( old )
{
d = QCC_GetTemp ( rettype ) ;
QCC_FreeTemp ( QCC_PR_Statement ( pr_opcodes + OP_STORE_ENT , & def_ret , d , NULL ) ) ;
if ( def_ret . type - > size = = 3 )
QCC_FreeTemp ( QCC_PR_Statement ( pr_opcodes + OP_STORE_V , old , & def_ret , NULL ) ) ;
else
QCC_FreeTemp ( QCC_PR_Statement ( pr_opcodes + OP_STORE_F , old , & def_ret , NULL ) ) ;
QCC_FreeTemp ( old ) ;
QCC_UnFreeTemp ( d ) ;
QCC_UnFreeTemp ( & def_ret ) ;
return d ;
}
2011-05-15 13:23:13 +00:00
2004-08-23 01:38:21 +00:00
def_ret . type = rettype ;
return & def_ret ;
}
2005-12-16 17:15:43 +00:00
else if ( ! strcmp ( func - > name , " entnum " ) & & ! QCC_PR_CheckToken ( " ) " ) )
{
//t = (a/%1) / (nextent(world)/%1)
//a/%1 does a (int)entity to float conversion type thing
2011-10-03 02:45:44 +00:00
if ( ! func - > initialized )
func - > initialized = 3 ;
func - > references + + ;
2005-12-16 17:15:43 +00:00
2009-07-03 19:02:42 +00:00
e = QCC_PR_Expression ( TOP_PRIORITY , EXPR_DISALLOW_COMMA ) ;
2005-12-16 17:15:43 +00:00
QCC_PR_Expect ( " ) " ) ;
2011-10-03 02:45:44 +00:00
e = QCC_PR_Statement ( & pr_opcodes [ OP_DIV_F ] , e , QCC_MakeIntConst ( 1 ) , ( QCC_dstatement_t * * ) 0xffffffff ) ;
2005-12-16 17:15:43 +00:00
2008-10-05 02:55:01 +00:00
d = QCC_PR_GetDef ( NULL , " nextent " , NULL , false , 0 , false ) ;
2005-12-16 17:15:43 +00:00
if ( ! d )
QCC_PR_ParseError ( 0 , " the nextent builtin is not defined " ) ;
QCC_FreeTemp ( QCC_PR_Statement ( & pr_opcodes [ OP_STORE_F ] , e , & def_parms [ 0 ] , ( QCC_dstatement_t * * ) 0xffffffff ) ) ;
d = QCC_PR_Statement ( & pr_opcodes [ OP_CALL0 ] , d , NULL , NULL ) ;
2011-10-03 02:45:44 +00:00
d = QCC_PR_Statement ( & pr_opcodes [ OP_DIV_F ] , d , QCC_MakeIntConst ( 1 ) , ( QCC_dstatement_t * * ) 0xffffffff ) ;
2005-12-16 17:15:43 +00:00
e = QCC_PR_Statement ( & pr_opcodes [ OP_DIV_F ] , e , d , ( QCC_dstatement_t * * ) 0xffffffff ) ;
return e ;
}
2005-09-28 16:57:10 +00:00
} //so it's not an intrinsic.
2004-08-23 01:38:21 +00:00
2005-09-28 16:57:10 +00:00
if ( opt_precache_file ) //should we strip out all precache_file calls?
2004-08-23 01:38:21 +00:00
{
if ( ! strncmp ( func - > name , " precache_file " , 13 ) )
{
2011-12-23 03:12:29 +00:00
if ( pr_token_type = = tt_immediate & & pr_immediate_type - > type = = ev_string & & pr_scope & & ! strcmp ( pr_scope - > name , " main " ) )
2004-08-23 01:38:21 +00:00
{
optres_precache_file + = strlen ( pr_immediate_string ) ;
QCC_PR_Lex ( ) ;
QCC_PR_Expect ( " ) " ) ;
QCC_PrecacheFileOptimised ( pr_immediate_string , func - > name [ 13 ] ) ;
def_ret . type = type_void ;
return & def_ret ;
}
}
}
// copy the arguments to the global parameter variables
arg = 0 ;
2005-02-28 07:16:19 +00:00
if ( t - > type = = ev_variant )
{
extraparms = true ;
np = 0 ;
}
else if ( t - > num_parms < 0 )
2004-08-23 01:38:21 +00:00
{
extraparms = true ;
np = ( t - > num_parms * - 1 ) - 1 ;
}
else
np = t - > num_parms ;
2008-01-23 15:54:36 +00:00
//any temps referenced to build the parameters don't need to be locked.
2009-04-19 00:50:42 +00:00
if ( ! QCC_PR_CheckToken ( " ) " ) )
{
p = t - > param ;
do
{
if ( extraparms & & arg > = MAX_PARMS )
QCC_PR_ParseErrorPrintDef ( ERR_TOOMANYPARAMETERSVARARGS , func , " More than %i parameters on varargs function " , MAX_PARMS ) ;
else if ( arg > = MAX_PARMS + MAX_EXTRA_PARMS )
QCC_PR_ParseErrorPrintDef ( ERR_TOOMANYTOTALPARAMETERS , func , " More than %i parameters " , MAX_PARMS + MAX_EXTRA_PARMS ) ;
2011-11-08 06:00:35 +00:00
if ( ! extraparms & & arg > = t - > num_parms & & ! p )
2009-04-19 00:50:42 +00:00
{
QCC_PR_ParseWarning ( WARN_TOOMANYPARAMETERSFORFUNC , " too many parameters " ) ;
QCC_PR_ParsePrintDef ( WARN_TOOMANYPARAMETERSFORFUNC , func ) ;
}
//with vectorcalls, we store the vector into the args as individual floats
//this allows better reuse of vector constants.
//copy it into the offset now, because we can.
2013-03-12 22:32:25 +00:00
if ( opt_vectorcalls & & pr_token_type = = tt_immediate & & pr_immediate_type = = type_vector & & arg < MAX_PARMS & & ( ! def_parms [ arg ] . temp | | ! def_parms [ arg ] . temp - > used ) )
2009-04-19 00:50:42 +00:00
{
e = & def_parms [ arg ] ;
2007-04-11 22:45:34 +00:00
2009-04-19 00:50:42 +00:00
e - > ofs = OFS_PARM0 + 0 ;
2011-10-03 02:45:44 +00:00
QCC_FreeTemp ( QCC_PR_Statement ( & pr_opcodes [ OP_STORE_F ] , QCC_MakeFloatConst ( pr_immediate . vector [ 0 ] ) , e , ( QCC_dstatement_t * * ) 0xffffffff ) ) ;
2009-04-19 00:50:42 +00:00
e - > ofs = OFS_PARM0 + 1 ;
2011-10-03 02:45:44 +00:00
QCC_FreeTemp ( QCC_PR_Statement ( & pr_opcodes [ OP_STORE_F ] , QCC_MakeFloatConst ( pr_immediate . vector [ 1 ] ) , e , ( QCC_dstatement_t * * ) 0xffffffff ) ) ;
2009-04-19 00:50:42 +00:00
e - > ofs = OFS_PARM0 + 2 ;
2011-10-03 02:45:44 +00:00
QCC_FreeTemp ( QCC_PR_Statement ( & pr_opcodes [ OP_STORE_F ] , QCC_MakeFloatConst ( pr_immediate . vector [ 2 ] ) , e , ( QCC_dstatement_t * * ) 0xffffffff ) ) ;
2009-04-19 00:50:42 +00:00
e - > ofs = OFS_PARM0 ;
2012-02-13 09:24:01 +00:00
e - > type = type_vector ;
2004-08-23 01:38:21 +00:00
2005-02-28 07:16:19 +00:00
QCC_PR_Lex ( ) ;
}
else
2009-07-03 19:02:42 +00:00
e = QCC_PR_Expression ( TOP_PRIORITY , EXPR_DISALLOW_COMMA ) ;
2009-04-19 00:50:42 +00:00
if ( arg = = 0 & & func - > name )
2004-08-23 01:38:21 +00:00
{
2009-04-19 00:50:42 +00:00
// save information for model and sound caching
if ( ! strncmp ( func - > name , " precache_ " , 9 ) )
2004-08-23 01:38:21 +00:00
{
2009-04-19 00:50:42 +00:00
if ( ! strncmp ( func - > name + 9 , " sound " , 5 ) )
QCC_PrecacheSound ( e , func - > name [ 14 ] ) ;
else if ( ! strncmp ( func - > name + 9 , " model " , 5 ) )
QCC_PrecacheModel ( e , func - > name [ 14 ] ) ;
else if ( ! strncmp ( func - > name + 9 , " texture " , 7 ) )
QCC_PrecacheTexture ( e , func - > name [ 16 ] ) ;
else if ( ! strncmp ( func - > name + 9 , " file " , 4 ) )
QCC_PrecacheFile ( e , func - > name [ 13 ] ) ;
2004-08-23 01:38:21 +00:00
}
}
2009-04-19 00:50:42 +00:00
if ( arg > = MAX_PARMS )
2004-08-23 01:38:21 +00:00
{
2009-04-19 00:50:42 +00:00
if ( ! extra_parms [ arg - MAX_PARMS ] )
2004-08-23 01:38:21 +00:00
{
2009-04-19 00:50:42 +00:00
d = ( QCC_def_t * ) qccHunkAlloc ( sizeof ( QCC_def_t ) ) ;
d - > name = " extra parm " ;
2013-03-12 22:32:25 +00:00
d - > ofs = QCC_GetFreeGlobalOffsetSpace ( 3 ) ;
2009-04-19 00:50:42 +00:00
extra_parms [ arg - MAX_PARMS ] = d ;
2004-08-23 01:38:21 +00:00
}
2009-04-19 00:50:42 +00:00
d = extra_parms [ arg - MAX_PARMS ] ;
}
else
d = & def_parms [ arg ] ;
2004-08-23 01:38:21 +00:00
2009-04-19 00:50:42 +00:00
if ( pr_classtype & & e - > type - > type = = ev_field & & p - > type ! = ev_field )
{ //convert.
2012-01-17 07:57:46 +00:00
oself = QCC_PR_GetDef ( type_entity , " self " , NULL , true , 0 , false ) ;
2009-04-19 00:50:42 +00:00
switch ( e - > type - > aux_type - > type )
2004-08-23 01:38:21 +00:00
{
2009-04-19 00:50:42 +00:00
case ev_string :
e = QCC_PR_Statement ( pr_opcodes + OP_LOAD_S , oself , e , NULL ) ;
break ;
case ev_integer :
e = QCC_PR_Statement ( pr_opcodes + OP_LOAD_I , oself , e , NULL ) ;
break ;
case ev_float :
e = QCC_PR_Statement ( pr_opcodes + OP_LOAD_F , oself , e , NULL ) ;
break ;
case ev_function :
e = QCC_PR_Statement ( pr_opcodes + OP_LOAD_FNC , oself , e , NULL ) ;
break ;
case ev_vector :
e = QCC_PR_Statement ( pr_opcodes + OP_LOAD_V , oself , e , NULL ) ;
break ;
case ev_entity :
e = QCC_PR_Statement ( pr_opcodes + OP_LOAD_ENT , oself , e , NULL ) ;
break ;
default :
QCC_Error ( ERR_INTERNAL , " Bad member type. Try forced expansion " ) ;
2004-08-23 01:38:21 +00:00
}
2009-04-19 00:50:42 +00:00
}
2004-08-23 01:38:21 +00:00
2009-04-19 00:50:42 +00:00
if ( p )
{
if ( typecmp ( e - > type , p ) )
/*if (e->type->type != ev_integer && p->type != ev_function)
if ( e - > type - > type ! = ev_function & & p - > type ! = ev_integer )
if ( e - > type - > type ! = p - > type ) */
2005-02-28 07:16:19 +00:00
{
2009-04-19 00:50:42 +00:00
if ( p - > type = = ev_integer & & e - > type - > type = = ev_float ) //convert float -> int... is this a constant?
e = QCC_PR_Statement ( pr_opcodes + OP_CONV_FTOI , e , NULL , NULL ) ;
else if ( p - > type = = ev_float & & e - > type - > type = = ev_integer ) //convert float -> int... is this a constant?
e = QCC_PR_Statement ( pr_opcodes + OP_CONV_ITOF , e , NULL , NULL ) ;
2013-03-12 22:40:43 +00:00
else if ( ( p - > type = = ev_function | | p - > type = = ev_field | | p - > type = = ev_string | | p - > type = = ev_pointer | | p - > type = = ev_entity ) & & e - > type - > type = = ev_integer & & e - > constant & & ! ( ( int * ) qcc_pr_globals ) [ e - > ofs ] )
{ //you're allowed to use int 0 to pass a null function/field/string/pointer/entity
2012-11-27 03:23:19 +00:00
//this is basically because __NULL__ is defined as 0i (int 0)
------------------------------------------------------------------------
r4169 | acceptthis | 2013-01-17 08:55:12 +0000 (Thu, 17 Jan 2013) | 31 lines
removed MAX_VISEDICTS limit.
PEXT2_REPLACEMENTDELTAS tweaked, now has 4 million entity limit. still not enabled by default.
TE_BEAM now maps to a separate TEQW_BEAM to avoid conflicts with QW.
added android multitouch emulation for windows/rawinput (in_simulatemultitouch).
split topcolor/bottomcolor from scoreboard, for dp's colormap|1024 feature.
now using utf-8 for windows consoles.
qcc warnings/errors now give clickable console links for quick+easy editing.
disabled menutint when the currently active item changes contrast or gamma (for OneManClan).
Added support for drawfont/drawfontscale.
tweaked the qcvm a little to reduce the number of pointers.
.doll file loading. still experimental and will likely crash. requires csqc active, even if its a dummy progs. this will be fixed in time. Still other things that need cleaning up.
windows: gl_font "?" shows the standard windows font-selection dialog, and can be used to select windows fonts. not all work. and you probably don't want to use windings.
fixed splitscreen support when playing mvds. added mini-scoreboards to splitscreen.
editor/debugger now shows asm if there's no linenumber info. also, pressing f1 for help shows the shortcuts.
Added support for .framegroups files for psk(psa) and iqm formats.
True support for ezquake's colour codes. Mutually exclusive with background colours.
path command output slightly more readable.
added support for digest_hex (MD4, SHA1, CRC16).
skingroups now colourmap correctly.
Fix terrain colour hints, and litdata from the wrong bsp.
fix ftp dual-homed issue. support epsv command, and enable ipv6 (eprt still not supported).
remove d3d11 compilation from the makefile. the required headers are not provided by mingw, and are not available to the build bot, so don't bother.
fix v *= v.x and similar opcodes.
fteqcc: fixed support for áéÃóú type chars in names. utf-8 files now properly supported (even with the utf-8 bom/identifier). utf-16 also supported.
fteqcc: fixed '#if 1 == 3 && 4' parsing.
fteqcc: -Werror acts on the warning, rather than as a separate error. Line numbers are thus more readable.
fteqcc: copyright message now includes compile date instead.
fteqccgui: the treeview control is now coloured depending on whether there were warnings/errors in the last compile.
fteqccgui: the output window is now focused and scrolls down as compilation progresses.
pr_dumpplatform command dumps out some pragmas to convert more serious warnings to errors. This is to avoid the infamous 'fteqcc sucks cos my code sucks' issue.
rewrote prespawn/modelist/soundlist code. server tracks progress now.
------------------------------------------------------------------------
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4167 fc73d0e0-1445-4013-8a0c-d673dee63da5
2013-03-12 22:29:40 +00:00
//note that we don't allow passing 0.0f for null.
2013-03-12 22:32:25 +00:00
//WARNING: field 0 is actually a valid field, and is commonly modelindex.
}
else if ( ( p - > type = = ev_vector ) & & e - > type - > type = = ev_integer & & e - > constant & & ! ( ( int * ) qcc_pr_globals ) [ e - > ofs ] )
{
//also allow it for vector types too, but make sure the entire vector is valid.
e = QCC_MakeVectorConst ( 0 , 0 , 0 ) ;
2005-02-28 07:16:19 +00:00
}
2011-12-05 15:23:40 +00:00
else if ( p - > type ! = ev_variant & & e - > type - > type ! = ev_variant ) //can cast to variant whatever happens
2005-02-09 19:32:30 +00:00
{
2013-03-12 22:32:25 +00:00
QCC_type_t * inh ;
for ( inh = e - > type - > parentclass ; inh ; inh = inh - > parentclass )
2005-02-09 19:32:30 +00:00
{
2013-03-12 22:32:25 +00:00
if ( typecmp ( inh , p ) )
break ;
}
if ( ! inh )
{
if ( flag_laxcasts | | ( p - > type = = ev_function & & e - > type - > type = = ev_function ) )
{
QCC_PR_ParseWarning ( WARN_LAXCAST , " type mismatch on parm %i - (%s should be %s) " , arg + 1 , TypeName ( e - > type ) , TypeName ( p ) ) ;
QCC_PR_ParsePrintDef ( WARN_LAXCAST , func ) ;
}
else
QCC_PR_ParseErrorPrintDef ( ERR_TYPEMISMATCHPARM , func , " type mismatch on parm %i - (%s should be %s) " , arg + 1 , TypeName ( e - > type ) , TypeName ( p ) ) ;
2005-02-09 19:32:30 +00:00
}
}
2004-08-23 01:38:21 +00:00
}
2009-04-19 00:50:42 +00:00
d - > type = p ;
2004-08-23 01:38:21 +00:00
2009-04-19 00:50:42 +00:00
p = p - > next ;
2004-08-23 01:38:21 +00:00
}
2009-04-19 00:50:42 +00:00
// a vector copy will copy everything
else
d - > type = type_void ;
2004-08-23 01:38:21 +00:00
2009-04-19 00:50:42 +00:00
if ( arg = = 1 & & ! STRCMP ( func - > name , " setmodel " ) )
2004-08-23 01:38:21 +00:00
{
2009-04-19 00:50:42 +00:00
QCC_SetModel ( e ) ;
2004-08-23 01:38:21 +00:00
}
2009-04-19 00:50:42 +00:00
param [ arg ] = e ;
/* if (e->type->size>1)
QCC_PR_Statement ( & pr_opcodes [ OP_STORE_V ] , e , d , ( QCC_dstatement_t * * ) 0xffffffff ) ;
else
QCC_PR_Statement ( & pr_opcodes [ OP_STORE_F ] , e , d , ( QCC_dstatement_t * * ) 0xffffffff ) ;
*/
arg + + ;
} while ( QCC_PR_CheckToken ( " , " ) ) ;
2004-08-23 01:38:21 +00:00
2009-04-19 00:50:42 +00:00
if ( t - > num_parms ! = - 1 & & arg < np )
QCC_PR_ParseWarning ( WARN_TOOFEWPARAMS , " too few parameters on call to %s " , func - > name ) ;
QCC_PR_Expect ( " ) " ) ;
2004-08-23 01:38:21 +00:00
}
2009-04-19 00:50:42 +00:00
else if ( np )
2004-08-23 01:38:21 +00:00
{
2009-04-19 00:50:42 +00:00
QCC_PR_ParseWarning ( WARN_TOOFEWPARAMS , " %s: Too few parameters " , func - > name ) ;
QCC_PR_ParsePrintDef ( WARN_TOOFEWPARAMS , func ) ;
2004-08-23 01:38:21 +00:00
}
2009-04-19 00:50:42 +00:00
return QCC_PR_GenerateFunctionCall ( func , param , arg ) ;
2004-08-23 01:38:21 +00:00
}
int constchecks ;
int varchecks ;
int typechecks ;
2011-10-03 02:45:44 +00:00
QCC_def_t * QCC_MakeIntConst ( int value )
2004-08-23 01:38:21 +00:00
{
QCC_def_t * cn ;
2011-05-15 13:23:13 +00:00
2004-08-23 01:38:21 +00:00
// check for a constant with the same value
for ( cn = pr . def_head . next ; cn ; cn = cn - > next )
{
varchecks + + ;
if ( ! cn - > initialized )
continue ;
if ( ! cn - > constant )
continue ;
constchecks + + ;
if ( cn - > type ! = type_integer )
continue ;
typechecks + + ;
if ( G_INT ( cn - > ofs ) = = value )
2011-05-15 13:23:13 +00:00
{
2004-08-23 01:38:21 +00:00
return cn ;
2011-05-15 13:23:13 +00:00
}
2004-08-23 01:38:21 +00:00
}
// allocate a new one
cn = ( void * ) qccHunkAlloc ( sizeof ( QCC_def_t ) ) ;
cn - > next = NULL ;
pr . def_tail - > next = cn ;
pr . def_tail = cn ;
cn - > type = type_integer ;
cn - > name = " IMMEDIATE " ;
cn - > constant = true ;
cn - > initialized = 1 ;
cn - > scope = NULL ; // always share immediates
2012-01-17 07:57:46 +00:00
cn - > arraysize = 0 ;
2004-08-23 01:38:21 +00:00
2011-08-16 04:12:15 +00:00
if ( ! value )
G_INT ( cn - > ofs ) = 0 ;
else
{
// copy the immediate to the global area
2013-03-12 22:32:25 +00:00
cn - > ofs = QCC_GetFreeGlobalOffsetSpace ( type_size [ type_integer - > type ] ) ;
2011-05-15 13:23:13 +00:00
2011-08-16 04:12:15 +00:00
G_INT ( cn - > ofs ) = value ;
}
2011-05-15 13:23:13 +00:00
2004-08-23 01:38:21 +00:00
return cn ;
}
2011-10-03 02:45:44 +00:00
QCC_def_t * QCC_MakeVectorConst ( float a , float b , float c )
2007-06-10 21:33:24 +00:00
{
QCC_def_t * cn ;
2011-05-15 13:23:13 +00:00
2007-06-10 21:33:24 +00:00
// check for a constant with the same value
for ( cn = pr . def_head . next ; cn ; cn = cn - > next )
{
varchecks + + ;
if ( ! cn - > initialized )
continue ;
if ( ! cn - > constant )
continue ;
constchecks + + ;
if ( cn - > type ! = type_vector )
continue ;
typechecks + + ;
if ( G_FLOAT ( cn - > ofs + 0 ) = = a & &
G_FLOAT ( cn - > ofs + 1 ) = = b & &
G_FLOAT ( cn - > ofs + 2 ) = = c )
2011-05-15 13:23:13 +00:00
{
2007-06-10 21:33:24 +00:00
return cn ;
2011-05-15 13:23:13 +00:00
}
2007-06-10 21:33:24 +00:00
}
// allocate a new one
cn = ( void * ) qccHunkAlloc ( sizeof ( QCC_def_t ) ) ;
cn - > next = NULL ;
pr . def_tail - > next = cn ;
pr . def_tail = cn ;
cn - > type = type_vector ;
cn - > name = " IMMEDIATE " ;
cn - > constant = true ;
cn - > initialized = 1 ;
cn - > scope = NULL ; // always share immediates
2012-01-17 07:57:46 +00:00
cn - > arraysize = 0 ;
2007-06-10 21:33:24 +00:00
// copy the immediate to the global area
2013-03-12 22:32:25 +00:00
cn - > ofs = QCC_GetFreeGlobalOffsetSpace ( type_size [ type_vector - > type ] ) ;
2011-05-15 13:23:13 +00:00
2007-06-10 21:33:24 +00:00
G_FLOAT ( cn - > ofs + 0 ) = a ;
G_FLOAT ( cn - > ofs + 1 ) = b ;
G_FLOAT ( cn - > ofs + 2 ) = c ;
return cn ;
}
2011-10-03 02:45:44 +00:00
extern hashtable_t floatconstdefstable ;
QCC_def_t * QCC_MakeFloatConst ( float value )
2004-08-23 01:38:21 +00:00
{
QCC_def_t * cn ;
2004-10-13 07:24:59 +00:00
union {
float f ;
int i ;
} fi ;
fi . f = value ;
cn = Hash_GetKey ( & floatconstdefstable , fi . i ) ;
2004-08-23 01:38:21 +00:00
if ( cn )
return cn ;
// allocate a new one
cn = ( void * ) qccHunkAlloc ( sizeof ( QCC_def_t ) ) ;
cn - > next = NULL ;
pr . def_tail - > next = cn ;
pr . def_tail = cn ;
2008-11-09 22:29:28 +00:00
cn - > s_file = s_file ;
cn - > s_line = pr_source_line ;
2004-08-23 01:38:21 +00:00
cn - > type = type_float ;
cn - > name = " IMMEDIATE " ;
cn - > constant = true ;
cn - > initialized = 1 ;
cn - > scope = NULL ; // always share immediates
2012-01-17 07:57:46 +00:00
cn - > arraysize = 0 ;
2004-08-23 01:38:21 +00:00
// copy the immediate to the global area
2013-03-12 22:32:25 +00:00
cn - > ofs = QCC_GetFreeGlobalOffsetSpace ( type_size [ type_integer - > type ] ) ;
2011-05-15 13:23:13 +00:00
2005-03-01 15:36:23 +00:00
Hash_AddKey ( & floatconstdefstable , fi . i , cn , qccHunkAlloc ( sizeof ( bucket_t ) ) ) ;
2011-05-15 13:23:13 +00:00
G_FLOAT ( cn - > ofs ) = value ;
2004-08-23 01:38:21 +00:00
return cn ;
}
2011-10-03 02:45:44 +00:00
extern hashtable_t stringconstdefstable , stringconstdefstable_trans ;
int dotranslate_count ;
static QCC_def_t * QCC_MakeStringConstInternal ( char * value , pbool translate )
2004-08-23 01:38:21 +00:00
{
QCC_def_t * cn ;
int string ;
2011-10-03 02:45:44 +00:00
cn = pHash_Get ( translate ? & stringconstdefstable_trans : & stringconstdefstable , value ) ;
2004-08-23 01:38:21 +00:00
if ( cn )
return cn ;
// allocate a new one
2011-10-03 02:45:44 +00:00
if ( translate )
{
char buf [ 64 ] ;
sprintf ( buf , " dotranslate_%i " , + + dotranslate_count ) ;
cn = ( void * ) qccHunkAlloc ( sizeof ( QCC_def_t ) + strlen ( buf ) + 1 ) ;
cn - > name = ( char * ) ( cn + 1 ) ;
strcpy ( cn - > name , buf ) ;
}
else
{
cn = ( void * ) qccHunkAlloc ( sizeof ( QCC_def_t ) ) ;
cn - > name = " IMMEDIATE " ;
}
2004-08-23 01:38:21 +00:00
cn - > next = NULL ;
pr . def_tail - > next = cn ;
pr . def_tail = cn ;
cn - > type = type_string ;
cn - > constant = true ;
cn - > initialized = 1 ;
cn - > scope = NULL ; // always share immediates
2012-01-17 07:57:46 +00:00
cn - > arraysize = 0 ;
2004-08-23 01:38:21 +00:00
// copy the immediate to the global area
2013-03-12 22:32:25 +00:00
cn - > ofs = QCC_GetFreeGlobalOffsetSpace ( type_size [ type_integer - > type ] ) ;
2011-05-15 13:23:13 +00:00
2004-08-23 01:38:21 +00:00
string = QCC_CopyString ( value ) ;
2011-10-06 19:59:53 +00:00
pHash_Add ( translate ? & stringconstdefstable_trans : & stringconstdefstable , strings + string , cn , qccHunkAlloc ( sizeof ( bucket_t ) ) ) ;
2011-05-15 13:23:13 +00:00
G_INT ( cn - > ofs ) = string ;
2004-08-23 01:38:21 +00:00
return cn ;
}
2011-10-03 02:45:44 +00:00
QCC_def_t * QCC_MakeStringConst ( char * value )
{
return QCC_MakeStringConstInternal ( value , false ) ;
}
QCC_def_t * QCC_MakeTranslateStringConst ( char * value )
{
return QCC_MakeStringConstInternal ( value , true ) ;
}
2004-08-23 01:38:21 +00:00
QCC_type_t * QCC_PointerTypeTo ( QCC_type_t * type )
{
QCC_type_t * newtype ;
2012-02-05 01:38:51 +00:00
newtype = QCC_PR_NewType ( " ptr " , ev_pointer , false ) ;
2004-08-23 01:38:21 +00:00
newtype - > aux_type = type ;
return newtype ;
}
int basictypefield [ ev_union + 1 ] ;
char * basictypenames [ ] = {
" void " ,
" string " ,
" float " ,
" vector " ,
" entity " ,
" field " ,
" function " ,
" pointer " ,
" integer " ,
" struct " ,
" union "
} ;
QCC_def_t * QCC_MemberInParentClass ( char * name , QCC_type_t * clas )
{ //if a member exists, return the member field (rather than mapped-to field)
QCC_type_t * mt ;
QCC_def_t * def ;
int p , np ;
char membername [ 2048 ] ;
if ( ! clas )
{
2008-10-05 02:55:01 +00:00
def = QCC_PR_GetDef ( NULL , name , NULL , 0 , 0 , false ) ;
2004-08-23 01:38:21 +00:00
if ( def & & def - > type - > type = = ev_field ) //the member existed as a normal entity field.
return def ;
return NULL ;
}
np = clas - > num_parms ;
for ( p = 0 , mt = clas - > param ; p < np ; p + + , mt = mt - > next )
{
if ( strcmp ( mt - > name , name ) )
continue ;
//the parent has it.
sprintf ( membername , " %s:: " MEMBERFIELDNAME , clas - > name , mt - > name ) ;
2008-10-05 02:55:01 +00:00
def = QCC_PR_GetDef ( NULL , membername , NULL , false , 0 , false ) ;
2004-08-23 01:38:21 +00:00
return def ;
}
return QCC_MemberInParentClass ( name , clas - > parentclass ) ;
}
//create fields for the types, instanciate the members to the fields.
//we retouch the parents each time to guarentee polymorphism works.
//FIXME: virtual methods will not work properly. Need to trace down to see if a parent already defined it
void QCC_PR_EmitFieldsForMembers ( QCC_type_t * clas )
{
2005-09-08 22:52:46 +00:00
//we created fields for each class when we defined the actual classes.
//we need to go through each member and match it to the offset of it's parent class, if overloaded, or create a new field if not..
//basictypefield is cleared before we do this
//we emit the parent's fields first (every time), thus ensuring that we don't reuse parent fields on a child class.
2004-08-23 01:38:21 +00:00
char membername [ 2048 ] ;
int p , np , a ;
unsigned int o ;
QCC_type_t * mt , * ft ;
QCC_def_t * f , * m ;
2007-10-05 17:43:26 +00:00
if ( clas - > parentclass ! = type_entity ) //parents MUST have all their fields set or inheritance would go crazy.
2004-08-23 01:38:21 +00:00
QCC_PR_EmitFieldsForMembers ( clas - > parentclass ) ;
np = clas - > num_parms ;
mt = clas - > param ;
for ( p = 0 ; p < np ; p + + , mt = mt - > next )
{
sprintf ( membername , " %s:: " MEMBERFIELDNAME , clas - > name , mt - > name ) ;
2008-10-05 02:55:01 +00:00
m = QCC_PR_GetDef ( NULL , membername , NULL , false , 0 , false ) ;
2004-08-23 01:38:21 +00:00
f = QCC_MemberInParentClass ( mt - > name , clas - > parentclass ) ;
if ( f )
{
2012-01-17 07:57:46 +00:00
if ( m - > arraysize )
2004-08-23 01:38:21 +00:00
QCC_Error ( ERR_INTERNAL , " FTEQCC does not support overloaded arrays of members " ) ;
a = 0 ;
for ( o = 0 ; o < m - > type - > size ; o + + )
( ( int * ) qcc_pr_globals ) [ o + a * mt - > size + m - > ofs ] = ( ( int * ) qcc_pr_globals ) [ o + f - > ofs ] ;
continue ;
}
2012-01-17 07:57:46 +00:00
for ( a = 0 ; a < ( m - > arraysize ? m - > arraysize : 1 ) ; a + + )
2004-08-23 01:38:21 +00:00
{
2013-03-12 22:32:25 +00:00
/*if it was already set, don't go recursive and generate 500 fields for a one-member class that was inheritted from 500 times*/
if ( ( ( int * ) qcc_pr_globals ) [ 0 + a * mt - > size + m - > ofs ] )
2011-10-03 02:45:44 +00:00
continue ;
2004-08-23 01:38:21 +00:00
//we need the type in here so saved games can still work without saving ints as floats. (would be evil)
2012-02-05 01:38:51 +00:00
ft = QCC_PR_NewType ( basictypenames [ mt - > type ] , ev_field , false ) ;
ft - > aux_type = QCC_PR_NewType ( basictypenames [ mt - > type ] , mt - > type , false ) ;
2004-08-23 01:38:21 +00:00
ft - > aux_type - > aux_type = type_void ;
2005-09-08 22:52:46 +00:00
ft - > size = ft - > aux_type - > size ;
2004-08-23 01:38:21 +00:00
ft = QCC_PR_FindType ( ft ) ;
sprintf ( membername , " __f_%s_%i " , ft - > name , + + basictypefield [ mt - > type ] ) ;
2012-01-17 07:57:46 +00:00
f = QCC_PR_GetDef ( ft , membername , NULL , true , 0 , true ) ;
2011-05-15 13:23:13 +00:00
2004-08-23 01:38:21 +00:00
for ( o = 0 ; o < m - > type - > size ; o + + )
( ( int * ) qcc_pr_globals ) [ o + a * mt - > size + m - > ofs ] = ( ( int * ) qcc_pr_globals ) [ o + f - > ofs ] ;
f - > references + + ;
}
}
}
2004-10-14 11:25:12 +00:00
void QCC_PR_EmitClassFunctionTable ( QCC_type_t * clas , QCC_type_t * childclas , QCC_def_t * ed , QCC_def_t * * constructor )
2004-08-23 01:38:21 +00:00
{ //go through clas, do the virtual thing only if the child class does not override.
char membername [ 2048 ] ;
QCC_type_t * type ;
QCC_type_t * oc ;
int p ;
QCC_def_t * point , * member ;
QCC_def_t * virt ;
if ( clas - > parentclass )
2004-10-14 11:25:12 +00:00
QCC_PR_EmitClassFunctionTable ( clas - > parentclass , childclas , ed , constructor ) ;
2004-08-23 01:38:21 +00:00
type = clas - > param ;
for ( p = 0 ; p < clas - > num_parms ; p + + , type = type - > next )
{
for ( oc = childclas ; oc ! = clas ; oc = oc - > parentclass )
{
sprintf ( membername , " %s:: " MEMBERFIELDNAME , oc - > name , type - > name ) ;
2008-10-05 02:55:01 +00:00
if ( QCC_PR_GetDef ( NULL , membername , NULL , false , 0 , false ) )
2004-08-23 01:38:21 +00:00
break ; //a child class overrides.
}
if ( oc ! = clas )
continue ;
if ( type - > type = = ev_function ) //FIXME: inheritance will not install all the member functions.
{
sprintf ( membername , " %s:: " MEMBERFIELDNAME , clas - > name , type - > name ) ;
2012-01-17 07:57:46 +00:00
member = QCC_PR_GetDef ( NULL , membername , NULL , false , 0 , false ) ;
2004-08-23 01:38:21 +00:00
if ( ! member )
{
QCC_PR_Warning ( 0 , NULL , 0 , " Member function %s was not defined " , membername ) ;
continue ;
}
2004-10-14 11:25:12 +00:00
if ( ! strcmp ( type - > name , clas - > name ) )
2004-08-23 01:38:21 +00:00
{
2004-10-14 11:25:12 +00:00
* constructor = member ;
}
2004-08-23 01:38:21 +00:00
point = QCC_PR_Statement ( & pr_opcodes [ OP_ADDRESS ] , ed , member , NULL ) ;
sprintf ( membername , " %s::%s " , clas - > name , type - > name ) ;
2012-01-17 07:57:46 +00:00
virt = QCC_PR_GetDef ( type , membername , NULL , false , 0 , false ) ;
2004-08-23 01:38:21 +00:00
QCC_PR_Statement ( & pr_opcodes [ OP_STOREP_FNC ] , virt , point , NULL ) ;
}
}
}
//take all functions in the type, and parent types, and make sure the links all work properly.
2004-11-04 04:19:10 +00:00
void QCC_PR_EmitClassFromFunction ( QCC_def_t * scope , char * tname )
2004-08-23 01:38:21 +00:00
{
QCC_type_t * basetype ;
QCC_dfunction_t * df ;
QCC_def_t * virt ;
2004-10-14 11:25:12 +00:00
QCC_def_t * ed , * oself , * self ;
2004-08-23 01:38:21 +00:00
QCC_def_t * constructor = NULL ;
// int func;
basetype = QCC_TypeForName ( tname ) ;
if ( ! basetype )
QCC_PR_ParseError ( ERR_INTERNAL , " Type %s was not defined... " , tname ) ;
2011-08-16 04:12:15 +00:00
if ( numfunctions > = MAX_FUNCTIONS )
QCC_Error ( ERR_INTERNAL , " Too many function defs " ) ;
2005-09-14 04:36:07 +00:00
pr_scope = NULL ;
memset ( basictypefield , 0 , sizeof ( basictypefield ) ) ;
QCC_PR_EmitFieldsForMembers ( basetype ) ;
2004-08-23 01:38:21 +00:00
pr_scope = scope ;
df = & functions [ numfunctions ] ;
numfunctions + + ;
df - > s_file = 0 ;
df - > s_name = 0 ;
df - > first_statement = numstatements ;
df - > parm_size [ 0 ] = 1 ;
2005-09-08 22:52:46 +00:00
df - > numparms = 0 ;
2013-03-12 22:32:25 +00:00
locals_start = locals_end = FIRST_LOCAL ;
2004-08-23 01:38:21 +00:00
2004-11-04 04:19:10 +00:00
G_FUNCTION ( scope - > ofs ) = df - functions ;
2004-08-23 01:38:21 +00:00
//locals here...
2012-01-17 07:57:46 +00:00
ed = QCC_PR_GetDef ( type_entity , " ent " , pr_scope , true , 0 , false ) ;
2004-08-23 01:38:21 +00:00
2008-10-05 02:55:01 +00:00
virt = QCC_PR_GetDef ( type_function , " spawn " , NULL , false , 0 , false ) ;
2004-08-23 01:38:21 +00:00
if ( ! virt )
QCC_Error ( ERR_INTERNAL , " spawn function was not defined \n " ) ;
2006-01-28 06:41:20 +00:00
QCC_PR_SimpleStatement ( OP_CALL0 , virt - > ofs , 0 , 0 , false ) ; //calling convention doesn't come into it.
2011-05-15 13:23:13 +00:00
2004-08-23 01:38:21 +00:00
QCC_FreeTemp ( QCC_PR_Statement ( & pr_opcodes [ OP_STORE_ENT ] , & def_ret , ed , NULL ) ) ;
ed - > references = 1 ; //there may be no functions.
2004-10-14 11:25:12 +00:00
QCC_PR_EmitClassFunctionTable ( basetype , basetype , ed , & constructor ) ;
2004-08-23 01:38:21 +00:00
if ( constructor )
2004-10-14 11:25:12 +00:00
{ //self = ent;
2008-10-05 02:55:01 +00:00
self = QCC_PR_GetDef ( type_entity , " self " , NULL , false , 0 , false ) ;
2012-01-17 07:57:46 +00:00
oself = QCC_PR_GetDef ( type_entity , " oself " , scope , true , 0 , false ) ;
2004-10-14 11:25:12 +00:00
QCC_FreeTemp ( QCC_PR_Statement ( & pr_opcodes [ OP_STORE_ENT ] , self , oself , NULL ) ) ;
QCC_FreeTemp ( QCC_PR_Statement ( & pr_opcodes [ OP_STORE_ENT ] , ed , self , NULL ) ) ; //return to our old self. boom boom.
2006-01-28 06:41:20 +00:00
QCC_PR_SimpleStatement ( OP_CALL0 , constructor - > ofs , 0 , 0 , false ) ;
2004-10-14 11:25:12 +00:00
QCC_FreeTemp ( QCC_PR_Statement ( & pr_opcodes [ OP_STORE_ENT ] , oself , self , NULL ) ) ;
}
2004-08-23 01:38:21 +00:00
2005-09-08 22:52:46 +00:00
QCC_FreeTemp ( QCC_PR_Statement ( & pr_opcodes [ OP_RETURN ] , ed , NULL , NULL ) ) ; //apparently we do actually have to return something. *sigh*...
QCC_FreeTemp ( QCC_PR_Statement ( & pr_opcodes [ OP_DONE ] , NULL , NULL , NULL ) ) ;
2004-08-23 01:38:21 +00:00
2005-09-14 04:36:07 +00:00
2004-08-23 01:38:21 +00:00
QCC_WriteAsmFunction ( scope , df - > first_statement , df - > parm_start ) ;
2013-03-12 22:32:25 +00:00
QCC_Marshal_Locals ( df - > first_statement , numstatements ) ;
df - > parm_start = locals_start ;
df - > numparms = locals_end - locals_start ;
2004-08-23 01:38:21 +00:00
}
2012-02-13 09:24:01 +00:00
QCC_def_t * QCC_PR_ParseArrayPointer ( QCC_def_t * d , pbool allowarrayassign )
2004-08-23 01:38:21 +00:00
{
2012-02-13 09:24:01 +00:00
QCC_type_t * t ;
QCC_def_t * idx ;
QCC_def_t * tmp ;
2004-08-23 01:38:21 +00:00
QCC_dstatement_t * st ;
2012-02-13 09:24:01 +00:00
pbool allowarray ;
2004-08-23 01:38:21 +00:00
2011-09-03 03:49:43 +00:00
t = d - > type ;
idx = NULL ;
while ( 1 )
{
2012-02-13 09:24:01 +00:00
allowarray = false ;
if ( idx )
2012-07-05 19:42:36 +00:00
allowarray = t - > arraysize > 0 | |
( t - > type = = ev_vector ) ;
2012-02-13 09:24:01 +00:00
else if ( ! idx )
{
allowarray = d - > arraysize | |
( d - > type - > type = = ev_pointer ) | |
( d - > type - > type = = ev_string ) | |
( d - > type - > type = = ev_vector ) ;
}
if ( allowarray & & QCC_PR_CheckToken ( " [ " ) )
2011-09-03 03:49:43 +00:00
{
tmp = QCC_PR_Expression ( TOP_PRIORITY , 0 ) ;
QCC_PR_Expect ( " ] " ) ;
2011-10-03 02:45:44 +00:00
2012-01-24 04:24:14 +00:00
/*if its a pointer that got dereferenced, follow the type*/
2012-01-17 07:57:46 +00:00
if ( ! idx & & t - > type = = ev_pointer & & ! d - > arraysize )
2011-10-03 02:45:44 +00:00
t = t - > aux_type ;
if ( ! idx & & d - > type - > type = = ev_pointer )
{
2012-01-24 04:24:14 +00:00
/*no bounds checks on pointer dereferences*/
}
2012-02-13 09:24:01 +00:00
else if ( ! idx & & d - > type - > type = = ev_string & & ! d - > arraysize )
2012-01-24 04:24:14 +00:00
{
/*automatic runtime bounds checks on strings, I'm not going to check this too much...*/
}
2012-07-05 19:42:36 +00:00
else if ( ( ! idx & & d - > type - > type = = ev_vector & & ! d - > arraysize ) | | ( idx & & t - > type = = ev_vector & & ! t - > arraysize ) )
2012-02-13 09:24:01 +00:00
{
if ( tmp - > constant )
{
unsigned int i ;
if ( tmp - > type - > type = = ev_integer )
i = G_INT ( tmp - > ofs ) ;
else if ( tmp - > type - > type = = ev_float )
i = G_FLOAT ( tmp - > ofs ) ;
2013-03-12 22:47:42 +00:00
else
i = - 1 ;
2012-02-13 09:24:01 +00:00
if ( i < 0 | | i > = 3 )
QCC_PR_ParseErrorPrintDef ( 0 , d , " (vector) array index out of bounds " ) ;
}
2012-07-05 19:42:36 +00:00
else if ( QCC_OPCodeValid ( & pr_opcodes [ OP_BOUNDCHECK ] ) )
2012-02-13 09:24:01 +00:00
{
tmp = QCC_SupplyConversion ( tmp , ev_integer , true ) ;
QCC_PR_SimpleStatement ( OP_BOUNDCHECK , tmp - > ofs , 3 , 0 , false ) ;
}
t = type_float ;
}
2012-01-24 04:24:14 +00:00
else if ( ! ( ( ! idx ) ? d - > arraysize : t - > arraysize ) )
{
QCC_PR_ParseErrorPrintDef ( 0 , d , " array index on non-array " ) ;
2011-10-03 02:45:44 +00:00
}
else if ( tmp - > constant )
2011-09-03 03:49:43 +00:00
{
2012-01-17 07:57:46 +00:00
unsigned int i ;
2011-09-03 03:49:43 +00:00
if ( tmp - > type - > type = = ev_integer )
i = G_INT ( tmp - > ofs ) ;
else if ( tmp - > type - > type = = ev_float )
i = G_FLOAT ( tmp - > ofs ) ;
2013-03-12 22:47:42 +00:00
else
i = - 1 ;
2011-10-03 02:45:44 +00:00
if ( i < 0 | | i > = ( ( ! idx ) ? d - > arraysize : t - > arraysize ) )
QCC_PR_ParseErrorPrintDef ( 0 , d , " (constant) array index out of bounds " ) ;
2011-09-03 03:49:43 +00:00
}
else
{
2012-07-05 19:42:36 +00:00
if ( QCC_OPCodeValid ( & pr_opcodes [ OP_BOUNDCHECK ] ) )
2011-10-03 02:45:44 +00:00
{
tmp = QCC_SupplyConversion ( tmp , ev_integer , true ) ;
QCC_PR_SimpleStatement ( OP_BOUNDCHECK , tmp - > ofs , ( ( ! idx ) ? d - > arraysize : t - > arraysize ) , 0 , false ) ;
}
}
2012-07-05 19:42:36 +00:00
if ( t - > size ! = 1 ) /*don't multiply by type size if the instruction/emulation will do that instead*/
2011-10-03 02:45:44 +00:00
{
if ( tmp - > type - > type = = ev_float )
tmp = QCC_PR_Statement ( & pr_opcodes [ OP_MUL_F ] , tmp , QCC_MakeFloatConst ( t - > size ) , NULL ) ;
else
tmp = QCC_PR_Statement ( & pr_opcodes [ OP_MUL_I ] , tmp , QCC_MakeIntConst ( t - > size ) , NULL ) ;
2011-09-03 03:49:43 +00:00
}
2012-01-24 04:24:14 +00:00
/*calc the new index*/
2012-07-05 19:42:36 +00:00
if ( idx & & idx - > type - > type = = ev_float & & tmp - > type - > type = = ev_float )
idx = QCC_PR_Statement ( & pr_opcodes [ OP_ADD_F ] , idx , QCC_SupplyConversion ( tmp , ev_float , true ) , NULL ) ;
else if ( idx )
2011-10-03 02:45:44 +00:00
idx = QCC_PR_Statement ( & pr_opcodes [ OP_ADD_I ] , idx , QCC_SupplyConversion ( tmp , ev_integer , true ) , NULL ) ;
2011-09-03 03:49:43 +00:00
else
idx = tmp ;
}
else if ( ( t - > type = = ev_pointer | | t - > type = = ev_struct | | t - > type = = ev_union ) & & ( QCC_PR_CheckToken ( " . " ) | | QCC_PR_CheckToken ( " -> " ) ) )
{
2012-01-17 07:57:46 +00:00
if ( ! idx & & t - > type = = ev_pointer & & ! d - > arraysize )
2011-09-03 03:49:43 +00:00
t = t - > aux_type ;
2011-10-03 02:45:44 +00:00
2011-09-03 03:49:43 +00:00
for ( t = t - > param ; t ; t = t - > next )
{
if ( QCC_PR_CheckName ( t - > name ) )
{
break ;
}
}
if ( ! t )
QCC_PR_ParseError ( 0 , " %s is not a member " , pr_token ) ;
2012-07-05 19:42:36 +00:00
if ( QCC_OPCodeValid ( & pr_opcodes [ OP_ADD_I ] ) )
{
tmp = QCC_MakeIntConst ( t - > ofs ) ;
if ( idx )
idx = QCC_PR_Statement ( & pr_opcodes [ OP_ADD_I ] , idx , tmp , NULL ) ;
else
idx = tmp ;
}
2011-09-03 03:49:43 +00:00
else
2012-07-05 19:42:36 +00:00
{
tmp = QCC_MakeFloatConst ( t - > ofs ) ;
if ( idx )
idx = QCC_PR_Statement ( & pr_opcodes [ OP_ADD_F ] , idx , tmp , NULL ) ;
else
idx = tmp ;
}
2011-09-03 03:49:43 +00:00
}
else
break ;
}
if ( idx )
{
if ( d - > type - > type = = ev_pointer )
{
switch ( t - > type )
{
case ev_pointer :
d = QCC_PR_Statement ( & pr_opcodes [ OP_LOADP_I ] , d , QCC_SupplyConversion ( idx , ev_integer , true ) , NULL ) ;
break ;
case ev_float :
d = QCC_PR_Statement ( & pr_opcodes [ OP_LOADP_F ] , d , QCC_SupplyConversion ( idx , ev_integer , true ) , NULL ) ;
break ;
case ev_integer :
d = QCC_PR_Statement ( & pr_opcodes [ OP_LOADP_I ] , d , QCC_SupplyConversion ( idx , ev_integer , true ) , NULL ) ;
break ;
case ev_string :
d = QCC_PR_Statement ( & pr_opcodes [ OP_LOADP_S ] , d , QCC_SupplyConversion ( idx , ev_integer , true ) , NULL ) ;
break ;
case ev_vector :
d = QCC_PR_Statement ( & pr_opcodes [ OP_LOADP_V ] , d , QCC_SupplyConversion ( idx , ev_integer , true ) , NULL ) ;
break ;
case ev_entity :
d = QCC_PR_Statement ( & pr_opcodes [ OP_LOADP_ENT ] , d , QCC_SupplyConversion ( idx , ev_integer , true ) , NULL ) ;
break ;
case ev_field :
d = QCC_PR_Statement ( & pr_opcodes [ OP_LOADP_FLD ] , d , QCC_SupplyConversion ( idx , ev_integer , true ) , NULL ) ;
break ;
case ev_function :
d = QCC_PR_Statement ( & pr_opcodes [ OP_LOADP_FNC ] , d , QCC_SupplyConversion ( idx , ev_integer , true ) , NULL ) ;
break ;
case ev_struct :
case ev_union :
d = QCC_PR_Statement ( & pr_opcodes [ OP_LOADP_I ] , d , QCC_SupplyConversion ( idx , ev_integer , true ) , NULL ) ;
break ;
default :
QCC_PR_ParseError ( ERR_NOVALIDOPCODES , " No op available. Try assembler " ) ;
}
d - > type = t ;
}
2012-02-05 01:38:51 +00:00
else if ( d - > type - > type = = ev_string & & d - > arraysize = = 0 )
2012-01-24 04:24:14 +00:00
{
d = QCC_PR_Statement ( & pr_opcodes [ OP_LOADP_C ] , d , QCC_SupplyConversion ( idx , ev_float , true ) , NULL ) ;
}
2012-02-13 09:24:01 +00:00
else if ( d - > type - > type = = ev_vector & & d - > arraysize = = 0 )
{
------------------------------------------------------------------------
r4169 | acceptthis | 2013-01-17 08:55:12 +0000 (Thu, 17 Jan 2013) | 31 lines
removed MAX_VISEDICTS limit.
PEXT2_REPLACEMENTDELTAS tweaked, now has 4 million entity limit. still not enabled by default.
TE_BEAM now maps to a separate TEQW_BEAM to avoid conflicts with QW.
added android multitouch emulation for windows/rawinput (in_simulatemultitouch).
split topcolor/bottomcolor from scoreboard, for dp's colormap|1024 feature.
now using utf-8 for windows consoles.
qcc warnings/errors now give clickable console links for quick+easy editing.
disabled menutint when the currently active item changes contrast or gamma (for OneManClan).
Added support for drawfont/drawfontscale.
tweaked the qcvm a little to reduce the number of pointers.
.doll file loading. still experimental and will likely crash. requires csqc active, even if its a dummy progs. this will be fixed in time. Still other things that need cleaning up.
windows: gl_font "?" shows the standard windows font-selection dialog, and can be used to select windows fonts. not all work. and you probably don't want to use windings.
fixed splitscreen support when playing mvds. added mini-scoreboards to splitscreen.
editor/debugger now shows asm if there's no linenumber info. also, pressing f1 for help shows the shortcuts.
Added support for .framegroups files for psk(psa) and iqm formats.
True support for ezquake's colour codes. Mutually exclusive with background colours.
path command output slightly more readable.
added support for digest_hex (MD4, SHA1, CRC16).
skingroups now colourmap correctly.
Fix terrain colour hints, and litdata from the wrong bsp.
fix ftp dual-homed issue. support epsv command, and enable ipv6 (eprt still not supported).
remove d3d11 compilation from the makefile. the required headers are not provided by mingw, and are not available to the build bot, so don't bother.
fix v *= v.x and similar opcodes.
fteqcc: fixed support for áéÃóú type chars in names. utf-8 files now properly supported (even with the utf-8 bom/identifier). utf-16 also supported.
fteqcc: fixed '#if 1 == 3 && 4' parsing.
fteqcc: -Werror acts on the warning, rather than as a separate error. Line numbers are thus more readable.
fteqcc: copyright message now includes compile date instead.
fteqccgui: the treeview control is now coloured depending on whether there were warnings/errors in the last compile.
fteqccgui: the output window is now focused and scrolls down as compilation progresses.
pr_dumpplatform command dumps out some pragmas to convert more serious warnings to errors. This is to avoid the infamous 'fteqcc sucks cos my code sucks' issue.
rewrote prespawn/modelist/soundlist code. server tracks progress now.
------------------------------------------------------------------------
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4167 fc73d0e0-1445-4013-8a0c-d673dee63da5
2013-03-12 22:29:40 +00:00
d = QCC_PR_Statement ( & pr_opcodes [ OP_LOADA_F ] , d , QCC_SupplyConversion ( idx , ev_integer , true ) , ( QCC_dstatement_t * * ) 0xffffffff ) ;
2012-02-13 09:24:01 +00:00
d - > type = type_float ;
}
2011-10-03 02:45:44 +00:00
else if ( QCC_OPCodeValid ( & pr_opcodes [ OP_LOADA_F ] ) )
2011-09-03 03:49:43 +00:00
{
/*don't care about assignments. the code can convert an OP_LOADA_F to an OP_ADDRESS on assign*/
/*source type is a struct, or its an array, or something that can otherwise be directly accessed*/
switch ( t - > type )
{
case ev_pointer :
------------------------------------------------------------------------
r4169 | acceptthis | 2013-01-17 08:55:12 +0000 (Thu, 17 Jan 2013) | 31 lines
removed MAX_VISEDICTS limit.
PEXT2_REPLACEMENTDELTAS tweaked, now has 4 million entity limit. still not enabled by default.
TE_BEAM now maps to a separate TEQW_BEAM to avoid conflicts with QW.
added android multitouch emulation for windows/rawinput (in_simulatemultitouch).
split topcolor/bottomcolor from scoreboard, for dp's colormap|1024 feature.
now using utf-8 for windows consoles.
qcc warnings/errors now give clickable console links for quick+easy editing.
disabled menutint when the currently active item changes contrast or gamma (for OneManClan).
Added support for drawfont/drawfontscale.
tweaked the qcvm a little to reduce the number of pointers.
.doll file loading. still experimental and will likely crash. requires csqc active, even if its a dummy progs. this will be fixed in time. Still other things that need cleaning up.
windows: gl_font "?" shows the standard windows font-selection dialog, and can be used to select windows fonts. not all work. and you probably don't want to use windings.
fixed splitscreen support when playing mvds. added mini-scoreboards to splitscreen.
editor/debugger now shows asm if there's no linenumber info. also, pressing f1 for help shows the shortcuts.
Added support for .framegroups files for psk(psa) and iqm formats.
True support for ezquake's colour codes. Mutually exclusive with background colours.
path command output slightly more readable.
added support for digest_hex (MD4, SHA1, CRC16).
skingroups now colourmap correctly.
Fix terrain colour hints, and litdata from the wrong bsp.
fix ftp dual-homed issue. support epsv command, and enable ipv6 (eprt still not supported).
remove d3d11 compilation from the makefile. the required headers are not provided by mingw, and are not available to the build bot, so don't bother.
fix v *= v.x and similar opcodes.
fteqcc: fixed support for áéÃóú type chars in names. utf-8 files now properly supported (even with the utf-8 bom/identifier). utf-16 also supported.
fteqcc: fixed '#if 1 == 3 && 4' parsing.
fteqcc: -Werror acts on the warning, rather than as a separate error. Line numbers are thus more readable.
fteqcc: copyright message now includes compile date instead.
fteqccgui: the treeview control is now coloured depending on whether there were warnings/errors in the last compile.
fteqccgui: the output window is now focused and scrolls down as compilation progresses.
pr_dumpplatform command dumps out some pragmas to convert more serious warnings to errors. This is to avoid the infamous 'fteqcc sucks cos my code sucks' issue.
rewrote prespawn/modelist/soundlist code. server tracks progress now.
------------------------------------------------------------------------
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4167 fc73d0e0-1445-4013-8a0c-d673dee63da5
2013-03-12 22:29:40 +00:00
d = QCC_PR_Statement ( & pr_opcodes [ OP_LOADA_I ] , d , QCC_SupplyConversion ( idx , ev_integer , true ) , ( QCC_dstatement_t * * ) 0xffffffff ) ;
2011-09-03 03:49:43 +00:00
break ;
case ev_float :
------------------------------------------------------------------------
r4169 | acceptthis | 2013-01-17 08:55:12 +0000 (Thu, 17 Jan 2013) | 31 lines
removed MAX_VISEDICTS limit.
PEXT2_REPLACEMENTDELTAS tweaked, now has 4 million entity limit. still not enabled by default.
TE_BEAM now maps to a separate TEQW_BEAM to avoid conflicts with QW.
added android multitouch emulation for windows/rawinput (in_simulatemultitouch).
split topcolor/bottomcolor from scoreboard, for dp's colormap|1024 feature.
now using utf-8 for windows consoles.
qcc warnings/errors now give clickable console links for quick+easy editing.
disabled menutint when the currently active item changes contrast or gamma (for OneManClan).
Added support for drawfont/drawfontscale.
tweaked the qcvm a little to reduce the number of pointers.
.doll file loading. still experimental and will likely crash. requires csqc active, even if its a dummy progs. this will be fixed in time. Still other things that need cleaning up.
windows: gl_font "?" shows the standard windows font-selection dialog, and can be used to select windows fonts. not all work. and you probably don't want to use windings.
fixed splitscreen support when playing mvds. added mini-scoreboards to splitscreen.
editor/debugger now shows asm if there's no linenumber info. also, pressing f1 for help shows the shortcuts.
Added support for .framegroups files for psk(psa) and iqm formats.
True support for ezquake's colour codes. Mutually exclusive with background colours.
path command output slightly more readable.
added support for digest_hex (MD4, SHA1, CRC16).
skingroups now colourmap correctly.
Fix terrain colour hints, and litdata from the wrong bsp.
fix ftp dual-homed issue. support epsv command, and enable ipv6 (eprt still not supported).
remove d3d11 compilation from the makefile. the required headers are not provided by mingw, and are not available to the build bot, so don't bother.
fix v *= v.x and similar opcodes.
fteqcc: fixed support for áéÃóú type chars in names. utf-8 files now properly supported (even with the utf-8 bom/identifier). utf-16 also supported.
fteqcc: fixed '#if 1 == 3 && 4' parsing.
fteqcc: -Werror acts on the warning, rather than as a separate error. Line numbers are thus more readable.
fteqcc: copyright message now includes compile date instead.
fteqccgui: the treeview control is now coloured depending on whether there were warnings/errors in the last compile.
fteqccgui: the output window is now focused and scrolls down as compilation progresses.
pr_dumpplatform command dumps out some pragmas to convert more serious warnings to errors. This is to avoid the infamous 'fteqcc sucks cos my code sucks' issue.
rewrote prespawn/modelist/soundlist code. server tracks progress now.
------------------------------------------------------------------------
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4167 fc73d0e0-1445-4013-8a0c-d673dee63da5
2013-03-12 22:29:40 +00:00
d = QCC_PR_Statement ( & pr_opcodes [ OP_LOADA_F ] , d , QCC_SupplyConversion ( idx , ev_integer , true ) , ( QCC_dstatement_t * * ) 0xffffffff ) ;
2011-09-03 03:49:43 +00:00
break ;
case ev_integer :
------------------------------------------------------------------------
r4169 | acceptthis | 2013-01-17 08:55:12 +0000 (Thu, 17 Jan 2013) | 31 lines
removed MAX_VISEDICTS limit.
PEXT2_REPLACEMENTDELTAS tweaked, now has 4 million entity limit. still not enabled by default.
TE_BEAM now maps to a separate TEQW_BEAM to avoid conflicts with QW.
added android multitouch emulation for windows/rawinput (in_simulatemultitouch).
split topcolor/bottomcolor from scoreboard, for dp's colormap|1024 feature.
now using utf-8 for windows consoles.
qcc warnings/errors now give clickable console links for quick+easy editing.
disabled menutint when the currently active item changes contrast or gamma (for OneManClan).
Added support for drawfont/drawfontscale.
tweaked the qcvm a little to reduce the number of pointers.
.doll file loading. still experimental and will likely crash. requires csqc active, even if its a dummy progs. this will be fixed in time. Still other things that need cleaning up.
windows: gl_font "?" shows the standard windows font-selection dialog, and can be used to select windows fonts. not all work. and you probably don't want to use windings.
fixed splitscreen support when playing mvds. added mini-scoreboards to splitscreen.
editor/debugger now shows asm if there's no linenumber info. also, pressing f1 for help shows the shortcuts.
Added support for .framegroups files for psk(psa) and iqm formats.
True support for ezquake's colour codes. Mutually exclusive with background colours.
path command output slightly more readable.
added support for digest_hex (MD4, SHA1, CRC16).
skingroups now colourmap correctly.
Fix terrain colour hints, and litdata from the wrong bsp.
fix ftp dual-homed issue. support epsv command, and enable ipv6 (eprt still not supported).
remove d3d11 compilation from the makefile. the required headers are not provided by mingw, and are not available to the build bot, so don't bother.
fix v *= v.x and similar opcodes.
fteqcc: fixed support for áéÃóú type chars in names. utf-8 files now properly supported (even with the utf-8 bom/identifier). utf-16 also supported.
fteqcc: fixed '#if 1 == 3 && 4' parsing.
fteqcc: -Werror acts on the warning, rather than as a separate error. Line numbers are thus more readable.
fteqcc: copyright message now includes compile date instead.
fteqccgui: the treeview control is now coloured depending on whether there were warnings/errors in the last compile.
fteqccgui: the output window is now focused and scrolls down as compilation progresses.
pr_dumpplatform command dumps out some pragmas to convert more serious warnings to errors. This is to avoid the infamous 'fteqcc sucks cos my code sucks' issue.
rewrote prespawn/modelist/soundlist code. server tracks progress now.
------------------------------------------------------------------------
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4167 fc73d0e0-1445-4013-8a0c-d673dee63da5
2013-03-12 22:29:40 +00:00
d = QCC_PR_Statement ( & pr_opcodes [ OP_LOADA_I ] , d , QCC_SupplyConversion ( idx , ev_integer , true ) , ( QCC_dstatement_t * * ) 0xffffffff ) ;
2011-09-03 03:49:43 +00:00
break ;
case ev_string :
------------------------------------------------------------------------
r4169 | acceptthis | 2013-01-17 08:55:12 +0000 (Thu, 17 Jan 2013) | 31 lines
removed MAX_VISEDICTS limit.
PEXT2_REPLACEMENTDELTAS tweaked, now has 4 million entity limit. still not enabled by default.
TE_BEAM now maps to a separate TEQW_BEAM to avoid conflicts with QW.
added android multitouch emulation for windows/rawinput (in_simulatemultitouch).
split topcolor/bottomcolor from scoreboard, for dp's colormap|1024 feature.
now using utf-8 for windows consoles.
qcc warnings/errors now give clickable console links for quick+easy editing.
disabled menutint when the currently active item changes contrast or gamma (for OneManClan).
Added support for drawfont/drawfontscale.
tweaked the qcvm a little to reduce the number of pointers.
.doll file loading. still experimental and will likely crash. requires csqc active, even if its a dummy progs. this will be fixed in time. Still other things that need cleaning up.
windows: gl_font "?" shows the standard windows font-selection dialog, and can be used to select windows fonts. not all work. and you probably don't want to use windings.
fixed splitscreen support when playing mvds. added mini-scoreboards to splitscreen.
editor/debugger now shows asm if there's no linenumber info. also, pressing f1 for help shows the shortcuts.
Added support for .framegroups files for psk(psa) and iqm formats.
True support for ezquake's colour codes. Mutually exclusive with background colours.
path command output slightly more readable.
added support for digest_hex (MD4, SHA1, CRC16).
skingroups now colourmap correctly.
Fix terrain colour hints, and litdata from the wrong bsp.
fix ftp dual-homed issue. support epsv command, and enable ipv6 (eprt still not supported).
remove d3d11 compilation from the makefile. the required headers are not provided by mingw, and are not available to the build bot, so don't bother.
fix v *= v.x and similar opcodes.
fteqcc: fixed support for áéÃóú type chars in names. utf-8 files now properly supported (even with the utf-8 bom/identifier). utf-16 also supported.
fteqcc: fixed '#if 1 == 3 && 4' parsing.
fteqcc: -Werror acts on the warning, rather than as a separate error. Line numbers are thus more readable.
fteqcc: copyright message now includes compile date instead.
fteqccgui: the treeview control is now coloured depending on whether there were warnings/errors in the last compile.
fteqccgui: the output window is now focused and scrolls down as compilation progresses.
pr_dumpplatform command dumps out some pragmas to convert more serious warnings to errors. This is to avoid the infamous 'fteqcc sucks cos my code sucks' issue.
rewrote prespawn/modelist/soundlist code. server tracks progress now.
------------------------------------------------------------------------
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4167 fc73d0e0-1445-4013-8a0c-d673dee63da5
2013-03-12 22:29:40 +00:00
d = QCC_PR_Statement ( & pr_opcodes [ OP_LOADA_S ] , d , QCC_SupplyConversion ( idx , ev_integer , true ) , ( QCC_dstatement_t * * ) 0xffffffff ) ;
2011-09-03 03:49:43 +00:00
break ;
case ev_vector :
------------------------------------------------------------------------
r4169 | acceptthis | 2013-01-17 08:55:12 +0000 (Thu, 17 Jan 2013) | 31 lines
removed MAX_VISEDICTS limit.
PEXT2_REPLACEMENTDELTAS tweaked, now has 4 million entity limit. still not enabled by default.
TE_BEAM now maps to a separate TEQW_BEAM to avoid conflicts with QW.
added android multitouch emulation for windows/rawinput (in_simulatemultitouch).
split topcolor/bottomcolor from scoreboard, for dp's colormap|1024 feature.
now using utf-8 for windows consoles.
qcc warnings/errors now give clickable console links for quick+easy editing.
disabled menutint when the currently active item changes contrast or gamma (for OneManClan).
Added support for drawfont/drawfontscale.
tweaked the qcvm a little to reduce the number of pointers.
.doll file loading. still experimental and will likely crash. requires csqc active, even if its a dummy progs. this will be fixed in time. Still other things that need cleaning up.
windows: gl_font "?" shows the standard windows font-selection dialog, and can be used to select windows fonts. not all work. and you probably don't want to use windings.
fixed splitscreen support when playing mvds. added mini-scoreboards to splitscreen.
editor/debugger now shows asm if there's no linenumber info. also, pressing f1 for help shows the shortcuts.
Added support for .framegroups files for psk(psa) and iqm formats.
True support for ezquake's colour codes. Mutually exclusive with background colours.
path command output slightly more readable.
added support for digest_hex (MD4, SHA1, CRC16).
skingroups now colourmap correctly.
Fix terrain colour hints, and litdata from the wrong bsp.
fix ftp dual-homed issue. support epsv command, and enable ipv6 (eprt still not supported).
remove d3d11 compilation from the makefile. the required headers are not provided by mingw, and are not available to the build bot, so don't bother.
fix v *= v.x and similar opcodes.
fteqcc: fixed support for áéÃóú type chars in names. utf-8 files now properly supported (even with the utf-8 bom/identifier). utf-16 also supported.
fteqcc: fixed '#if 1 == 3 && 4' parsing.
fteqcc: -Werror acts on the warning, rather than as a separate error. Line numbers are thus more readable.
fteqcc: copyright message now includes compile date instead.
fteqccgui: the treeview control is now coloured depending on whether there were warnings/errors in the last compile.
fteqccgui: the output window is now focused and scrolls down as compilation progresses.
pr_dumpplatform command dumps out some pragmas to convert more serious warnings to errors. This is to avoid the infamous 'fteqcc sucks cos my code sucks' issue.
rewrote prespawn/modelist/soundlist code. server tracks progress now.
------------------------------------------------------------------------
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4167 fc73d0e0-1445-4013-8a0c-d673dee63da5
2013-03-12 22:29:40 +00:00
d = QCC_PR_Statement ( & pr_opcodes [ OP_LOADA_V ] , d , QCC_SupplyConversion ( idx , ev_integer , true ) , ( QCC_dstatement_t * * ) 0xffffffff ) ;
2011-09-03 03:49:43 +00:00
break ;
case ev_entity :
------------------------------------------------------------------------
r4169 | acceptthis | 2013-01-17 08:55:12 +0000 (Thu, 17 Jan 2013) | 31 lines
removed MAX_VISEDICTS limit.
PEXT2_REPLACEMENTDELTAS tweaked, now has 4 million entity limit. still not enabled by default.
TE_BEAM now maps to a separate TEQW_BEAM to avoid conflicts with QW.
added android multitouch emulation for windows/rawinput (in_simulatemultitouch).
split topcolor/bottomcolor from scoreboard, for dp's colormap|1024 feature.
now using utf-8 for windows consoles.
qcc warnings/errors now give clickable console links for quick+easy editing.
disabled menutint when the currently active item changes contrast or gamma (for OneManClan).
Added support for drawfont/drawfontscale.
tweaked the qcvm a little to reduce the number of pointers.
.doll file loading. still experimental and will likely crash. requires csqc active, even if its a dummy progs. this will be fixed in time. Still other things that need cleaning up.
windows: gl_font "?" shows the standard windows font-selection dialog, and can be used to select windows fonts. not all work. and you probably don't want to use windings.
fixed splitscreen support when playing mvds. added mini-scoreboards to splitscreen.
editor/debugger now shows asm if there's no linenumber info. also, pressing f1 for help shows the shortcuts.
Added support for .framegroups files for psk(psa) and iqm formats.
True support for ezquake's colour codes. Mutually exclusive with background colours.
path command output slightly more readable.
added support for digest_hex (MD4, SHA1, CRC16).
skingroups now colourmap correctly.
Fix terrain colour hints, and litdata from the wrong bsp.
fix ftp dual-homed issue. support epsv command, and enable ipv6 (eprt still not supported).
remove d3d11 compilation from the makefile. the required headers are not provided by mingw, and are not available to the build bot, so don't bother.
fix v *= v.x and similar opcodes.
fteqcc: fixed support for áéÃóú type chars in names. utf-8 files now properly supported (even with the utf-8 bom/identifier). utf-16 also supported.
fteqcc: fixed '#if 1 == 3 && 4' parsing.
fteqcc: -Werror acts on the warning, rather than as a separate error. Line numbers are thus more readable.
fteqcc: copyright message now includes compile date instead.
fteqccgui: the treeview control is now coloured depending on whether there were warnings/errors in the last compile.
fteqccgui: the output window is now focused and scrolls down as compilation progresses.
pr_dumpplatform command dumps out some pragmas to convert more serious warnings to errors. This is to avoid the infamous 'fteqcc sucks cos my code sucks' issue.
rewrote prespawn/modelist/soundlist code. server tracks progress now.
------------------------------------------------------------------------
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4167 fc73d0e0-1445-4013-8a0c-d673dee63da5
2013-03-12 22:29:40 +00:00
d = QCC_PR_Statement ( & pr_opcodes [ OP_LOADA_ENT ] , d , QCC_SupplyConversion ( idx , ev_integer , true ) , ( QCC_dstatement_t * * ) 0xffffffff ) ;
2011-09-03 03:49:43 +00:00
break ;
case ev_field :
------------------------------------------------------------------------
r4169 | acceptthis | 2013-01-17 08:55:12 +0000 (Thu, 17 Jan 2013) | 31 lines
removed MAX_VISEDICTS limit.
PEXT2_REPLACEMENTDELTAS tweaked, now has 4 million entity limit. still not enabled by default.
TE_BEAM now maps to a separate TEQW_BEAM to avoid conflicts with QW.
added android multitouch emulation for windows/rawinput (in_simulatemultitouch).
split topcolor/bottomcolor from scoreboard, for dp's colormap|1024 feature.
now using utf-8 for windows consoles.
qcc warnings/errors now give clickable console links for quick+easy editing.
disabled menutint when the currently active item changes contrast or gamma (for OneManClan).
Added support for drawfont/drawfontscale.
tweaked the qcvm a little to reduce the number of pointers.
.doll file loading. still experimental and will likely crash. requires csqc active, even if its a dummy progs. this will be fixed in time. Still other things that need cleaning up.
windows: gl_font "?" shows the standard windows font-selection dialog, and can be used to select windows fonts. not all work. and you probably don't want to use windings.
fixed splitscreen support when playing mvds. added mini-scoreboards to splitscreen.
editor/debugger now shows asm if there's no linenumber info. also, pressing f1 for help shows the shortcuts.
Added support for .framegroups files for psk(psa) and iqm formats.
True support for ezquake's colour codes. Mutually exclusive with background colours.
path command output slightly more readable.
added support for digest_hex (MD4, SHA1, CRC16).
skingroups now colourmap correctly.
Fix terrain colour hints, and litdata from the wrong bsp.
fix ftp dual-homed issue. support epsv command, and enable ipv6 (eprt still not supported).
remove d3d11 compilation from the makefile. the required headers are not provided by mingw, and are not available to the build bot, so don't bother.
fix v *= v.x and similar opcodes.
fteqcc: fixed support for áéÃóú type chars in names. utf-8 files now properly supported (even with the utf-8 bom/identifier). utf-16 also supported.
fteqcc: fixed '#if 1 == 3 && 4' parsing.
fteqcc: -Werror acts on the warning, rather than as a separate error. Line numbers are thus more readable.
fteqcc: copyright message now includes compile date instead.
fteqccgui: the treeview control is now coloured depending on whether there were warnings/errors in the last compile.
fteqccgui: the output window is now focused and scrolls down as compilation progresses.
pr_dumpplatform command dumps out some pragmas to convert more serious warnings to errors. This is to avoid the infamous 'fteqcc sucks cos my code sucks' issue.
rewrote prespawn/modelist/soundlist code. server tracks progress now.
------------------------------------------------------------------------
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4167 fc73d0e0-1445-4013-8a0c-d673dee63da5
2013-03-12 22:29:40 +00:00
d = QCC_PR_Statement ( & pr_opcodes [ OP_LOADA_FLD ] , d , QCC_SupplyConversion ( idx , ev_integer , true ) , ( QCC_dstatement_t * * ) 0xffffffff ) ;
2011-09-03 03:49:43 +00:00
break ;
case ev_function :
------------------------------------------------------------------------
r4169 | acceptthis | 2013-01-17 08:55:12 +0000 (Thu, 17 Jan 2013) | 31 lines
removed MAX_VISEDICTS limit.
PEXT2_REPLACEMENTDELTAS tweaked, now has 4 million entity limit. still not enabled by default.
TE_BEAM now maps to a separate TEQW_BEAM to avoid conflicts with QW.
added android multitouch emulation for windows/rawinput (in_simulatemultitouch).
split topcolor/bottomcolor from scoreboard, for dp's colormap|1024 feature.
now using utf-8 for windows consoles.
qcc warnings/errors now give clickable console links for quick+easy editing.
disabled menutint when the currently active item changes contrast or gamma (for OneManClan).
Added support for drawfont/drawfontscale.
tweaked the qcvm a little to reduce the number of pointers.
.doll file loading. still experimental and will likely crash. requires csqc active, even if its a dummy progs. this will be fixed in time. Still other things that need cleaning up.
windows: gl_font "?" shows the standard windows font-selection dialog, and can be used to select windows fonts. not all work. and you probably don't want to use windings.
fixed splitscreen support when playing mvds. added mini-scoreboards to splitscreen.
editor/debugger now shows asm if there's no linenumber info. also, pressing f1 for help shows the shortcuts.
Added support for .framegroups files for psk(psa) and iqm formats.
True support for ezquake's colour codes. Mutually exclusive with background colours.
path command output slightly more readable.
added support for digest_hex (MD4, SHA1, CRC16).
skingroups now colourmap correctly.
Fix terrain colour hints, and litdata from the wrong bsp.
fix ftp dual-homed issue. support epsv command, and enable ipv6 (eprt still not supported).
remove d3d11 compilation from the makefile. the required headers are not provided by mingw, and are not available to the build bot, so don't bother.
fix v *= v.x and similar opcodes.
fteqcc: fixed support for áéÃóú type chars in names. utf-8 files now properly supported (even with the utf-8 bom/identifier). utf-16 also supported.
fteqcc: fixed '#if 1 == 3 && 4' parsing.
fteqcc: -Werror acts on the warning, rather than as a separate error. Line numbers are thus more readable.
fteqcc: copyright message now includes compile date instead.
fteqccgui: the treeview control is now coloured depending on whether there were warnings/errors in the last compile.
fteqccgui: the output window is now focused and scrolls down as compilation progresses.
pr_dumpplatform command dumps out some pragmas to convert more serious warnings to errors. This is to avoid the infamous 'fteqcc sucks cos my code sucks' issue.
rewrote prespawn/modelist/soundlist code. server tracks progress now.
------------------------------------------------------------------------
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4167 fc73d0e0-1445-4013-8a0c-d673dee63da5
2013-03-12 22:29:40 +00:00
d = QCC_PR_Statement ( & pr_opcodes [ OP_LOADA_FNC ] , d , QCC_SupplyConversion ( idx , ev_integer , true ) , ( QCC_dstatement_t * * ) 0xffffffff ) ;
2011-09-03 03:49:43 +00:00
break ;
2012-01-28 10:30:44 +00:00
case ev_struct :
case ev_union :
//FIXME...
------------------------------------------------------------------------
r4169 | acceptthis | 2013-01-17 08:55:12 +0000 (Thu, 17 Jan 2013) | 31 lines
removed MAX_VISEDICTS limit.
PEXT2_REPLACEMENTDELTAS tweaked, now has 4 million entity limit. still not enabled by default.
TE_BEAM now maps to a separate TEQW_BEAM to avoid conflicts with QW.
added android multitouch emulation for windows/rawinput (in_simulatemultitouch).
split topcolor/bottomcolor from scoreboard, for dp's colormap|1024 feature.
now using utf-8 for windows consoles.
qcc warnings/errors now give clickable console links for quick+easy editing.
disabled menutint when the currently active item changes contrast or gamma (for OneManClan).
Added support for drawfont/drawfontscale.
tweaked the qcvm a little to reduce the number of pointers.
.doll file loading. still experimental and will likely crash. requires csqc active, even if its a dummy progs. this will be fixed in time. Still other things that need cleaning up.
windows: gl_font "?" shows the standard windows font-selection dialog, and can be used to select windows fonts. not all work. and you probably don't want to use windings.
fixed splitscreen support when playing mvds. added mini-scoreboards to splitscreen.
editor/debugger now shows asm if there's no linenumber info. also, pressing f1 for help shows the shortcuts.
Added support for .framegroups files for psk(psa) and iqm formats.
True support for ezquake's colour codes. Mutually exclusive with background colours.
path command output slightly more readable.
added support for digest_hex (MD4, SHA1, CRC16).
skingroups now colourmap correctly.
Fix terrain colour hints, and litdata from the wrong bsp.
fix ftp dual-homed issue. support epsv command, and enable ipv6 (eprt still not supported).
remove d3d11 compilation from the makefile. the required headers are not provided by mingw, and are not available to the build bot, so don't bother.
fix v *= v.x and similar opcodes.
fteqcc: fixed support for áéÃóú type chars in names. utf-8 files now properly supported (even with the utf-8 bom/identifier). utf-16 also supported.
fteqcc: fixed '#if 1 == 3 && 4' parsing.
fteqcc: -Werror acts on the warning, rather than as a separate error. Line numbers are thus more readable.
fteqcc: copyright message now includes compile date instead.
fteqccgui: the treeview control is now coloured depending on whether there were warnings/errors in the last compile.
fteqccgui: the output window is now focused and scrolls down as compilation progresses.
pr_dumpplatform command dumps out some pragmas to convert more serious warnings to errors. This is to avoid the infamous 'fteqcc sucks cos my code sucks' issue.
rewrote prespawn/modelist/soundlist code. server tracks progress now.
------------------------------------------------------------------------
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4167 fc73d0e0-1445-4013-8a0c-d673dee63da5
2013-03-12 22:29:40 +00:00
d = QCC_PR_Statement ( & pr_opcodes [ OP_LOADA_STRUCT ] , d , QCC_SupplyConversion ( idx , ev_integer , true ) , ( QCC_dstatement_t * * ) 0xffffffff ) ;
2012-01-28 10:30:44 +00:00
break ;
2011-09-03 03:49:43 +00:00
default :
QCC_PR_ParseError ( ERR_NOVALIDOPCODES , " No op available. Try assembler " ) ;
}
d - > type = t ;
}
2011-10-03 02:45:44 +00:00
else if ( idx - > constant )
{
int cidx ;
idx = QCC_SupplyConversion ( idx , ev_integer , true ) ;
cidx = G_INT ( idx - > ofs ) ;
d - > references + + ;
tmp = ( void * ) qccHunkAlloc ( sizeof ( QCC_def_t ) ) ;
memcpy ( tmp , d , sizeof ( QCC_def_t ) ) ;
2012-01-17 07:57:46 +00:00
tmp - > arraysize = 0 ;
2012-11-27 03:23:19 +00:00
tmp - > ofs = d - > ofs + cidx ;
2011-10-03 02:45:44 +00:00
d = tmp ;
//d can be assigned to freely
}
2011-09-03 03:49:43 +00:00
else if ( allowarrayassign & & QCC_PR_CheckToken ( " = " ) )
{
/*if its assigned to, generate a functioncall to do the store*/
QCC_def_t * args [ 2 ] , * funcretr , * rhs ;
2011-10-03 02:45:44 +00:00
d - > references + + ;
2012-01-17 07:57:46 +00:00
funcretr = QCC_PR_GetDef ( type_function , qcva ( " ArraySet*%s " , d - > name ) , NULL , true , 0 , false ) ;
2011-09-03 03:49:43 +00:00
rhs = QCC_PR_Expression ( TOP_PRIORITY , 0 ) ;
2012-07-05 19:42:36 +00:00
if ( rhs - > type - > type ! = t - > type )
2011-09-03 03:49:43 +00:00
QCC_PR_ParseErrorPrintDef ( ERR_TYPEMISMATCH , d , " Type Mismatch on array assignment " ) ;
args [ 0 ] = QCC_SupplyConversion ( idx , ev_float , true ) ;
args [ 1 ] = rhs ;
qcc_usefulstatement = true ;
d = QCC_PR_GenerateFunctionCall ( funcretr , args , 2 ) ;
d - > type = t ;
2012-02-13 09:24:01 +00:00
return d ;
2011-09-03 03:49:43 +00:00
}
else if ( QCC_OPCodeValid ( & pr_opcodes [ OP_FETCH_GBL_F ] ) )
{
2012-01-17 07:57:46 +00:00
if ( ! d - > arraysize )
QCC_PR_ParseErrorPrintDef ( ERR_TYPEMISMATCH , d , " array lookup on non-array " ) ;
if ( d - > temp )
QCC_PR_ParseErrorPrintDef ( ERR_TYPEMISMATCH , d , " array lookup on a temp " ) ;
2011-09-03 03:49:43 +00:00
/*hexen2 format has opcodes to read arrays (but has no way to write)*/
switch ( t - > type )
{
2013-03-12 22:32:25 +00:00
case ev_field :
case ev_pointer :
case ev_integer :
d = QCC_PR_Statement ( & pr_opcodes [ OP_FETCH_GBL_F ] , d , QCC_SupplyConversion ( idx , ev_float , true ) , & st ) ; //get pointer to precise def.
d - > type = t ;
break ;
2011-09-03 03:49:43 +00:00
case ev_float :
d = QCC_PR_Statement ( & pr_opcodes [ OP_FETCH_GBL_F ] , d , QCC_SupplyConversion ( idx , ev_float , true ) , & st ) ; //get pointer to precise def.
2012-01-17 07:57:46 +00:00
// st->a = d->ofs;
2011-09-03 03:49:43 +00:00
break ;
case ev_vector :
2012-11-27 03:23:19 +00:00
idx = QCC_PR_Statement ( & pr_opcodes [ OP_DIV_F ] , QCC_SupplyConversion ( idx , ev_float , true ) , QCC_MakeFloatConst ( 3 ) , NULL ) ;
d = QCC_PR_Statement ( & pr_opcodes [ OP_FETCH_GBL_V ] , d , idx , & st ) ; //get pointer to precise def.
2012-01-17 07:57:46 +00:00
// st->a = d->ofs;
2011-09-03 03:49:43 +00:00
break ;
case ev_string :
d = QCC_PR_Statement ( & pr_opcodes [ OP_FETCH_GBL_S ] , d , QCC_SupplyConversion ( idx , ev_float , true ) , & st ) ; //get pointer to precise def.
2012-01-17 07:57:46 +00:00
// st->a = d->ofs;
2011-09-03 03:49:43 +00:00
break ;
case ev_entity :
d = QCC_PR_Statement ( & pr_opcodes [ OP_FETCH_GBL_E ] , d , QCC_SupplyConversion ( idx , ev_float , true ) , & st ) ; //get pointer to precise def.
2012-01-17 07:57:46 +00:00
// st->a = d->ofs;
2011-09-03 03:49:43 +00:00
break ;
case ev_function :
d = QCC_PR_Statement ( & pr_opcodes [ OP_FETCH_GBL_FNC ] , d , QCC_SupplyConversion ( idx , ev_float , true ) , & st ) ; //get pointer to precise def.
2012-01-17 07:57:46 +00:00
// st->a = d->ofs;
2011-09-03 03:49:43 +00:00
break ;
default :
QCC_PR_ParseError ( ERR_NOVALIDOPCODES , " No op available. Try assembler " ) ;
d = NULL ;
break ;
}
d - > type = t ;
}
else
{
/*emulate the array access using a function call to do the read for us*/
QCC_def_t * args [ 1 ] , * funcretr ;
2011-10-03 02:45:44 +00:00
d - > references + + ;
2011-09-03 03:49:43 +00:00
/*make sure the function type that we're calling exists*/
2012-07-05 19:42:36 +00:00
if ( d - > type - > type = = ev_vector )
{
def_parms [ 0 ] . type = type_vector ;
funcretr = QCC_PR_GetDef ( type_function , qcva ( " ArrayGet*%s " , d - > name ) , NULL , true , 0 , false ) ;
2012-11-27 03:23:19 +00:00
args [ 0 ] = QCC_PR_Statement ( & pr_opcodes [ OP_DIV_F ] , QCC_SupplyConversion ( idx , ev_float , true ) , QCC_MakeFloatConst ( 3 ) , NULL ) ;
2012-07-05 19:42:36 +00:00
d = QCC_PR_GenerateFunctionCall ( funcretr , args , 1 ) ;
d - > type = t ;
}
else
{
def_parms [ 0 ] . type = type_float ;
funcretr = QCC_PR_GetDef ( type_function , qcva ( " ArrayGet*%s " , d - > name ) , NULL , true , 0 , false ) ;
if ( t - > size > 1 )
{
QCC_def_t * r ;
unsigned int i ;
int old_op = opt_assignments ;
d = QCC_GetTemp ( t ) ;
idx = QCC_SupplyConversion ( idx , ev_float , true ) ;
for ( i = 0 ; i < t - > size ; i + + )
{
if ( i )
args [ 0 ] = QCC_PR_Statement ( & pr_opcodes [ OP_ADD_F ] , idx , QCC_MakeFloatConst ( i ) , ( QCC_dstatement_t * * ) 0xffffffff ) ;
else
{
args [ 0 ] = idx ;
opt_assignments = false ;
}
r = QCC_PR_GenerateFunctionCall ( funcretr , args , 1 ) ;
opt_assignments = old_op ;
QCC_UnFreeTemp ( idx ) ;
QCC_FreeTemp ( QCC_PR_Statement ( & pr_opcodes [ OP_STORE_F ] , r , d , ( QCC_dstatement_t * * ) 0xffffffff ) ) ;
d - > ofs + + ;
}
QCC_FreeTemp ( idx ) ;
d - > ofs - = i ;
QCC_UnFreeTemp ( d ) ;
}
else
{
args [ 0 ] = QCC_SupplyConversion ( idx , ev_float , true ) ;
d = QCC_PR_GenerateFunctionCall ( funcretr , args , 1 ) ;
}
d - > type = t ;
}
2011-09-03 03:49:43 +00:00
}
2012-02-13 09:24:01 +00:00
/*parse recursively*/
d = QCC_PR_ParseArrayPointer ( d , allowarrayassign ) ;
2011-09-03 03:49:43 +00:00
}
2012-02-13 09:24:01 +00:00
return d ;
}
/*
= = = = = = = = = = = =
PR_ParseValue
Returns the global ofs for the current token
= = = = = = = = = = = =
*/
QCC_def_t * QCC_PR_ParseValue ( QCC_type_t * assumeclass , pbool allowarrayassign )
{
QCC_def_t * d , * od , * tmp ;
QCC_type_t * t ;
char * name ;
char membername [ 2048 ] ;
// if the token is an immediate, allocate a constant for it
if ( pr_token_type = = tt_immediate )
return QCC_PR_ParseImmediate ( ) ;
------------------------------------------------------------------------
r4169 | acceptthis | 2013-01-17 08:55:12 +0000 (Thu, 17 Jan 2013) | 31 lines
removed MAX_VISEDICTS limit.
PEXT2_REPLACEMENTDELTAS tweaked, now has 4 million entity limit. still not enabled by default.
TE_BEAM now maps to a separate TEQW_BEAM to avoid conflicts with QW.
added android multitouch emulation for windows/rawinput (in_simulatemultitouch).
split topcolor/bottomcolor from scoreboard, for dp's colormap|1024 feature.
now using utf-8 for windows consoles.
qcc warnings/errors now give clickable console links for quick+easy editing.
disabled menutint when the currently active item changes contrast or gamma (for OneManClan).
Added support for drawfont/drawfontscale.
tweaked the qcvm a little to reduce the number of pointers.
.doll file loading. still experimental and will likely crash. requires csqc active, even if its a dummy progs. this will be fixed in time. Still other things that need cleaning up.
windows: gl_font "?" shows the standard windows font-selection dialog, and can be used to select windows fonts. not all work. and you probably don't want to use windings.
fixed splitscreen support when playing mvds. added mini-scoreboards to splitscreen.
editor/debugger now shows asm if there's no linenumber info. also, pressing f1 for help shows the shortcuts.
Added support for .framegroups files for psk(psa) and iqm formats.
True support for ezquake's colour codes. Mutually exclusive with background colours.
path command output slightly more readable.
added support for digest_hex (MD4, SHA1, CRC16).
skingroups now colourmap correctly.
Fix terrain colour hints, and litdata from the wrong bsp.
fix ftp dual-homed issue. support epsv command, and enable ipv6 (eprt still not supported).
remove d3d11 compilation from the makefile. the required headers are not provided by mingw, and are not available to the build bot, so don't bother.
fix v *= v.x and similar opcodes.
fteqcc: fixed support for áéÃóú type chars in names. utf-8 files now properly supported (even with the utf-8 bom/identifier). utf-16 also supported.
fteqcc: fixed '#if 1 == 3 && 4' parsing.
fteqcc: -Werror acts on the warning, rather than as a separate error. Line numbers are thus more readable.
fteqcc: copyright message now includes compile date instead.
fteqccgui: the treeview control is now coloured depending on whether there were warnings/errors in the last compile.
fteqccgui: the output window is now focused and scrolls down as compilation progresses.
pr_dumpplatform command dumps out some pragmas to convert more serious warnings to errors. This is to avoid the infamous 'fteqcc sucks cos my code sucks' issue.
rewrote prespawn/modelist/soundlist code. server tracks progress now.
------------------------------------------------------------------------
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4167 fc73d0e0-1445-4013-8a0c-d673dee63da5
2013-03-12 22:29:40 +00:00
if ( QCC_PR_CheckToken ( " [ " ) )
{
//originally used for reacc - taking the form of [5 84 2]
//we redefine it to include statements - [a+b, c, 3+(d*2)]
//and to not need the 2nd/3rd parts if you're lazy - [5] or [5,6] - FIXME: should we accept 1-d vector? or is that too risky with arrays and weird error messages?
//note the addition of commas.
//if we're parsing reacc code, we will still accept [(a+b) c (3+(d*2))], as QCC_PR_Term contains the () handling. We do also allow optional commas.
QCC_def_t * x , * y , * z ;
if ( flag_acc )
{
x = QCC_PR_Term ( EXPR_DISALLOW_COMMA ) ;
QCC_PR_CheckToken ( " , " ) ;
y = QCC_PR_Term ( EXPR_DISALLOW_COMMA ) ;
QCC_PR_CheckToken ( " , " ) ;
z = QCC_PR_Term ( EXPR_DISALLOW_COMMA ) ;
}
else
{
x = QCC_PR_Expression ( TOP_PRIORITY , EXPR_DISALLOW_COMMA ) ;
if ( QCC_PR_CheckToken ( " , " ) )
y = QCC_PR_Expression ( TOP_PRIORITY , EXPR_DISALLOW_COMMA ) ;
else
y = QCC_MakeFloatConst ( 0 ) ;
if ( QCC_PR_CheckToken ( " , " ) )
z = QCC_PR_Expression ( TOP_PRIORITY , EXPR_DISALLOW_COMMA ) ;
else
z = QCC_MakeFloatConst ( 0 ) ;
}
2012-02-13 09:24:01 +00:00
QCC_PR_Expect ( " ] " ) ;
------------------------------------------------------------------------
r4169 | acceptthis | 2013-01-17 08:55:12 +0000 (Thu, 17 Jan 2013) | 31 lines
removed MAX_VISEDICTS limit.
PEXT2_REPLACEMENTDELTAS tweaked, now has 4 million entity limit. still not enabled by default.
TE_BEAM now maps to a separate TEQW_BEAM to avoid conflicts with QW.
added android multitouch emulation for windows/rawinput (in_simulatemultitouch).
split topcolor/bottomcolor from scoreboard, for dp's colormap|1024 feature.
now using utf-8 for windows consoles.
qcc warnings/errors now give clickable console links for quick+easy editing.
disabled menutint when the currently active item changes contrast or gamma (for OneManClan).
Added support for drawfont/drawfontscale.
tweaked the qcvm a little to reduce the number of pointers.
.doll file loading. still experimental and will likely crash. requires csqc active, even if its a dummy progs. this will be fixed in time. Still other things that need cleaning up.
windows: gl_font "?" shows the standard windows font-selection dialog, and can be used to select windows fonts. not all work. and you probably don't want to use windings.
fixed splitscreen support when playing mvds. added mini-scoreboards to splitscreen.
editor/debugger now shows asm if there's no linenumber info. also, pressing f1 for help shows the shortcuts.
Added support for .framegroups files for psk(psa) and iqm formats.
True support for ezquake's colour codes. Mutually exclusive with background colours.
path command output slightly more readable.
added support for digest_hex (MD4, SHA1, CRC16).
skingroups now colourmap correctly.
Fix terrain colour hints, and litdata from the wrong bsp.
fix ftp dual-homed issue. support epsv command, and enable ipv6 (eprt still not supported).
remove d3d11 compilation from the makefile. the required headers are not provided by mingw, and are not available to the build bot, so don't bother.
fix v *= v.x and similar opcodes.
fteqcc: fixed support for áéÃóú type chars in names. utf-8 files now properly supported (even with the utf-8 bom/identifier). utf-16 also supported.
fteqcc: fixed '#if 1 == 3 && 4' parsing.
fteqcc: -Werror acts on the warning, rather than as a separate error. Line numbers are thus more readable.
fteqcc: copyright message now includes compile date instead.
fteqccgui: the treeview control is now coloured depending on whether there were warnings/errors in the last compile.
fteqccgui: the output window is now focused and scrolls down as compilation progresses.
pr_dumpplatform command dumps out some pragmas to convert more serious warnings to errors. This is to avoid the infamous 'fteqcc sucks cos my code sucks' issue.
rewrote prespawn/modelist/soundlist code. server tracks progress now.
------------------------------------------------------------------------
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4167 fc73d0e0-1445-4013-8a0c-d673dee63da5
2013-03-12 22:29:40 +00:00
if ( ( x - > type - > type ! = ev_float & & x - > type - > type ! = ev_integer ) | |
( y - > type - > type ! = ev_float & & y - > type - > type ! = ev_integer ) | |
( z - > type - > type ! = ev_float & & z - > type - > type ! = ev_integer ) )
{
QCC_PR_ParseError ( ERR_TYPEMISMATCH , " Argument not a single numeric value in vector constructor " ) ;
return QCC_MakeVectorConst ( 0 , 0 , 0 ) ;
}
//return a constant if we can.
if ( x - > constant & & y - > constant & & z - > constant )
{
d = QCC_MakeVectorConst (
( x - > type - > type = = ev_float ) ? G_FLOAT ( x - > ofs ) : G_INT ( x - > ofs ) ,
( y - > type - > type = = ev_float ) ? G_FLOAT ( y - > ofs ) : G_INT ( y - > ofs ) ,
( z - > type - > type = = ev_float ) ? G_FLOAT ( z - > ofs ) : G_INT ( z - > ofs ) ) ;
QCC_FreeTemp ( x ) ;
QCC_FreeTemp ( y ) ;
QCC_FreeTemp ( z ) ;
return d ;
}
//pack the variables into a vector
d = QCC_GetTemp ( type_vector ) ;
d - > type = type_float ;
if ( x - > type - > type = = ev_float )
QCC_PR_Statement ( pr_opcodes + OP_STORE_F , x , d , ( QCC_dstatement_t * * ) 0xffffffff ) ;
else
QCC_PR_Statement ( pr_opcodes + OP_CONV_ITOF , x , d , ( QCC_dstatement_t * * ) 0xffffffff ) ;
d - > ofs + + ;
if ( y - > type - > type = = ev_float )
QCC_PR_Statement ( pr_opcodes + OP_STORE_F , y , d , ( QCC_dstatement_t * * ) 0xffffffff ) ;
else
QCC_PR_Statement ( pr_opcodes + OP_CONV_ITOF , y , d , ( QCC_dstatement_t * * ) 0xffffffff ) ;
d - > ofs + + ;
if ( z - > type - > type = = ev_float )
QCC_PR_Statement ( pr_opcodes + OP_STORE_F , z , d , ( QCC_dstatement_t * * ) 0xffffffff ) ;
else
QCC_PR_Statement ( pr_opcodes + OP_CONV_ITOF , z , d , ( QCC_dstatement_t * * ) 0xffffffff ) ;
d - > ofs + + ;
d - > ofs - = 3 ;
d - > type = type_vector ;
QCC_FreeTemp ( x ) ;
QCC_FreeTemp ( y ) ;
QCC_FreeTemp ( z ) ;
2012-02-13 09:24:01 +00:00
return d ;
}
name = QCC_PR_ParseName ( ) ;
if ( assumeclass & & assumeclass - > parentclass ) // 'testvar' becomes 'self::testvar'
{ //try getting a member.
QCC_type_t * type ;
type = assumeclass ;
d = NULL ;
while ( type ! = type_entity & & type )
{
sprintf ( membername , " %s:: " MEMBERFIELDNAME , type - > name , name ) ;
d = QCC_PR_GetDef ( NULL , membername , pr_scope , false , 0 , false ) ;
if ( d )
break ;
type = type - > parentclass ;
}
if ( ! d )
d = QCC_PR_GetDef ( NULL , name , pr_scope , false , 0 , false ) ;
}
else
{
// look through the defs
d = QCC_PR_GetDef ( NULL , name , pr_scope , false , 0 , false ) ;
}
if ( ! d )
{
if ( ( ! strcmp ( name , " random " ) ) | |
( ! strcmp ( name , " randomv " ) ) | |
( ! strcmp ( name , " sizeof " ) ) | |
( ! strcmp ( name , " entnum " ) ) | |
( ! strcmp ( name , " _ " ) ) ) //intrinsics, any old function with no args will do.
{
d = QCC_PR_GetDef ( type_function , name , NULL , true , 0 , false ) ;
d - > initialized = 0 ;
}
else if ( keyword_class & & ! strcmp ( name , " this " ) )
{
if ( ! pr_classtype )
QCC_PR_ParseError ( ERR_NOTANAME , " Cannot use 'this' outside of an OO function \n " ) ;
od = QCC_PR_GetDef ( NULL , " self " , NULL , true , 0 , false ) ;
2013-03-12 22:32:25 +00:00
d = QCC_PR_DummyDef ( pr_classtype , " this " , pr_scope , 0 , od - > ofs , true , GDF_CONST ) ;
2012-02-13 09:24:01 +00:00
}
else if ( keyword_class & & ! strcmp ( name , " super " ) )
{
if ( ! pr_classtype )
QCC_PR_ParseError ( ERR_NOTANAME , " Cannot use 'super' outside of an OO function \n " ) ;
od = QCC_PR_GetDef ( NULL , " self " , NULL , true , 0 , false ) ;
2013-03-12 22:32:25 +00:00
d = QCC_PR_DummyDef ( pr_classtype , " super " , pr_scope , 0 , od - > ofs , true , GDF_CONST ) ;
2012-02-13 09:24:01 +00:00
}
else
{
d = QCC_PR_GetDef ( type_variant , name , pr_scope , true , 0 , false ) ;
if ( ! d )
QCC_PR_ParseError ( ERR_UNKNOWNVALUE , " Unknown value \" %s \" " , name ) ;
else
{
QCC_PR_ParseWarning ( ERR_UNKNOWNVALUE , " Unknown value \" %s \" . " , name ) ;
}
}
}
d = QCC_PR_ParseArrayPointer ( d , allowarrayassign ) ;
2004-08-23 01:38:21 +00:00
2011-10-03 02:45:44 +00:00
t = d - > type ;
if ( keyword_class & & t - > type = = ev_entity & & t - > parentclass & & ( QCC_PR_CheckToken ( " . " ) | | QCC_PR_CheckToken ( " -> " ) ) )
2004-08-23 01:38:21 +00:00
{
2011-10-03 02:45:44 +00:00
QCC_def_t * field ;
if ( QCC_PR_CheckToken ( " ( " ) )
2004-08-23 01:38:21 +00:00
{
2011-10-03 02:45:44 +00:00
field = QCC_PR_Expression ( TOP_PRIORITY , 0 ) ;
QCC_PR_Expect ( " ) " ) ;
2004-08-23 01:38:21 +00:00
}
else
2011-10-03 02:45:44 +00:00
field = QCC_PR_ParseValue ( d - > type , false ) ;
if ( field - > type - > type = = ev_field )
2004-08-23 01:38:21 +00:00
{
2011-10-03 02:45:44 +00:00
if ( ! field - > type - > aux_type )
2004-08-23 01:38:21 +00:00
{
2011-10-03 02:45:44 +00:00
QCC_PR_ParseWarning ( ERR_INTERNAL , " Field with null aux_type " ) ;
d = QCC_PR_Statement ( & pr_opcodes [ OP_LOAD_FLD ] , d , field , NULL ) ;
}
else
{
switch ( field - > type - > aux_type - > type )
2004-10-13 07:24:59 +00:00
{
2011-10-03 02:45:44 +00:00
default :
QCC_PR_ParseError ( ERR_INTERNAL , " Bad field type " ) ;
break ;
case ev_integer :
d = QCC_PR_Statement ( & pr_opcodes [ OP_LOAD_I ] , d , field , NULL ) ;
break ;
case ev_field :
d = QCC_PR_Statement ( & pr_opcodes [ OP_LOAD_FLD ] , d , field , NULL ) ;
tmp = ( void * ) qccHunkAlloc ( sizeof ( QCC_def_t ) ) ;
memset ( tmp , 0 , sizeof ( QCC_def_t ) ) ;
tmp - > type = field - > type - > aux_type ;
tmp - > ofs = d - > ofs ;
tmp - > temp = d - > temp ;
tmp - > constant = false ;
tmp - > name = d - > name ;
d = tmp ;
break ;
case ev_float :
d = QCC_PR_Statement ( & pr_opcodes [ OP_LOAD_F ] , d , field , NULL ) ;
break ;
case ev_string :
d = QCC_PR_Statement ( & pr_opcodes [ OP_LOAD_S ] , d , field , NULL ) ;
break ;
case ev_vector :
d = QCC_PR_Statement ( & pr_opcodes [ OP_LOAD_V ] , d , field , NULL ) ;
break ;
case ev_function :
d = QCC_PR_Statement ( & pr_opcodes [ OP_LOAD_FNC ] , d , field , NULL ) ;
tmp = ( void * ) qccHunkAlloc ( sizeof ( QCC_def_t ) ) ;
memset ( tmp , 0 , sizeof ( QCC_def_t ) ) ;
tmp - > type = field - > type - > aux_type ;
tmp - > ofs = d - > ofs ;
tmp - > temp = d - > temp ;
tmp - > constant = false ;
tmp - > name = d - > name ;
d = tmp ;
break ;
case ev_entity :
d = QCC_PR_Statement ( & pr_opcodes [ OP_LOAD_ENT ] , d , field , NULL ) ;
break ;
2004-10-13 07:24:59 +00:00
}
2004-08-23 01:38:21 +00:00
}
}
2011-10-03 02:45:44 +00:00
else
QCC_PR_IncludeChunk ( " . " , false , NULL ) ;
}
2011-09-03 03:49:43 +00:00
2011-10-03 02:45:44 +00:00
return d ;
}
2004-08-23 01:38:21 +00:00
/*
= = = = = = = = = = = =
PR_Term
= = = = = = = = = = = =
*/
------------------------------------------------------------------------
r4169 | acceptthis | 2013-01-17 08:55:12 +0000 (Thu, 17 Jan 2013) | 31 lines
removed MAX_VISEDICTS limit.
PEXT2_REPLACEMENTDELTAS tweaked, now has 4 million entity limit. still not enabled by default.
TE_BEAM now maps to a separate TEQW_BEAM to avoid conflicts with QW.
added android multitouch emulation for windows/rawinput (in_simulatemultitouch).
split topcolor/bottomcolor from scoreboard, for dp's colormap|1024 feature.
now using utf-8 for windows consoles.
qcc warnings/errors now give clickable console links for quick+easy editing.
disabled menutint when the currently active item changes contrast or gamma (for OneManClan).
Added support for drawfont/drawfontscale.
tweaked the qcvm a little to reduce the number of pointers.
.doll file loading. still experimental and will likely crash. requires csqc active, even if its a dummy progs. this will be fixed in time. Still other things that need cleaning up.
windows: gl_font "?" shows the standard windows font-selection dialog, and can be used to select windows fonts. not all work. and you probably don't want to use windings.
fixed splitscreen support when playing mvds. added mini-scoreboards to splitscreen.
editor/debugger now shows asm if there's no linenumber info. also, pressing f1 for help shows the shortcuts.
Added support for .framegroups files for psk(psa) and iqm formats.
True support for ezquake's colour codes. Mutually exclusive with background colours.
path command output slightly more readable.
added support for digest_hex (MD4, SHA1, CRC16).
skingroups now colourmap correctly.
Fix terrain colour hints, and litdata from the wrong bsp.
fix ftp dual-homed issue. support epsv command, and enable ipv6 (eprt still not supported).
remove d3d11 compilation from the makefile. the required headers are not provided by mingw, and are not available to the build bot, so don't bother.
fix v *= v.x and similar opcodes.
fteqcc: fixed support for áéÃóú type chars in names. utf-8 files now properly supported (even with the utf-8 bom/identifier). utf-16 also supported.
fteqcc: fixed '#if 1 == 3 && 4' parsing.
fteqcc: -Werror acts on the warning, rather than as a separate error. Line numbers are thus more readable.
fteqcc: copyright message now includes compile date instead.
fteqccgui: the treeview control is now coloured depending on whether there were warnings/errors in the last compile.
fteqccgui: the output window is now focused and scrolls down as compilation progresses.
pr_dumpplatform command dumps out some pragmas to convert more serious warnings to errors. This is to avoid the infamous 'fteqcc sucks cos my code sucks' issue.
rewrote prespawn/modelist/soundlist code. server tracks progress now.
------------------------------------------------------------------------
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4167 fc73d0e0-1445-4013-8a0c-d673dee63da5
2013-03-12 22:29:40 +00:00
QCC_def_t * QCC_PR_Term ( int exprflags )
2004-08-23 01:38:21 +00:00
{
QCC_def_t * e , * e2 ;
etype_t t ;
if ( pr_token_type = = tt_punct ) //a little extra speed...
{
2005-03-20 02:57:11 +00:00
if ( QCC_PR_CheckToken ( " ++ " ) )
2004-08-23 01:38:21 +00:00
{
qcc_usefulstatement = true ;
------------------------------------------------------------------------
r4169 | acceptthis | 2013-01-17 08:55:12 +0000 (Thu, 17 Jan 2013) | 31 lines
removed MAX_VISEDICTS limit.
PEXT2_REPLACEMENTDELTAS tweaked, now has 4 million entity limit. still not enabled by default.
TE_BEAM now maps to a separate TEQW_BEAM to avoid conflicts with QW.
added android multitouch emulation for windows/rawinput (in_simulatemultitouch).
split topcolor/bottomcolor from scoreboard, for dp's colormap|1024 feature.
now using utf-8 for windows consoles.
qcc warnings/errors now give clickable console links for quick+easy editing.
disabled menutint when the currently active item changes contrast or gamma (for OneManClan).
Added support for drawfont/drawfontscale.
tweaked the qcvm a little to reduce the number of pointers.
.doll file loading. still experimental and will likely crash. requires csqc active, even if its a dummy progs. this will be fixed in time. Still other things that need cleaning up.
windows: gl_font "?" shows the standard windows font-selection dialog, and can be used to select windows fonts. not all work. and you probably don't want to use windings.
fixed splitscreen support when playing mvds. added mini-scoreboards to splitscreen.
editor/debugger now shows asm if there's no linenumber info. also, pressing f1 for help shows the shortcuts.
Added support for .framegroups files for psk(psa) and iqm formats.
True support for ezquake's colour codes. Mutually exclusive with background colours.
path command output slightly more readable.
added support for digest_hex (MD4, SHA1, CRC16).
skingroups now colourmap correctly.
Fix terrain colour hints, and litdata from the wrong bsp.
fix ftp dual-homed issue. support epsv command, and enable ipv6 (eprt still not supported).
remove d3d11 compilation from the makefile. the required headers are not provided by mingw, and are not available to the build bot, so don't bother.
fix v *= v.x and similar opcodes.
fteqcc: fixed support for áéÃóú type chars in names. utf-8 files now properly supported (even with the utf-8 bom/identifier). utf-16 also supported.
fteqcc: fixed '#if 1 == 3 && 4' parsing.
fteqcc: -Werror acts on the warning, rather than as a separate error. Line numbers are thus more readable.
fteqcc: copyright message now includes compile date instead.
fteqccgui: the treeview control is now coloured depending on whether there were warnings/errors in the last compile.
fteqccgui: the output window is now focused and scrolls down as compilation progresses.
pr_dumpplatform command dumps out some pragmas to convert more serious warnings to errors. This is to avoid the infamous 'fteqcc sucks cos my code sucks' issue.
rewrote prespawn/modelist/soundlist code. server tracks progress now.
------------------------------------------------------------------------
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4167 fc73d0e0-1445-4013-8a0c-d673dee63da5
2013-03-12 22:29:40 +00:00
e = QCC_PR_Term ( 0 ) ;
2004-08-23 01:38:21 +00:00
if ( e - > constant )
QCC_PR_ParseWarning ( WARN_ASSIGNMENTTOCONSTANT , " Assignment to constant %s " , e - > name ) ;
2004-11-16 04:43:12 +00:00
if ( e - > temp )
QCC_PR_ParseWarning ( WARN_ASSIGNMENTTOCONSTANT , " Hey! That's a temp! ++ operators cannot work on temps! " ) ;
2004-08-23 01:38:21 +00:00
switch ( e - > type - > type )
{
case ev_integer :
2011-10-03 02:45:44 +00:00
QCC_PR_Statement3 ( & pr_opcodes [ OP_ADD_I ] , e , QCC_MakeIntConst ( 1 ) , e , false ) ;
2004-08-23 01:38:21 +00:00
break ;
case ev_float :
2011-10-03 02:45:44 +00:00
QCC_PR_Statement3 ( & pr_opcodes [ OP_ADD_F ] , e , QCC_MakeFloatConst ( 1 ) , e , false ) ;
2004-08-23 01:38:21 +00:00
break ;
default :
QCC_PR_ParseError ( ERR_BADPLUSPLUSOPERATOR , " ++ operator on unsupported type " ) ;
break ;
}
return e ;
}
2005-03-20 02:57:11 +00:00
else if ( QCC_PR_CheckToken ( " -- " ) )
2004-08-23 01:38:21 +00:00
{
qcc_usefulstatement = true ;
------------------------------------------------------------------------
r4169 | acceptthis | 2013-01-17 08:55:12 +0000 (Thu, 17 Jan 2013) | 31 lines
removed MAX_VISEDICTS limit.
PEXT2_REPLACEMENTDELTAS tweaked, now has 4 million entity limit. still not enabled by default.
TE_BEAM now maps to a separate TEQW_BEAM to avoid conflicts with QW.
added android multitouch emulation for windows/rawinput (in_simulatemultitouch).
split topcolor/bottomcolor from scoreboard, for dp's colormap|1024 feature.
now using utf-8 for windows consoles.
qcc warnings/errors now give clickable console links for quick+easy editing.
disabled menutint when the currently active item changes contrast or gamma (for OneManClan).
Added support for drawfont/drawfontscale.
tweaked the qcvm a little to reduce the number of pointers.
.doll file loading. still experimental and will likely crash. requires csqc active, even if its a dummy progs. this will be fixed in time. Still other things that need cleaning up.
windows: gl_font "?" shows the standard windows font-selection dialog, and can be used to select windows fonts. not all work. and you probably don't want to use windings.
fixed splitscreen support when playing mvds. added mini-scoreboards to splitscreen.
editor/debugger now shows asm if there's no linenumber info. also, pressing f1 for help shows the shortcuts.
Added support for .framegroups files for psk(psa) and iqm formats.
True support for ezquake's colour codes. Mutually exclusive with background colours.
path command output slightly more readable.
added support for digest_hex (MD4, SHA1, CRC16).
skingroups now colourmap correctly.
Fix terrain colour hints, and litdata from the wrong bsp.
fix ftp dual-homed issue. support epsv command, and enable ipv6 (eprt still not supported).
remove d3d11 compilation from the makefile. the required headers are not provided by mingw, and are not available to the build bot, so don't bother.
fix v *= v.x and similar opcodes.
fteqcc: fixed support for áéÃóú type chars in names. utf-8 files now properly supported (even with the utf-8 bom/identifier). utf-16 also supported.
fteqcc: fixed '#if 1 == 3 && 4' parsing.
fteqcc: -Werror acts on the warning, rather than as a separate error. Line numbers are thus more readable.
fteqcc: copyright message now includes compile date instead.
fteqccgui: the treeview control is now coloured depending on whether there were warnings/errors in the last compile.
fteqccgui: the output window is now focused and scrolls down as compilation progresses.
pr_dumpplatform command dumps out some pragmas to convert more serious warnings to errors. This is to avoid the infamous 'fteqcc sucks cos my code sucks' issue.
rewrote prespawn/modelist/soundlist code. server tracks progress now.
------------------------------------------------------------------------
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4167 fc73d0e0-1445-4013-8a0c-d673dee63da5
2013-03-12 22:29:40 +00:00
e = QCC_PR_Term ( 0 ) ;
2004-08-23 01:38:21 +00:00
if ( e - > constant )
QCC_PR_ParseWarning ( WARN_ASSIGNMENTTOCONSTANT , " Assignment to constant %s " , e - > name ) ;
2004-11-16 04:43:12 +00:00
if ( e - > temp )
QCC_PR_ParseWarning ( WARN_ASSIGNMENTTOCONSTANT , " Hey! That's a temp! -- operators cannot work on temps! " ) ;
2004-08-23 01:38:21 +00:00
switch ( e - > type - > type )
{
case ev_integer :
2011-10-03 02:45:44 +00:00
QCC_PR_Statement3 ( & pr_opcodes [ OP_SUB_I ] , e , QCC_MakeIntConst ( 1 ) , e , false ) ;
2004-08-23 01:38:21 +00:00
break ;
case ev_float :
2011-10-03 02:45:44 +00:00
QCC_PR_Statement3 ( & pr_opcodes [ OP_SUB_F ] , e , QCC_MakeFloatConst ( 1 ) , e , false ) ;
2004-08-23 01:38:21 +00:00
break ;
default :
QCC_PR_ParseError ( ERR_BADPLUSPLUSOPERATOR , " -- operator on unsupported type " ) ;
break ;
}
return e ;
}
2011-05-15 13:23:13 +00:00
2005-03-20 02:57:11 +00:00
if ( QCC_PR_CheckToken ( " ! " ) )
2004-08-23 01:38:21 +00:00
{
2009-07-03 19:02:42 +00:00
e = QCC_PR_Expression ( NOT_PRIORITY , EXPR_DISALLOW_COMMA | EXPR_WARN_ABOVE_1 ) ;
2004-08-23 01:38:21 +00:00
t = e - > type - > type ;
if ( t = = ev_float )
e2 = QCC_PR_Statement ( & pr_opcodes [ OP_NOT_F ] , e , 0 , NULL ) ;
else if ( t = = ev_string )
e2 = QCC_PR_Statement ( & pr_opcodes [ OP_NOT_S ] , e , 0 , NULL ) ;
else if ( t = = ev_entity )
e2 = QCC_PR_Statement ( & pr_opcodes [ OP_NOT_ENT ] , e , 0 , NULL ) ;
else if ( t = = ev_vector )
e2 = QCC_PR_Statement ( & pr_opcodes [ OP_NOT_V ] , e , 0 , NULL ) ;
else if ( t = = ev_function )
e2 = QCC_PR_Statement ( & pr_opcodes [ OP_NOT_FNC ] , e , 0 , NULL ) ;
else if ( t = = ev_integer )
e2 = QCC_PR_Statement ( & pr_opcodes [ OP_NOT_FNC ] , e , 0 , NULL ) ; //functions are integer values too.
else if ( t = = ev_pointer )
e2 = QCC_PR_Statement ( & pr_opcodes [ OP_NOT_FNC ] , e , 0 , NULL ) ; //Pointers are too.
else
{
e2 = NULL ; // shut up compiler warning;
QCC_PR_ParseError ( ERR_BADNOTTYPE , " type mismatch for ! " ) ;
}
return e2 ;
}
------------------------------------------------------------------------
r4169 | acceptthis | 2013-01-17 08:55:12 +0000 (Thu, 17 Jan 2013) | 31 lines
removed MAX_VISEDICTS limit.
PEXT2_REPLACEMENTDELTAS tweaked, now has 4 million entity limit. still not enabled by default.
TE_BEAM now maps to a separate TEQW_BEAM to avoid conflicts with QW.
added android multitouch emulation for windows/rawinput (in_simulatemultitouch).
split topcolor/bottomcolor from scoreboard, for dp's colormap|1024 feature.
now using utf-8 for windows consoles.
qcc warnings/errors now give clickable console links for quick+easy editing.
disabled menutint when the currently active item changes contrast or gamma (for OneManClan).
Added support for drawfont/drawfontscale.
tweaked the qcvm a little to reduce the number of pointers.
.doll file loading. still experimental and will likely crash. requires csqc active, even if its a dummy progs. this will be fixed in time. Still other things that need cleaning up.
windows: gl_font "?" shows the standard windows font-selection dialog, and can be used to select windows fonts. not all work. and you probably don't want to use windings.
fixed splitscreen support when playing mvds. added mini-scoreboards to splitscreen.
editor/debugger now shows asm if there's no linenumber info. also, pressing f1 for help shows the shortcuts.
Added support for .framegroups files for psk(psa) and iqm formats.
True support for ezquake's colour codes. Mutually exclusive with background colours.
path command output slightly more readable.
added support for digest_hex (MD4, SHA1, CRC16).
skingroups now colourmap correctly.
Fix terrain colour hints, and litdata from the wrong bsp.
fix ftp dual-homed issue. support epsv command, and enable ipv6 (eprt still not supported).
remove d3d11 compilation from the makefile. the required headers are not provided by mingw, and are not available to the build bot, so don't bother.
fix v *= v.x and similar opcodes.
fteqcc: fixed support for áéÃóú type chars in names. utf-8 files now properly supported (even with the utf-8 bom/identifier). utf-16 also supported.
fteqcc: fixed '#if 1 == 3 && 4' parsing.
fteqcc: -Werror acts on the warning, rather than as a separate error. Line numbers are thus more readable.
fteqcc: copyright message now includes compile date instead.
fteqccgui: the treeview control is now coloured depending on whether there were warnings/errors in the last compile.
fteqccgui: the output window is now focused and scrolls down as compilation progresses.
pr_dumpplatform command dumps out some pragmas to convert more serious warnings to errors. This is to avoid the infamous 'fteqcc sucks cos my code sucks' issue.
rewrote prespawn/modelist/soundlist code. server tracks progress now.
------------------------------------------------------------------------
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4167 fc73d0e0-1445-4013-8a0c-d673dee63da5
2013-03-12 22:29:40 +00:00
else if ( QCC_PR_CheckToken ( " ~ " ) )
{
e = QCC_PR_Expression ( NOT_PRIORITY , EXPR_DISALLOW_COMMA | EXPR_WARN_ABOVE_1 ) ;
t = e - > type - > type ;
if ( t = = ev_float )
e2 = QCC_PR_Statement ( & pr_opcodes [ OP_BINARYNOT_F ] , e , 0 , NULL ) ;
else if ( t = = ev_integer )
e2 = QCC_PR_Statement ( & pr_opcodes [ OP_BINARYNOT_I ] , e , 0 , NULL ) ; //functions are integer values too.
else
{
e2 = NULL ; // shut up compiler warning;
QCC_PR_ParseError ( ERR_BADNOTTYPE , " type mismatch for binary not " ) ;
}
return e2 ;
}
2005-03-20 02:57:11 +00:00
else if ( QCC_PR_CheckToken ( " & " ) )
2004-08-23 01:38:21 +00:00
{
2004-11-04 04:19:10 +00:00
int st = numstatements ;
2011-09-03 03:49:43 +00:00
e = QCC_PR_Expression ( UNARY_PRIORITY , EXPR_DISALLOW_COMMA ) ;
2004-08-23 01:38:21 +00:00
t = e - > type - > type ;
2004-11-04 04:19:10 +00:00
if ( st ! = numstatements )
//woo, something like ent.field?
{
2011-09-03 03:49:43 +00:00
if ( ( OP_LOAD_F < = statements [ numstatements - 1 ] . op & & statements [ numstatements - 1 ] . op < = OP_LOAD_FNC ) | | statements [ numstatements - 1 ] . op = = OP_LOAD_I | | statements [ numstatements - 1 ] . op = = OP_LOAD_P )
2004-11-04 04:19:10 +00:00
{
2004-11-13 17:18:34 +00:00
statements [ numstatements - 1 ] . op = OP_ADDRESS ;
2004-11-04 04:19:10 +00:00
e - > type = QCC_PR_PointerType ( e - > type ) ;
return e ;
}
2011-09-03 03:49:43 +00:00
else if ( OP_LOADA_F < = statements [ numstatements - 1 ] . op & & statements [ numstatements - 1 ] . op < = OP_LOADA_I )
{
statements [ numstatements - 1 ] . op = OP_GLOBALADDRESS ;
e - > type = QCC_PR_PointerType ( e - > type ) ;
return e ;
}
else if ( OP_LOADP_F < = statements [ numstatements - 1 ] . op & & statements [ numstatements - 1 ] . op < = OP_LOADP_I )
{
statements [ numstatements - 1 ] . op = OP_POINTER_ADD ;
e - > type = QCC_PR_PointerType ( e - > type ) ;
return e ;
}
2004-11-04 04:19:10 +00:00
else //this is a restriction that could be lifted, I just want to make sure that I got all the bits first.
{
QCC_PR_ParseError ( ERR_BADNOTTYPE , " type mismatch for '&' Must be singular expression or field reference " ) ;
return e ;
}
}
// QCC_PR_ParseWarning(0, "debug: &global");
2004-11-13 17:18:34 +00:00
if ( ! QCC_OPCodeValid ( & pr_opcodes [ OP_GLOBALADDRESS ] ) )
QCC_PR_ParseError ( ERR_BADEXTENSION , " Cannot use addressof operator ('&') on a global. Please use the FTE target. " ) ;
2004-08-23 01:38:21 +00:00
e2 = QCC_PR_Statement ( & pr_opcodes [ OP_GLOBALADDRESS ] , e , 0 , NULL ) ;
2004-11-04 04:19:10 +00:00
e2 - > type = QCC_PR_PointerType ( e - > type ) ;
2004-08-23 01:38:21 +00:00
return e2 ;
}
2005-03-20 02:57:11 +00:00
else if ( QCC_PR_CheckToken ( " * " ) )
2004-11-13 17:18:34 +00:00
{
2011-09-03 03:49:43 +00:00
e = QCC_PR_Expression ( UNARY_PRIORITY , EXPR_DISALLOW_COMMA ) ;
2004-11-13 17:18:34 +00:00
t = e - > type - > type ;
2012-02-13 09:24:01 +00:00
if ( t = = ev_string )
e2 = QCC_PR_Statement ( & pr_opcodes [ OP_LOADP_C ] , e , QCC_MakeFloatConst ( 0 ) , NULL ) ;
else if ( t = = ev_pointer )
2004-11-13 17:18:34 +00:00
{
2012-02-13 09:24:01 +00:00
switch ( e - > type - > aux_type - > type )
{
case ev_float :
e2 = QCC_PR_Statement ( & pr_opcodes [ OP_LOADP_F ] , e , 0 , NULL ) ;
break ;
case ev_string :
e2 = QCC_PR_Statement ( & pr_opcodes [ OP_LOADP_S ] , e , 0 , NULL ) ;
break ;
case ev_vector :
e2 = QCC_PR_Statement ( & pr_opcodes [ OP_LOADP_V ] , e , 0 , NULL ) ;
break ;
case ev_entity :
e2 = QCC_PR_Statement ( & pr_opcodes [ OP_LOADP_ENT ] , e , 0 , NULL ) ;
break ;
case ev_field :
e2 = QCC_PR_Statement ( & pr_opcodes [ OP_LOADP_FLD ] , e , 0 , NULL ) ;
break ;
case ev_function :
e2 = QCC_PR_Statement ( & pr_opcodes [ OP_LOADP_FLD ] , e , 0 , NULL ) ;
break ;
case ev_integer :
e2 = QCC_PR_Statement ( & pr_opcodes [ OP_LOADP_I ] , e , 0 , NULL ) ;
break ;
case ev_pointer :
e2 = QCC_PR_Statement ( & pr_opcodes [ OP_LOADP_I ] , e , 0 , NULL ) ;
break ;
2004-11-13 17:18:34 +00:00
2012-02-13 09:24:01 +00:00
default :
QCC_PR_ParseError ( ERR_BADNOTTYPE , " type mismatch for * (unrecognised type) " ) ;
e2 = NULL ;
break ;
}
e2 - > type = e - > type - > aux_type ;
2004-11-13 17:18:34 +00:00
}
2012-02-13 09:24:01 +00:00
else
2013-03-12 22:47:42 +00:00
{
e2 = NULL ;
2012-02-13 09:24:01 +00:00
QCC_PR_ParseError ( ERR_BADNOTTYPE , " type mismatch for * " ) ;
2013-03-12 22:47:42 +00:00
}
2004-11-13 17:18:34 +00:00
return e2 ;
}
2005-03-20 02:57:11 +00:00
else if ( QCC_PR_CheckToken ( " - " ) )
2004-12-03 16:08:43 +00:00
{
2011-09-03 03:49:43 +00:00
e = QCC_PR_Expression ( UNARY_PRIORITY , EXPR_DISALLOW_COMMA ) ;
2004-12-03 16:08:43 +00:00
2004-12-09 23:45:57 +00:00
switch ( e - > type - > type )
2004-12-03 16:08:43 +00:00
{
case ev_float :
2011-10-03 02:45:44 +00:00
e2 = QCC_PR_Statement ( & pr_opcodes [ OP_SUB_F ] , QCC_MakeFloatConst ( 0 ) , e , NULL ) ;
2004-12-03 16:08:43 +00:00
break ;
2009-07-05 21:44:17 +00:00
case ev_vector :
2011-10-03 02:45:44 +00:00
e2 = QCC_PR_Statement ( & pr_opcodes [ OP_SUB_V ] , QCC_MakeVectorConst ( 0 , 0 , 0 ) , e , NULL ) ;
2009-07-05 21:44:17 +00:00
break ;
2004-12-03 16:08:43 +00:00
case ev_integer :
2011-10-03 02:45:44 +00:00
e2 = QCC_PR_Statement ( & pr_opcodes [ OP_SUB_I ] , QCC_MakeIntConst ( 0 ) , e , NULL ) ;
2004-12-03 16:08:43 +00:00
break ;
default :
QCC_PR_ParseError ( ERR_BADNOTTYPE , " type mismatch for - " ) ;
2005-01-16 02:28:09 +00:00
e2 = NULL ;
2004-12-03 16:08:43 +00:00
break ;
}
return e2 ;
}
2005-03-20 02:57:11 +00:00
else if ( QCC_PR_CheckToken ( " + " ) )
2004-12-03 16:08:43 +00:00
{
2011-09-03 03:49:43 +00:00
e = QCC_PR_Expression ( UNARY_PRIORITY , EXPR_DISALLOW_COMMA ) ;
2004-12-03 16:08:43 +00:00
2004-12-09 23:45:57 +00:00
switch ( e - > type - > type )
2004-12-03 16:08:43 +00:00
{
case ev_float :
2009-07-09 18:31:43 +00:00
e2 = e ;
2009-07-05 21:44:17 +00:00
break ;
case ev_vector :
2009-07-09 18:31:43 +00:00
e2 = e ;
2004-12-03 16:08:43 +00:00
break ;
case ev_integer :
2009-07-09 18:31:43 +00:00
e2 = e ;
2004-12-03 16:08:43 +00:00
break ;
default :
QCC_PR_ParseError ( ERR_BADNOTTYPE , " type mismatch for + " ) ;
2005-01-16 02:28:09 +00:00
e2 = NULL ;
2004-12-03 16:08:43 +00:00
break ;
}
return e2 ;
}
2011-05-15 13:23:13 +00:00
2005-03-20 02:57:11 +00:00
if ( QCC_PR_CheckToken ( " ( " ) )
2004-08-23 01:38:21 +00:00
{
2011-09-03 03:49:43 +00:00
QCC_type_t * newtype ;
newtype = QCC_PR_ParseType ( false , true ) ;
if ( newtype )
{
QCC_PR_Expect ( " ) " ) ;
e = QCC_PR_Expression ( UNARY_PRIORITY , EXPR_DISALLOW_COMMA ) ;
2012-01-17 07:57:46 +00:00
/*you may cast from a type to itself*/
if ( ! typecmp ( e - > type , newtype ) )
{
}
2011-09-03 03:49:43 +00:00
/*you may cast from const 0 to any type of same size for free (from either int or float for simplicity)*/
2012-01-17 07:57:46 +00:00
else if ( newtype - > size = = e - > type - > size & & ( e - > type - > type = = ev_integer | | e - > type - > type = = ev_float ) & & e - > constant & & ! G_INT ( e - > ofs ) )
2011-09-03 03:49:43 +00:00
{
2012-01-28 10:30:44 +00:00
//direct cast
e2 = ( void * ) qccHunkAlloc ( sizeof ( QCC_def_t ) ) ;
memset ( e2 , 0 , sizeof ( QCC_def_t ) ) ;
e2 - > type = newtype ;
e2 - > ofs = e - > ofs ;
e2 - > constant = true ;
e2 - > temp = e - > temp ;
return e2 ;
2011-09-03 03:49:43 +00:00
}
/*cast from int->float will convert*/
else if ( newtype - > type = = ev_float & & e - > type - > type = = ev_integer )
return QCC_PR_Statement ( & pr_opcodes [ OP_CONV_ITOF ] , e , 0 , NULL ) ;
/*cast from float->int will convert*/
else if ( newtype - > type = = ev_integer & & e - > type - > type = = ev_float )
return QCC_PR_Statement ( & pr_opcodes [ OP_CONV_FTOI ] , e , 0 , NULL ) ;
/*you may freely cast between pointers (and ints, as this is explicit) (strings count as pointers - WARNING: some strings may not be expressable as pointers)*/
2011-10-03 02:45:44 +00:00
else if (
//pointers
( ( newtype - > type = = ev_pointer | | newtype - > type = = ev_string | | newtype - > type = = ev_integer ) & & ( e - > type - > type = = ev_pointer | | e - > type - > type = = ev_string | | e - > type - > type = = ev_integer ) )
//ents/classs
2011-12-05 15:23:40 +00:00
| | ( newtype - > type = = ev_entity & & e - > type - > type = = ev_entity )
//variants are fine too
| | ( newtype - > type = = ev_variant | | e - > type - > type = = ev_variant )
)
2011-09-03 03:49:43 +00:00
{
2011-10-03 02:45:44 +00:00
//direct cast
2011-09-03 03:49:43 +00:00
e2 = ( void * ) qccHunkAlloc ( sizeof ( QCC_def_t ) ) ;
memset ( e2 , 0 , sizeof ( QCC_def_t ) ) ;
e2 - > type = newtype ;
e2 - > ofs = e - > ofs ;
e2 - > constant = true ;
e2 - > temp = e - > temp ;
return e2 ;
}
else
QCC_PR_ParseError ( 0 , " Bad type cast \n " ) ;
}
/* else if (QCC_PR_CheckToken("*"))
2011-08-16 04:12:15 +00:00
{
QCC_PR_Expect ( " ) " ) ;
e = QCC_PR_Term ( ) ;
e2 = ( void * ) qccHunkAlloc ( sizeof ( QCC_def_t ) ) ;
memset ( e2 , 0 , sizeof ( QCC_def_t ) ) ;
e2 - > type = type_pointer ;
e2 - > ofs = e - > ofs ;
e2 - > constant = true ;
e2 - > temp = e - > temp ;
return e2 ;
}
else if ( QCC_PR_CheckKeyword ( keyword_float , " float " ) ) //check for type casts
2004-08-23 01:38:21 +00:00
{
QCC_PR_Expect ( " ) " ) ;
e = QCC_PR_Term ( ) ;
if ( e - > type - > type = = ev_float )
return e ;
else if ( e - > type - > type = = ev_integer )
return QCC_PR_Statement ( & pr_opcodes [ OP_CONV_ITOF ] , e , 0 , NULL ) ;
else if ( e - > type - > type = = ev_function )
return e ;
// else
// QCC_PR_ParseError ("invalid typecast");
QCC_PR_ParseWarning ( 0 , " Not all vars make sence as floats " ) ;
e2 = ( void * ) qccHunkAlloc ( sizeof ( QCC_def_t ) ) ;
2011-05-15 13:23:13 +00:00
memset ( e2 , 0 , sizeof ( QCC_def_t ) ) ;
2004-08-23 01:38:21 +00:00
e2 - > type = type_float ;
e2 - > ofs = e - > ofs ;
e2 - > constant = true ;
e2 - > temp = e - > temp ;
return e2 ;
}
2005-03-20 02:57:11 +00:00
else if ( QCC_PR_CheckKeyword ( keyword_class , " class " ) )
2004-08-23 01:38:21 +00:00
{
QCC_type_t * classtype = QCC_TypeForName ( QCC_PR_ParseName ( ) ) ;
if ( ! classtype )
QCC_PR_ParseError ( ERR_NOTANAME , " Class not defined for cast " ) ;
QCC_PR_Expect ( " ) " ) ;
e = QCC_PR_Term ( ) ;
e2 = ( void * ) qccHunkAlloc ( sizeof ( QCC_def_t ) ) ;
2011-05-15 13:23:13 +00:00
memset ( e2 , 0 , sizeof ( QCC_def_t ) ) ;
2004-08-23 01:38:21 +00:00
e2 - > type = classtype ;
e2 - > ofs = e - > ofs ;
e2 - > constant = true ;
e2 - > temp = e - > temp ;
return e2 ;
}
2005-03-20 02:57:11 +00:00
else if ( QCC_PR_CheckKeyword ( keyword_integer , " integer " ) ) //check for type casts
2004-08-23 01:38:21 +00:00
{
QCC_PR_Expect ( " ) " ) ;
e = QCC_PR_Term ( ) ;
if ( e - > type - > type = = ev_integer )
return e ;
else if ( e - > type - > type = = ev_float )
return QCC_PR_Statement ( & pr_opcodes [ OP_CONV_FTOI ] , e , 0 , NULL ) ;
else
QCC_PR_ParseError ( ERR_BADTYPECAST , " invalid typecast " ) ;
}
2005-03-20 02:57:11 +00:00
else if ( QCC_PR_CheckKeyword ( keyword_int , " int " ) ) //check for type casts
2004-08-23 01:38:21 +00:00
{
QCC_PR_Expect ( " ) " ) ;
e = QCC_PR_Term ( ) ;
if ( e - > type - > type = = ev_integer )
return e ;
else if ( e - > type - > type = = ev_float )
return QCC_PR_Statement ( & pr_opcodes [ OP_CONV_FTOI ] , e , 0 , NULL ) ;
else
QCC_PR_ParseError ( ERR_BADTYPECAST , " invalid typecast " ) ;
}
2011-09-03 03:49:43 +00:00
*/ else
2004-08-23 01:38:21 +00:00
{
2004-11-29 21:08:02 +00:00
pbool oldcond = conditional ;
conditional = conditional ? 2 : 0 ;
2009-07-03 19:02:42 +00:00
e = QCC_PR_Expression ( TOP_PRIORITY , 0 ) ;
2004-08-23 01:38:21 +00:00
QCC_PR_Expect ( " ) " ) ;
2004-11-29 21:08:02 +00:00
conditional = oldcond ;
2004-08-23 01:38:21 +00:00
}
return e ;
}
}
------------------------------------------------------------------------
r4169 | acceptthis | 2013-01-17 08:55:12 +0000 (Thu, 17 Jan 2013) | 31 lines
removed MAX_VISEDICTS limit.
PEXT2_REPLACEMENTDELTAS tweaked, now has 4 million entity limit. still not enabled by default.
TE_BEAM now maps to a separate TEQW_BEAM to avoid conflicts with QW.
added android multitouch emulation for windows/rawinput (in_simulatemultitouch).
split topcolor/bottomcolor from scoreboard, for dp's colormap|1024 feature.
now using utf-8 for windows consoles.
qcc warnings/errors now give clickable console links for quick+easy editing.
disabled menutint when the currently active item changes contrast or gamma (for OneManClan).
Added support for drawfont/drawfontscale.
tweaked the qcvm a little to reduce the number of pointers.
.doll file loading. still experimental and will likely crash. requires csqc active, even if its a dummy progs. this will be fixed in time. Still other things that need cleaning up.
windows: gl_font "?" shows the standard windows font-selection dialog, and can be used to select windows fonts. not all work. and you probably don't want to use windings.
fixed splitscreen support when playing mvds. added mini-scoreboards to splitscreen.
editor/debugger now shows asm if there's no linenumber info. also, pressing f1 for help shows the shortcuts.
Added support for .framegroups files for psk(psa) and iqm formats.
True support for ezquake's colour codes. Mutually exclusive with background colours.
path command output slightly more readable.
added support for digest_hex (MD4, SHA1, CRC16).
skingroups now colourmap correctly.
Fix terrain colour hints, and litdata from the wrong bsp.
fix ftp dual-homed issue. support epsv command, and enable ipv6 (eprt still not supported).
remove d3d11 compilation from the makefile. the required headers are not provided by mingw, and are not available to the build bot, so don't bother.
fix v *= v.x and similar opcodes.
fteqcc: fixed support for áéÃóú type chars in names. utf-8 files now properly supported (even with the utf-8 bom/identifier). utf-16 also supported.
fteqcc: fixed '#if 1 == 3 && 4' parsing.
fteqcc: -Werror acts on the warning, rather than as a separate error. Line numbers are thus more readable.
fteqcc: copyright message now includes compile date instead.
fteqccgui: the treeview control is now coloured depending on whether there were warnings/errors in the last compile.
fteqccgui: the output window is now focused and scrolls down as compilation progresses.
pr_dumpplatform command dumps out some pragmas to convert more serious warnings to errors. This is to avoid the infamous 'fteqcc sucks cos my code sucks' issue.
rewrote prespawn/modelist/soundlist code. server tracks progress now.
------------------------------------------------------------------------
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4167 fc73d0e0-1445-4013-8a0c-d673dee63da5
2013-03-12 22:29:40 +00:00
return QCC_PR_ParseValue ( pr_classtype , ! ( exprflags & EXPR_DISALLOW_ARRAYASSIGN ) ) ;
2004-08-23 01:38:21 +00:00
}
int QCC_canConv ( QCC_def_t * from , etype_t to )
{
if ( from - > type - > type = = to )
return 0 ;
if ( from - > type - > type = = ev_vector & & to = = ev_float )
return 4 ;
if ( pr_classtype )
{
if ( from - > type - > type = = ev_field )
{
if ( from - > type - > aux_type - > type = = to )
return 1 ;
}
}
2011-05-15 13:23:13 +00:00
2011-10-27 16:16:29 +00:00
if ( from - > type - > type = = ev_variant )
2011-11-08 06:00:35 +00:00
return 3 ;
2011-10-27 16:16:29 +00:00
2004-08-23 01:38:21 +00:00
/* if (from->type->type == ev_pointer && from->type->aux_type->type == to)
return 1 ;
if ( QCC_ShouldConvert ( from , to ) > = 0 )
return 1 ;
*/
2013-03-12 22:32:25 +00:00
// if (from->type->type == ev_integer && to == ev_function)
// return 1;
2004-08-23 01:38:21 +00:00
2013-03-12 22:32:25 +00:00
if ( from - > constant & & from - > arraysize = = 0 & & from - > type - > size = = ( ( to = = ev_vector ) ? 3 : 1 ) & & ( from - > type - > type = = ev_integer | | from - > type - > type = = ev_float ) & & ! G_INT ( from - > ofs ) )
2012-01-28 10:30:44 +00:00
return 2 ;
2004-08-23 01:38:21 +00:00
return - 100 ;
}
/*
= = = = = = = = = = = = = =
PR_Expression
= = = = = = = = = = = = = =
*/
2009-07-03 19:02:42 +00:00
QCC_def_t * QCC_PR_Expression ( int priority , int exprflags )
2004-08-23 01:38:21 +00:00
{
QCC_dstatement32_t * st ;
QCC_opcode_t * op , * oldop ;
QCC_opcode_t * bestop ;
int numconversions , c ;
int opnum ;
QCC_def_t * e , * e2 ;
etype_t type_a , type_b , type_c ;
if ( priority = = 0 )
------------------------------------------------------------------------
r4169 | acceptthis | 2013-01-17 08:55:12 +0000 (Thu, 17 Jan 2013) | 31 lines
removed MAX_VISEDICTS limit.
PEXT2_REPLACEMENTDELTAS tweaked, now has 4 million entity limit. still not enabled by default.
TE_BEAM now maps to a separate TEQW_BEAM to avoid conflicts with QW.
added android multitouch emulation for windows/rawinput (in_simulatemultitouch).
split topcolor/bottomcolor from scoreboard, for dp's colormap|1024 feature.
now using utf-8 for windows consoles.
qcc warnings/errors now give clickable console links for quick+easy editing.
disabled menutint when the currently active item changes contrast or gamma (for OneManClan).
Added support for drawfont/drawfontscale.
tweaked the qcvm a little to reduce the number of pointers.
.doll file loading. still experimental and will likely crash. requires csqc active, even if its a dummy progs. this will be fixed in time. Still other things that need cleaning up.
windows: gl_font "?" shows the standard windows font-selection dialog, and can be used to select windows fonts. not all work. and you probably don't want to use windings.
fixed splitscreen support when playing mvds. added mini-scoreboards to splitscreen.
editor/debugger now shows asm if there's no linenumber info. also, pressing f1 for help shows the shortcuts.
Added support for .framegroups files for psk(psa) and iqm formats.
True support for ezquake's colour codes. Mutually exclusive with background colours.
path command output slightly more readable.
added support for digest_hex (MD4, SHA1, CRC16).
skingroups now colourmap correctly.
Fix terrain colour hints, and litdata from the wrong bsp.
fix ftp dual-homed issue. support epsv command, and enable ipv6 (eprt still not supported).
remove d3d11 compilation from the makefile. the required headers are not provided by mingw, and are not available to the build bot, so don't bother.
fix v *= v.x and similar opcodes.
fteqcc: fixed support for áéÃóú type chars in names. utf-8 files now properly supported (even with the utf-8 bom/identifier). utf-16 also supported.
fteqcc: fixed '#if 1 == 3 && 4' parsing.
fteqcc: -Werror acts on the warning, rather than as a separate error. Line numbers are thus more readable.
fteqcc: copyright message now includes compile date instead.
fteqccgui: the treeview control is now coloured depending on whether there were warnings/errors in the last compile.
fteqccgui: the output window is now focused and scrolls down as compilation progresses.
pr_dumpplatform command dumps out some pragmas to convert more serious warnings to errors. This is to avoid the infamous 'fteqcc sucks cos my code sucks' issue.
rewrote prespawn/modelist/soundlist code. server tracks progress now.
------------------------------------------------------------------------
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4167 fc73d0e0-1445-4013-8a0c-d673dee63da5
2013-03-12 22:29:40 +00:00
return QCC_PR_Term ( exprflags ) ;
2004-08-23 01:38:21 +00:00
2009-07-03 19:02:42 +00:00
e = QCC_PR_Expression ( priority - 1 , exprflags ) ;
2004-08-23 01:38:21 +00:00
while ( 1 )
{
2011-09-03 03:49:43 +00:00
if ( priority = = FUNC_PRIORITY )
2004-08-23 01:38:21 +00:00
{
2006-03-01 18:53:31 +00:00
if ( QCC_PR_CheckToken ( " ( " ) )
{
qcc_usefulstatement = true ;
2009-07-05 21:44:17 +00:00
e = QCC_PR_ParseFunctionCall ( e ) ;
2006-03-01 18:53:31 +00:00
}
if ( QCC_PR_CheckToken ( " ? " ) )
{
QCC_dstatement32_t * fromj , * elsej ;
2011-07-08 18:59:48 +00:00
QCC_FreeTemp ( QCC_PR_Statement ( & pr_opcodes [ OP_IFNOT_I ] , e , NULL , & fromj ) ) ;
2009-07-03 19:02:42 +00:00
e = QCC_PR_Expression ( TOP_PRIORITY , 0 ) ;
2006-03-01 18:53:31 +00:00
e2 = QCC_GetTemp ( e - > type ) ;
------------------------------------------------------------------------
r4169 | acceptthis | 2013-01-17 08:55:12 +0000 (Thu, 17 Jan 2013) | 31 lines
removed MAX_VISEDICTS limit.
PEXT2_REPLACEMENTDELTAS tweaked, now has 4 million entity limit. still not enabled by default.
TE_BEAM now maps to a separate TEQW_BEAM to avoid conflicts with QW.
added android multitouch emulation for windows/rawinput (in_simulatemultitouch).
split topcolor/bottomcolor from scoreboard, for dp's colormap|1024 feature.
now using utf-8 for windows consoles.
qcc warnings/errors now give clickable console links for quick+easy editing.
disabled menutint when the currently active item changes contrast or gamma (for OneManClan).
Added support for drawfont/drawfontscale.
tweaked the qcvm a little to reduce the number of pointers.
.doll file loading. still experimental and will likely crash. requires csqc active, even if its a dummy progs. this will be fixed in time. Still other things that need cleaning up.
windows: gl_font "?" shows the standard windows font-selection dialog, and can be used to select windows fonts. not all work. and you probably don't want to use windings.
fixed splitscreen support when playing mvds. added mini-scoreboards to splitscreen.
editor/debugger now shows asm if there's no linenumber info. also, pressing f1 for help shows the shortcuts.
Added support for .framegroups files for psk(psa) and iqm formats.
True support for ezquake's colour codes. Mutually exclusive with background colours.
path command output slightly more readable.
added support for digest_hex (MD4, SHA1, CRC16).
skingroups now colourmap correctly.
Fix terrain colour hints, and litdata from the wrong bsp.
fix ftp dual-homed issue. support epsv command, and enable ipv6 (eprt still not supported).
remove d3d11 compilation from the makefile. the required headers are not provided by mingw, and are not available to the build bot, so don't bother.
fix v *= v.x and similar opcodes.
fteqcc: fixed support for áéÃóú type chars in names. utf-8 files now properly supported (even with the utf-8 bom/identifier). utf-16 also supported.
fteqcc: fixed '#if 1 == 3 && 4' parsing.
fteqcc: -Werror acts on the warning, rather than as a separate error. Line numbers are thus more readable.
fteqcc: copyright message now includes compile date instead.
fteqccgui: the treeview control is now coloured depending on whether there were warnings/errors in the last compile.
fteqccgui: the output window is now focused and scrolls down as compilation progresses.
pr_dumpplatform command dumps out some pragmas to convert more serious warnings to errors. This is to avoid the infamous 'fteqcc sucks cos my code sucks' issue.
rewrote prespawn/modelist/soundlist code. server tracks progress now.
------------------------------------------------------------------------
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4167 fc73d0e0-1445-4013-8a0c-d673dee63da5
2013-03-12 22:29:40 +00:00
QCC_FreeTemp ( QCC_PR_Statement ( & pr_opcodes [ ( e2 - > type - > size > = 3 ) ? OP_STORE_V : OP_STORE_F ] , e , e2 , ( QCC_dstatement_t * * ) 0xffffffff ) ) ;
2009-07-03 19:02:42 +00:00
//e2 can be stomped upon until its reused anyway
QCC_UnFreeTemp ( e2 ) ;
2006-02-28 22:55:07 +00:00
2006-03-01 18:53:31 +00:00
QCC_PR_Expect ( " : " ) ;
QCC_PR_Statement ( & pr_opcodes [ OP_GOTO ] , NULL , NULL , & elsej ) ;
fromj - > b = & statements [ numstatements ] - fromj ;
2009-07-03 19:02:42 +00:00
e = QCC_PR_Expression ( TOP_PRIORITY , 0 ) ;
2006-02-28 22:55:07 +00:00
2006-03-01 18:53:31 +00:00
if ( typecmp ( e - > type , e2 - > type ) ! = 0 )
QCC_PR_ParseError ( 0 , " Ternary operator with mismatching types \n " ) ;
------------------------------------------------------------------------
r4169 | acceptthis | 2013-01-17 08:55:12 +0000 (Thu, 17 Jan 2013) | 31 lines
removed MAX_VISEDICTS limit.
PEXT2_REPLACEMENTDELTAS tweaked, now has 4 million entity limit. still not enabled by default.
TE_BEAM now maps to a separate TEQW_BEAM to avoid conflicts with QW.
added android multitouch emulation for windows/rawinput (in_simulatemultitouch).
split topcolor/bottomcolor from scoreboard, for dp's colormap|1024 feature.
now using utf-8 for windows consoles.
qcc warnings/errors now give clickable console links for quick+easy editing.
disabled menutint when the currently active item changes contrast or gamma (for OneManClan).
Added support for drawfont/drawfontscale.
tweaked the qcvm a little to reduce the number of pointers.
.doll file loading. still experimental and will likely crash. requires csqc active, even if its a dummy progs. this will be fixed in time. Still other things that need cleaning up.
windows: gl_font "?" shows the standard windows font-selection dialog, and can be used to select windows fonts. not all work. and you probably don't want to use windings.
fixed splitscreen support when playing mvds. added mini-scoreboards to splitscreen.
editor/debugger now shows asm if there's no linenumber info. also, pressing f1 for help shows the shortcuts.
Added support for .framegroups files for psk(psa) and iqm formats.
True support for ezquake's colour codes. Mutually exclusive with background colours.
path command output slightly more readable.
added support for digest_hex (MD4, SHA1, CRC16).
skingroups now colourmap correctly.
Fix terrain colour hints, and litdata from the wrong bsp.
fix ftp dual-homed issue. support epsv command, and enable ipv6 (eprt still not supported).
remove d3d11 compilation from the makefile. the required headers are not provided by mingw, and are not available to the build bot, so don't bother.
fix v *= v.x and similar opcodes.
fteqcc: fixed support for áéÃóú type chars in names. utf-8 files now properly supported (even with the utf-8 bom/identifier). utf-16 also supported.
fteqcc: fixed '#if 1 == 3 && 4' parsing.
fteqcc: -Werror acts on the warning, rather than as a separate error. Line numbers are thus more readable.
fteqcc: copyright message now includes compile date instead.
fteqccgui: the treeview control is now coloured depending on whether there were warnings/errors in the last compile.
fteqccgui: the output window is now focused and scrolls down as compilation progresses.
pr_dumpplatform command dumps out some pragmas to convert more serious warnings to errors. This is to avoid the infamous 'fteqcc sucks cos my code sucks' issue.
rewrote prespawn/modelist/soundlist code. server tracks progress now.
------------------------------------------------------------------------
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4167 fc73d0e0-1445-4013-8a0c-d673dee63da5
2013-03-12 22:29:40 +00:00
QCC_FreeTemp ( QCC_PR_Statement ( & pr_opcodes [ ( e2 - > type - > size > = 3 ) ? OP_STORE_V : OP_STORE_F ] , e , e2 , ( QCC_dstatement_t * * ) 0xffffffff ) ) ;
2009-07-03 19:02:42 +00:00
QCC_UnFreeTemp ( e2 ) ;
2006-02-28 22:55:07 +00:00
2006-03-01 18:53:31 +00:00
elsej - > a = & statements [ numstatements ] - elsej ;
return e2 ;
}
2006-02-28 22:55:07 +00:00
}
2004-08-23 01:38:21 +00:00
opnum = 0 ;
if ( pr_token_type = = tt_immediate )
{
2012-01-17 07:57:46 +00:00
if ( ( pr_immediate_type - > type = = ev_float & & pr_immediate . _float < 0 ) | |
( pr_immediate_type - > type = = ev_integer & & pr_immediate . _int < 0 ) ) //hehehe... was a minus all along...
2004-08-23 01:38:21 +00:00
{
QCC_PR_IncludeChunk ( pr_token , true , NULL ) ;
strcpy ( pr_token , " + " ) ; //two negatives would make a positive.
pr_token_type = tt_punct ;
}
}
if ( pr_token_type ! = tt_punct )
{
QCC_PR_ParseWarning ( WARN_UNEXPECTEDPUNCT , " Expected punctuation " ) ;
}
//go straight for the correct priority.
for ( op = opcodeprioritized [ priority ] [ opnum ] ; op ; op = opcodeprioritized [ priority ] [ + + opnum ] )
// for (op=pr_opcodes ; op->name ; op++)
{
// if (op->priority != priority)
// continue;
2005-03-20 02:57:11 +00:00
if ( ! QCC_PR_CheckToken ( op - > name ) )
2004-08-23 01:38:21 +00:00
continue ;
st = NULL ;
if ( op - > associative ! = ASSOC_LEFT )
{
// if last statement is an indirect, change it to an address of
2004-11-04 04:19:10 +00:00
if ( ! simplestore & & ( ( unsigned ) ( statements [ numstatements - 1 ] . op - OP_LOAD_F ) < 6 | | statements [ numstatements - 1 ] . op = = OP_LOAD_I | | statements [ numstatements - 1 ] . op = = OP_LOAD_P ) & & statements [ numstatements - 1 ] . c = = e - > ofs )
2004-08-23 01:38:21 +00:00
{
qcc_usefulstatement = true ;
statements [ numstatements - 1 ] . op = OP_ADDRESS ;
type_pointer - > aux_type - > type = e - > type - > type ;
e - > type = type_pointer ;
}
//if last statement retrieved a value, switch it to retrieve a usable pointer.
if ( ! simplestore & & ( unsigned ) ( statements [ numstatements - 1 ] . op - OP_LOADA_F ) < 7 ) // || statements[numstatements-1].op == OP_LOADA_C)
{
statements [ numstatements - 1 ] . op = OP_GLOBALADDRESS ;
type_pointer - > aux_type - > type = e - > type - > type ;
e - > type = type_pointer ;
}
2009-08-29 14:56:42 +00:00
if ( ! simplestore & & ( unsigned ) ( statements [ numstatements - 1 ] . op - OP_LOADP_F ) < 7 & & statements [ numstatements - 1 ] . c = = e - > ofs )
2004-08-23 01:38:21 +00:00
{
2009-08-29 14:56:42 +00:00
if ( ! statements [ numstatements - 1 ] . b )
{
//if the loadp has no offset, remove the instruction and convert the dest of this instruction directly to the pointer's load address
//this kills the add 0.
e - > ofs = statements [ numstatements - 1 ] . a ;
numstatements - - ;
}
else
{
2011-09-03 03:49:43 +00:00
statements [ numstatements - 1 ] . op = OP_POINTER_ADD ;
2012-02-13 09:24:01 +00:00
}
if ( e - > type ! = type_pointer )
{
type_pointer - > aux_type - > type = e - > type - > type ;
e - > type = type_pointer ;
2009-08-29 14:56:42 +00:00
}
2004-08-23 01:38:21 +00:00
}
if ( ! simplestore & & statements [ numstatements - 1 ] . op = = OP_LOADP_C & & e - > ofs = = statements [ numstatements - 1 ] . c )
{
statements [ numstatements - 1 ] . op = OP_ADD_SF ;
e - > type = type_string ;
//now we want to make sure that string = float can't work without it being a dereferenced pointer. (we don't want to allow storep_c without dereferece)
2009-07-03 19:02:42 +00:00
e2 = QCC_PR_Expression ( priority , exprflags ) ;
2004-08-23 01:38:21 +00:00
if ( e2 - > type - > type = = ev_float )
op = & pr_opcodes [ OP_STOREP_C ] ;
}
else
2009-07-03 19:02:42 +00:00
e2 = QCC_PR_Expression ( priority , exprflags ) ;
2004-08-23 01:38:21 +00:00
}
else
{
if ( op - > priority = = 7 & & opt_logicops )
{
optres_logicops + + ;
2004-08-26 07:00:38 +00:00
st = & statements [ numstatements ] ;
if ( * op - > name = = ' & ' ) //statement 3 because we don't want to optimise this into if from not ifnot
2011-07-08 18:59:48 +00:00
QCC_PR_Statement3 ( & pr_opcodes [ OP_IFNOT_I ] , e , NULL , NULL , false ) ;
2004-08-23 01:38:21 +00:00
else
2011-07-08 18:59:48 +00:00
QCC_PR_Statement3 ( & pr_opcodes [ OP_IF_I ] , e , NULL , NULL , false ) ;
2004-08-23 01:38:21 +00:00
}
------------------------------------------------------------------------
r4169 | acceptthis | 2013-01-17 08:55:12 +0000 (Thu, 17 Jan 2013) | 31 lines
removed MAX_VISEDICTS limit.
PEXT2_REPLACEMENTDELTAS tweaked, now has 4 million entity limit. still not enabled by default.
TE_BEAM now maps to a separate TEQW_BEAM to avoid conflicts with QW.
added android multitouch emulation for windows/rawinput (in_simulatemultitouch).
split topcolor/bottomcolor from scoreboard, for dp's colormap|1024 feature.
now using utf-8 for windows consoles.
qcc warnings/errors now give clickable console links for quick+easy editing.
disabled menutint when the currently active item changes contrast or gamma (for OneManClan).
Added support for drawfont/drawfontscale.
tweaked the qcvm a little to reduce the number of pointers.
.doll file loading. still experimental and will likely crash. requires csqc active, even if its a dummy progs. this will be fixed in time. Still other things that need cleaning up.
windows: gl_font "?" shows the standard windows font-selection dialog, and can be used to select windows fonts. not all work. and you probably don't want to use windings.
fixed splitscreen support when playing mvds. added mini-scoreboards to splitscreen.
editor/debugger now shows asm if there's no linenumber info. also, pressing f1 for help shows the shortcuts.
Added support for .framegroups files for psk(psa) and iqm formats.
True support for ezquake's colour codes. Mutually exclusive with background colours.
path command output slightly more readable.
added support for digest_hex (MD4, SHA1, CRC16).
skingroups now colourmap correctly.
Fix terrain colour hints, and litdata from the wrong bsp.
fix ftp dual-homed issue. support epsv command, and enable ipv6 (eprt still not supported).
remove d3d11 compilation from the makefile. the required headers are not provided by mingw, and are not available to the build bot, so don't bother.
fix v *= v.x and similar opcodes.
fteqcc: fixed support for áéÃóú type chars in names. utf-8 files now properly supported (even with the utf-8 bom/identifier). utf-16 also supported.
fteqcc: fixed '#if 1 == 3 && 4' parsing.
fteqcc: -Werror acts on the warning, rather than as a separate error. Line numbers are thus more readable.
fteqcc: copyright message now includes compile date instead.
fteqccgui: the treeview control is now coloured depending on whether there were warnings/errors in the last compile.
fteqccgui: the output window is now focused and scrolls down as compilation progresses.
pr_dumpplatform command dumps out some pragmas to convert more serious warnings to errors. This is to avoid the infamous 'fteqcc sucks cos my code sucks' issue.
rewrote prespawn/modelist/soundlist code. server tracks progress now.
------------------------------------------------------------------------
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4167 fc73d0e0-1445-4013-8a0c-d673dee63da5
2013-03-12 22:29:40 +00:00
e2 = QCC_PR_Expression ( priority - 1 , exprflags | EXPR_DISALLOW_ARRAYASSIGN ) ;
2004-08-23 01:38:21 +00:00
}
// type check
type_a = e - > type - > type ;
type_b = e2 - > type - > type ;
2004-11-04 04:19:10 +00:00
// if (type_a == ev_pointer && type_b == ev_pointer)
// QCC_PR_ParseWarning(0, "Debug: pointer op pointer");
2004-08-23 01:38:21 +00:00
if ( op - > name [ 0 ] = = ' . ' ) // field access gets type from field
{
if ( e2 - > type - > aux_type )
type_c = e2 - > type - > aux_type - > type ;
else
type_c = - 1 ; // not a field
}
else
type_c = ev_void ;
2011-05-15 13:23:13 +00:00
2004-08-23 01:38:21 +00:00
oldop = op ;
bestop = NULL ;
2011-05-15 13:23:13 +00:00
numconversions = 32767 ;
2004-08-23 01:38:21 +00:00
while ( op )
{
if ( ! ( type_c ! = ev_void & & type_c ! = ( * op - > type_c ) - > type ) )
{
if ( ! STRCMP ( op - > name , oldop - > name ) ) //matches
{
//return values are never converted - what to?
// if (type_c != ev_void && type_c != op->type_c->type->type)
// {
// op++;
// continue;
// }
if ( op - > associative ! = ASSOC_LEFT )
{ //assignment
if ( op - > type_a = = & type_pointer ) //ent var
{
2012-01-17 07:57:46 +00:00
/*FIXME: I don't like this code*/
2004-11-04 04:19:10 +00:00
if ( e - > type - > type ! = ev_pointer )
c = - 200 ; //don't cast to a pointer.
else if ( ( * op - > type_c ) - > type = = ev_void & & op - > type_b = = & type_pointer & & e2 - > type - > type = = ev_pointer )
c = 0 ; //generic pointer... fixme: is this safe? make sure both sides are equivelent
else if ( e - > type - > aux_type - > type ! = ( * op - > type_b ) - > type ) //if e isn't a pointer to a type_b
2004-08-23 01:38:21 +00:00
c = - 200 ; //don't let the conversion work
else
c = QCC_canConv ( e2 , ( * op - > type_c ) - > type ) ;
}
else
{
c = QCC_canConv ( e2 , ( * op - > type_b ) - > type ) ;
if ( type_a ! = ( * op - > type_a ) - > type ) //in this case, a is the final assigned value
c = - 300 ; //don't use this op, as we must not change var b's type
2012-01-17 07:57:46 +00:00
else if ( ( * op - > type_a ) - > type = = ev_pointer & & e - > type - > aux_type - > type ! = ( * op - > type_a ) - > aux_type - > type )
c = - 300 ; //don't use this op if its a pointer to a different type
2004-08-23 01:38:21 +00:00
}
}
else
{
if ( op - > type_a = = & type_pointer ) //ent var
{
if ( e2 - > type - > type ! = ev_pointer | | e2 - > type - > aux_type - > type ! = ( * op - > type_b ) - > type ) //if e isn't a pointer to a type_b
c = - 200 ; //don't let the conversion work
else
c = 0 ;
}
else
{
2004-11-04 04:19:10 +00:00
c = QCC_canConv ( e , ( * op - > type_a ) - > type ) ;
c + = QCC_canConv ( e2 , ( * op - > type_b ) - > type ) ;
2004-08-23 01:38:21 +00:00
}
}
if ( c > = 0 & & c < numconversions )
{
bestop = op ;
numconversions = c ;
if ( c = = 0 ) //can't get less conversions than 0...
break ;
}
2011-05-15 13:23:13 +00:00
}
2004-08-23 01:38:21 +00:00
else
break ;
}
op = opcodeprioritized [ priority ] [ + + opnum ] ;
}
if ( bestop = = NULL )
{
if ( oldop - > priority = = CONDITION_PRIORITY )
op = oldop ;
else
{
2005-02-09 19:32:30 +00:00
if ( flag_laxcasts )
{
op = oldop ;
QCC_PR_ParseWarning ( WARN_LAXCAST , " type mismatch for %s (%s and %s) " , oldop - > name , e - > type - > name , e2 - > type - > name ) ;
}
2004-08-23 01:38:21 +00:00
else
QCC_PR_ParseError ( ERR_TYPEMISMATCH , " type mismatch for %s (%s and %s) " , oldop - > name , e - > type - > name , e2 - > type - > name ) ;
}
}
else
{
if ( numconversions > 3 )
QCC_PR_ParseWarning ( WARN_IMPLICITCONVERSION , " Implicit conversion " ) ;
op = bestop ;
}
// if (type_a == ev_pointer && type_b != e->type->aux_type->type)
// QCC_PR_ParseError ("type mismatch for %s", op->name);
if ( st )
st - > b = & statements [ numstatements ] - st ;
if ( op - > associative ! = ASSOC_LEFT )
{
qcc_usefulstatement = true ;
if ( e - > constant | | e - > ofs < OFS_PARM0 )
{
2005-09-28 16:57:10 +00:00
if ( e - > type - > type = = ev_function )
{
QCC_PR_ParseWarning ( WARN_ASSIGNMENTTOCONSTANTFUNC , " Assignment to function %s " , e - > name ) ;
QCC_PR_ParsePrintDef ( WARN_ASSIGNMENTTOCONSTANTFUNC , e ) ;
}
else
{
QCC_PR_ParseWarning ( WARN_ASSIGNMENTTOCONSTANT , " Assignment to constant %s " , e - > name ) ;
QCC_PR_ParsePrintDef ( WARN_ASSIGNMENTTOCONSTANT , e ) ;
}
2004-08-23 01:38:21 +00:00
# ifndef QCC
editbadfile ( strings + s_file , pr_source_line ) ;
# endif
}
2004-11-29 21:08:02 +00:00
if ( conditional & 1 )
2004-08-23 01:38:21 +00:00
QCC_PR_ParseWarning ( WARN_ASSIGNMENTINCONDITIONAL , " Assignment in conditional " ) ;
e = QCC_PR_Statement ( op , e2 , e , NULL ) ;
}
else
e = QCC_PR_Statement ( op , e , e2 , NULL ) ;
2011-05-15 13:23:13 +00:00
2004-08-23 01:38:21 +00:00
if ( type_c ! = ev_void /* && type_c != ev_string*/ ) // field access gets type from field
e - > type = e2 - > type - > aux_type ;
2009-07-03 19:02:42 +00:00
if ( priority > 1 & & exprflags & EXPR_WARN_ABOVE_1 )
QCC_PR_ParseWarning ( 0 , " You may wish to add brackets after that ! operator " ) ;
2011-05-15 13:23:13 +00:00
2004-08-23 01:38:21 +00:00
break ;
}
if ( ! op )
{
2004-09-07 18:25:41 +00:00
if ( e = = NULL )
QCC_PR_ParseError ( ERR_INTERNAL , " e == null " ) ;
2004-08-23 01:38:21 +00:00
if ( ! STRCMP ( pr_token , " ++ " ) )
{
2004-09-07 18:25:41 +00:00
//if the last statement was an ent.float (or something)
if ( ( ( unsigned ) ( statements [ numstatements - 1 ] . op - OP_LOAD_F ) < 6 | | statements [ numstatements - 1 ] . op = = OP_LOAD_I ) & & statements [ numstatements - 1 ] . c = = e - > ofs )
{ //we have our load.
QCC_def_t * e3 ;
2005-07-28 15:52:31 +00:00
//the only inefficiency here is with an extra temp (we can't reuse the original)
2004-09-07 18:25:41 +00:00
//this is not a problem, as the optimise temps or locals marshalling can clean these up for us
qcc_usefulstatement = true ;
//load
//add to temp
//store temp to offset
2005-07-28 15:52:31 +00:00
//return original loaded (which is not at the same offset as the pointer we store to)
2004-09-07 18:25:41 +00:00
e2 = QCC_GetTemp ( type_float ) ;
e3 = QCC_GetTemp ( type_pointer ) ;
2006-01-28 06:41:20 +00:00
QCC_PR_SimpleStatement ( OP_ADDRESS , statements [ numstatements - 1 ] . a , statements [ numstatements - 1 ] . b , e3 - > ofs , false ) ;
2004-09-07 18:25:41 +00:00
if ( e - > type - > type = = ev_float )
{
2011-10-03 02:45:44 +00:00
QCC_PR_Statement3 ( & pr_opcodes [ OP_ADD_F ] , e , QCC_MakeFloatConst ( 1 ) , e2 , false ) ;
2006-01-28 06:41:20 +00:00
QCC_PR_Statement3 ( & pr_opcodes [ OP_STOREP_F ] , e2 , e3 , NULL , false ) ;
2004-09-07 18:25:41 +00:00
}
else if ( e - > type - > type = = ev_integer )
{
2011-10-03 02:45:44 +00:00
QCC_PR_Statement3 ( & pr_opcodes [ OP_ADD_I ] , e , QCC_MakeIntConst ( 1 ) , e2 , false ) ;
2006-01-28 06:41:20 +00:00
QCC_PR_Statement3 ( & pr_opcodes [ OP_STOREP_I ] , e2 , e3 , NULL , false ) ;
2004-09-07 18:25:41 +00:00
}
else
{
QCC_PR_ParseError ( ERR_PARSEERRORS , " -- suffix operator results in nonstandard behaviour. Use -=1 or prefix form instead " ) ;
QCC_PR_IncludeChunk ( " -=1 " , false , NULL ) ;
}
QCC_FreeTemp ( e2 ) ;
QCC_FreeTemp ( e3 ) ;
}
else if ( e - > type - > type = = ev_float )
{
//copy to temp
2005-07-28 15:52:31 +00:00
//add to original
//return temp (which == original)
2004-09-07 18:25:41 +00:00
QCC_PR_ParseWarning ( WARN_INEFFICIENTPLUSPLUS , " ++ suffix operator results in inefficient behaviour. Use +=1 or prefix form instead " ) ;
qcc_usefulstatement = true ;
e2 = QCC_GetTemp ( type_float ) ;
2006-01-28 06:41:20 +00:00
QCC_PR_Statement3 ( & pr_opcodes [ OP_STORE_F ] , e , e2 , NULL , false ) ;
2011-10-03 02:45:44 +00:00
QCC_PR_Statement3 ( & pr_opcodes [ OP_ADD_F ] , e , QCC_MakeFloatConst ( 1 ) , e , false ) ;
2004-09-07 18:25:41 +00:00
QCC_FreeTemp ( e ) ;
e = e2 ;
}
else if ( e - > type - > type = = ev_integer )
{
QCC_PR_ParseWarning ( WARN_INEFFICIENTPLUSPLUS , " ++ suffix operator results in inefficient behaviour. Use +=1 or prefix form instead " ) ;
qcc_usefulstatement = true ;
e2 = QCC_GetTemp ( type_integer ) ;
2006-01-28 06:41:20 +00:00
QCC_PR_Statement3 ( & pr_opcodes [ OP_STORE_I ] , e , e2 , NULL , false ) ;
2011-10-03 02:45:44 +00:00
QCC_PR_Statement3 ( & pr_opcodes [ OP_ADD_I ] , e , QCC_MakeIntConst ( 1 ) , e , false ) ;
2004-09-07 18:25:41 +00:00
QCC_FreeTemp ( e ) ;
e = e2 ;
}
else
{
QCC_PR_ParseWarning ( WARN_NOTSTANDARDBEHAVIOUR , " ++ suffix operator results in nonstandard behaviour. Use +=1 or prefix form instead " ) ;
QCC_PR_IncludeChunk ( " +=1 " , false , NULL ) ;
}
2004-08-23 01:38:21 +00:00
QCC_PR_Lex ( ) ;
}
else if ( ! STRCMP ( pr_token , " -- " ) )
{
2004-09-07 18:25:41 +00:00
if ( ( ( unsigned ) ( statements [ numstatements - 1 ] . op - OP_LOAD_F ) < 6 | | statements [ numstatements - 1 ] . op = = OP_LOAD_I ) & & statements [ numstatements - 1 ] . c = = e - > ofs )
{ //we have our load.
QCC_def_t * e3 ;
//load
//add to temp
//store temp to offset
2005-07-28 15:52:31 +00:00
//return original loaded (which is not at the same offset as the pointer we store to)
2004-09-07 18:25:41 +00:00
e2 = QCC_GetTemp ( type_float ) ;
e3 = QCC_GetTemp ( type_pointer ) ;
2006-01-28 06:41:20 +00:00
QCC_PR_SimpleStatement ( OP_ADDRESS , statements [ numstatements - 1 ] . a , statements [ numstatements - 1 ] . b , e3 - > ofs , false ) ;
2004-09-07 18:25:41 +00:00
if ( e - > type - > type = = ev_float )
{
2011-10-03 02:45:44 +00:00
QCC_PR_Statement3 ( & pr_opcodes [ OP_SUB_F ] , e , QCC_MakeFloatConst ( 1 ) , e2 , false ) ;
2006-01-28 06:41:20 +00:00
QCC_PR_Statement3 ( & pr_opcodes [ OP_STOREP_F ] , e2 , e3 , NULL , false ) ;
2004-09-07 18:25:41 +00:00
}
else if ( e - > type - > type = = ev_integer )
{
2011-10-03 02:45:44 +00:00
QCC_PR_Statement3 ( & pr_opcodes [ OP_SUB_I ] , e , QCC_MakeIntConst ( 1 ) , e2 , false ) ;
2006-01-28 06:41:20 +00:00
QCC_PR_Statement3 ( & pr_opcodes [ OP_STOREP_I ] , e2 , e3 , NULL , false ) ;
2004-09-07 18:25:41 +00:00
}
else
{
QCC_PR_ParseError ( ERR_PARSEERRORS , " -- suffix operator results in nonstandard behaviour. Use -=1 or prefix form instead " ) ;
QCC_PR_IncludeChunk ( " -=1 " , false , NULL ) ;
}
QCC_FreeTemp ( e2 ) ;
QCC_FreeTemp ( e3 ) ;
}
else if ( e - > type - > type = = ev_float )
{
QCC_PR_ParseWarning ( WARN_INEFFICIENTPLUSPLUS , " -- suffix operator results in inefficient behaviour. Use -=1 or prefix form instead " ) ;
qcc_usefulstatement = true ;
e2 = QCC_GetTemp ( type_float ) ;
2006-01-28 06:41:20 +00:00
QCC_PR_Statement3 ( & pr_opcodes [ OP_STORE_F ] , e , e2 , NULL , false ) ;
2011-10-03 02:45:44 +00:00
QCC_PR_Statement3 ( & pr_opcodes [ OP_SUB_F ] , e , QCC_MakeFloatConst ( 1 ) , e , false ) ;
2004-09-07 18:25:41 +00:00
QCC_FreeTemp ( e ) ;
e = e2 ;
}
else if ( e - > type - > type = = ev_integer )
{
QCC_PR_ParseWarning ( WARN_INEFFICIENTPLUSPLUS , " -- suffix operator results in inefficient behaviour. Use -=1 or prefix form instead " ) ;
qcc_usefulstatement = true ;
e2 = QCC_GetTemp ( type_integer ) ;
2006-01-28 06:41:20 +00:00
QCC_PR_Statement3 ( & pr_opcodes [ OP_STORE_I ] , e , e2 , NULL , false ) ;
2011-10-03 02:45:44 +00:00
QCC_PR_Statement3 ( & pr_opcodes [ OP_SUB_I ] , e , QCC_MakeIntConst ( 1 ) , e , false ) ;
2004-09-07 18:25:41 +00:00
QCC_FreeTemp ( e ) ;
e = e2 ;
}
else
{
QCC_PR_ParseWarning ( WARN_NOTSTANDARDBEHAVIOUR , " -- suffix operator results in nonstandard behaviour. Use -=1 or prefix form instead " ) ;
QCC_PR_IncludeChunk ( " -=1 " , false , NULL ) ;
}
2004-08-23 01:38:21 +00:00
QCC_PR_Lex ( ) ;
}
break ; // next token isn't at this priority level
}
}
if ( e = = NULL )
QCC_PR_ParseError ( ERR_INTERNAL , " e == null " ) ;
2007-06-09 22:30:16 +00:00
2009-07-03 19:02:42 +00:00
if ( ! ( exprflags & EXPR_DISALLOW_COMMA ) & & priority = = TOP_PRIORITY & & QCC_PR_CheckToken ( " , " ) )
2007-06-09 22:30:16 +00:00
{
2011-09-03 03:49:43 +00:00
if ( ! qcc_usefulstatement )
QCC_PR_ParseWarning ( WARN_POINTLESSSTATEMENT , " Effectless statement " ) ;
2007-06-09 22:30:16 +00:00
QCC_FreeTemp ( e ) ;
2011-09-03 03:49:43 +00:00
qcc_usefulstatement = false ;
e = QCC_PR_Expression ( TOP_PRIORITY , exprflags ) ;
2007-06-09 22:30:16 +00:00
}
2011-05-15 13:23:13 +00:00
2004-08-23 01:38:21 +00:00
return e ;
}
2011-09-03 03:49:43 +00:00
int QCC_PR_IntConstExpr ( void )
{
2011-11-08 06:00:35 +00:00
QCC_def_t * def = QCC_PR_Expression ( TOP_PRIORITY , 0 ) ;
if ( def - > constant )
{
def - > references + + ;
if ( def - > type - > type = = ev_integer )
return G_INT ( def - > ofs ) ;
if ( def - > type - > type = = ev_float )
{
int i = G_FLOAT ( def - > ofs ) ;
if ( ( float ) i = = G_FLOAT ( def - > ofs ) )
return i ;
}
}
QCC_PR_ParseError ( ERR_NOTACONSTANT , " Value is not an integer constant " ) ;
return true ;
2011-09-03 03:49:43 +00:00
}
2004-11-13 17:18:34 +00:00
void QCC_PR_GotoStatement ( QCC_dstatement_t * patch2 , char * labelname )
{
if ( num_gotos > = max_gotos )
{
max_gotos + = 8 ;
pr_gotos = realloc ( pr_gotos , sizeof ( * pr_gotos ) * max_gotos ) ;
}
strncpy ( pr_gotos [ num_gotos ] . name , labelname , sizeof ( pr_gotos [ num_gotos ] . name ) - 1 ) ;
pr_gotos [ num_gotos ] . lineno = pr_source_line ;
pr_gotos [ num_gotos ] . statementno = patch2 - statements ;
num_gotos + + ;
}
2004-08-23 01:38:21 +00:00
2005-04-16 16:21:27 +00:00
pbool QCC_PR_StatementBlocksMatch ( QCC_dstatement_t * p1 , int p1count , QCC_dstatement_t * p2 , int p2count )
{
if ( p1count ! = p2count )
return false ;
while ( p1count > 0 )
{
if ( p1 - > op ! = p2 - > op )
return false ;
if ( p1 - > a ! = p2 - > a )
return false ;
if ( p1 - > b ! = p2 - > b )
return false ;
if ( p1 - > c ! = p2 - > c )
return false ;
p1 + + ;
p2 + + ;
p1count - - ;
}
return true ;
}
2013-03-12 22:35:33 +00:00
//vanilla qc only has an OP_IFNOT_I, others will be emulated as required, so we tend to need to emulate other opcodes.
QCC_dstatement_t * QCC_Generate_OP_IF ( QCC_def_t * e )
{
QCC_dstatement_t * st ;
switch ( e - > type - > type )
{
//int/pointer types
case ev_entity :
case ev_field :
case ev_function :
case ev_pointer :
case ev_integer :
QCC_FreeTemp ( QCC_PR_Statement ( & pr_opcodes [ OP_IF_I ] , e , NULL , & st ) ) ;
break ;
//emulated types
case ev_string :
QCC_PR_ParseWarning ( WARN_IFSTRING_USED , " if (string) tests for null, not empty. " ) ;
if ( flag_ifstring )
{
QCC_FreeTemp ( QCC_PR_Statement ( & pr_opcodes [ OP_IF_S ] , e , NULL , & st ) ) ;
break ;
}
QCC_FreeTemp ( QCC_PR_Statement ( & pr_opcodes [ OP_IF_I ] , e , NULL , & st ) ) ;
break ;
case ev_float :
if ( flag_iffloat | | QCC_OPCodeValid ( & pr_opcodes [ OP_IF_F ] ) )
QCC_FreeTemp ( QCC_PR_Statement ( & pr_opcodes [ OP_IF_F ] , e , NULL , & st ) ) ;
else
QCC_FreeTemp ( QCC_PR_Statement ( & pr_opcodes [ OP_IF_I ] , e , NULL , & st ) ) ;
break ;
case ev_vector :
QCC_FreeTemp ( QCC_PR_Statement ( & pr_opcodes [ OP_IFNOT_I ] , QCC_PR_Statement ( & pr_opcodes [ OP_NOT_V ] , e , NULL , NULL ) , NULL , & st ) ) ;
break ;
case ev_variant :
case ev_struct :
case ev_union :
case ev_void :
default :
QCC_PR_ParseWarning ( WARN_CONDITIONALTYPEMISMATCH , " conditional type mismatch: %s " , basictypenames [ e - > type - > type ] ) ;
QCC_FreeTemp ( QCC_PR_Statement ( & pr_opcodes [ OP_IF_I ] , e , NULL , & st ) ) ;
break ;
}
return st ;
}
QCC_dstatement_t * QCC_Generate_OP_IFNOT ( QCC_def_t * e )
{
QCC_dstatement_t * st ;
switch ( e - > type - > type )
{
//int/pointer types
case ev_entity :
case ev_field :
case ev_function :
case ev_pointer :
case ev_integer :
QCC_FreeTemp ( QCC_PR_Statement ( & pr_opcodes [ OP_IFNOT_I ] , e , NULL , & st ) ) ;
break ;
//emulated types
case ev_string :
QCC_PR_ParseWarning ( WARN_IFSTRING_USED , " if (string) tests for null, not empty " ) ;
if ( flag_ifstring )
{
QCC_FreeTemp ( QCC_PR_Statement ( & pr_opcodes [ OP_IFNOT_S ] , e , NULL , & st ) ) ;
break ;
}
QCC_FreeTemp ( QCC_PR_Statement ( & pr_opcodes [ OP_IFNOT_I ] , e , NULL , & st ) ) ;
break ;
case ev_float :
if ( flag_iffloat | | QCC_OPCodeValid ( & pr_opcodes [ OP_IFNOT_F ] ) )
QCC_FreeTemp ( QCC_PR_Statement ( & pr_opcodes [ OP_IFNOT_F ] , e , NULL , & st ) ) ;
else
QCC_FreeTemp ( QCC_PR_Statement ( & pr_opcodes [ OP_IFNOT_I ] , e , NULL , & st ) ) ;
break ;
case ev_vector :
QCC_FreeTemp ( QCC_PR_Statement ( & pr_opcodes [ OP_IF_I ] , QCC_PR_Statement ( & pr_opcodes [ OP_NOT_V ] , e , NULL , NULL ) , NULL , & st ) ) ;
break ;
case ev_variant :
case ev_struct :
case ev_union :
case ev_void :
default :
QCC_PR_ParseWarning ( WARN_CONDITIONALTYPEMISMATCH , " conditional type mismatch: %s " , basictypenames [ e - > type - > type ] ) ;
QCC_FreeTemp ( QCC_PR_Statement ( & pr_opcodes [ OP_IFNOT_I ] , e , NULL , & st ) ) ;
break ;
}
return st ;
}
2004-08-23 01:38:21 +00:00
/*
= = = = = = = = = = = =
PR_ParseStatement
= = = = = = = = = = = =
*/
void QCC_PR_ParseStatement ( void )
{
int continues ;
int breaks ;
int cases ;
int i ;
QCC_def_t * e , * e2 ;
QCC_dstatement_t * patch1 , * patch2 , * patch3 ;
2005-12-09 19:35:25 +00:00
int statementstart = pr_source_line ;
2004-08-23 01:38:21 +00:00
2005-03-20 02:57:11 +00:00
if ( QCC_PR_CheckToken ( " { " ) )
2004-08-23 01:38:21 +00:00
{
e = pr . localvars ;
2005-03-20 02:57:11 +00:00
while ( ! QCC_PR_CheckToken ( " } " ) )
2004-08-23 01:38:21 +00:00
QCC_PR_ParseStatement ( ) ;
if ( pr_subscopedlocals )
{
2010-12-22 00:33:19 +00:00
for ( e2 = pr . localvars ; e2 ! = e ; e2 = e2 - > nextlocal )
2004-08-23 01:38:21 +00:00
{
2010-12-22 00:33:19 +00:00
if ( ! e2 - > subscoped_away )
{
Hash_RemoveData ( & localstable , e2 - > name , e2 ) ;
e2 - > subscoped_away = true ;
}
2004-08-23 01:38:21 +00:00
}
}
return ;
}
2011-05-15 13:23:13 +00:00
2005-03-20 02:57:11 +00:00
if ( QCC_PR_CheckKeyword ( keyword_return , " return " ) )
2004-08-23 01:38:21 +00:00
{
/*if (pr_classtype)
{
e = QCC_PR_GetDef ( NULL , " __oself " , pr_scope , false , 0 ) ;
e2 = QCC_PR_GetDef ( NULL , " self " , NULL , false , 0 ) ;
2012-01-17 07:57:46 +00:00
QCC_FreeTemp ( QCC_PR_Statement ( & pr_opcodes [ OP_STORE_ENT ] , e , QCC_PR_DummyDef ( pr_classtype , " self " , pr_scope , 0 , e2 - > ofs , false ) , NULL ) ) ;
2004-08-23 01:38:21 +00:00
} */
2005-03-20 02:57:11 +00:00
if ( QCC_PR_CheckToken ( " ; " ) )
2004-08-23 01:38:21 +00:00
{
if ( pr_scope - > type - > aux_type - > type ! = ev_void )
QCC_PR_ParseWarning ( WARN_MISSINGRETURNVALUE , " \' %s \' should return %s " , pr_scope - > name , pr_scope - > type - > aux_type - > name ) ;
if ( opt_return_only )
QCC_FreeTemp ( QCC_PR_Statement ( & pr_opcodes [ OP_DONE ] , 0 , 0 , NULL ) ) ;
else
QCC_FreeTemp ( QCC_PR_Statement ( & pr_opcodes [ OP_RETURN ] , 0 , 0 , NULL ) ) ;
return ;
}
2009-07-03 19:02:42 +00:00
e = QCC_PR_Expression ( TOP_PRIORITY , 0 ) ;
2011-09-03 03:49:43 +00:00
e2 = QCC_SupplyConversion ( e , pr_scope - > type - > aux_type - > type , true ) ;
2008-11-09 22:29:28 +00:00
if ( e ! = e2 )
{
QCC_PR_ParseWarning ( WARN_CORRECTEDRETURNTYPE , " \' %s \' returned %s, expected %s, conversion supplied " , pr_scope - > name , e - > type - > name , pr_scope - > type - > aux_type - > name ) ;
e = e2 ;
}
2004-08-23 01:38:21 +00:00
QCC_PR_Expect ( " ; " ) ;
if ( pr_scope - > type - > aux_type - > type ! = e - > type - > type )
QCC_PR_ParseWarning ( WARN_WRONGRETURNTYPE , " \' %s \' returned %s, expected %s " , pr_scope - > name , e - > type - > name , pr_scope - > type - > aux_type - > name ) ;
QCC_FreeTemp ( QCC_PR_Statement ( & pr_opcodes [ OP_RETURN ] , e , 0 , NULL ) ) ;
2005-02-09 19:32:30 +00:00
return ;
}
2005-03-20 02:57:11 +00:00
if ( QCC_PR_CheckKeyword ( keyword_exit , " exit " ) )
2005-02-09 19:32:30 +00:00
{
QCC_FreeTemp ( QCC_PR_Statement ( & pr_opcodes [ OP_DONE ] , 0 , 0 , NULL ) ) ;
QCC_PR_Expect ( " ; " ) ;
return ;
2004-08-23 01:38:21 +00:00
}
2011-05-15 13:23:13 +00:00
2005-03-20 02:57:11 +00:00
if ( QCC_PR_CheckKeyword ( keyword_while , " while " ) )
2004-08-23 01:38:21 +00:00
{
continues = num_continues ;
breaks = num_breaks ;
QCC_PR_Expect ( " ( " ) ;
patch2 = & statements [ numstatements ] ;
2004-11-29 21:08:02 +00:00
conditional = 1 ;
2009-07-03 19:02:42 +00:00
e = QCC_PR_Expression ( TOP_PRIORITY , 0 ) ;
2004-11-29 21:08:02 +00:00
conditional = 0 ;
2004-08-23 01:38:21 +00:00
if ( ( ( e - > constant & & ! e - > temp ) | | ! STRCMP ( e - > name , " IMMEDIATE " ) ) & & opt_compound_jumps )
{
optres_compound_jumps + + ;
if ( ! G_INT ( e - > ofs ) )
{
QCC_PR_ParseWarning ( 0 , " while(0)? " ) ;
QCC_FreeTemp ( QCC_PR_Statement ( & pr_opcodes [ OP_GOTO ] , 0 , 0 , & patch1 ) ) ;
}
else
{
patch1 = NULL ;
}
}
else
2004-11-09 06:02:02 +00:00
{
if ( e - > constant & & ! e - > temp )
{
if ( ! G_FLOAT ( e - > ofs ) )
QCC_FreeTemp ( QCC_PR_Statement ( & pr_opcodes [ OP_GOTO ] , 0 , 0 , & patch1 ) ) ;
else
patch1 = NULL ;
}
else
2013-03-12 22:35:33 +00:00
patch1 = QCC_Generate_OP_IFNOT ( e ) ;
2004-11-09 06:02:02 +00:00
}
2004-08-23 01:38:21 +00:00
QCC_PR_Expect ( " ) " ) ; //after the line number is noted..
QCC_PR_ParseStatement ( ) ;
2004-12-13 14:25:52 +00:00
QCC_FreeTemp ( QCC_PR_Statement ( & pr_opcodes [ OP_GOTO ] , NULL , 0 , & patch3 ) ) ;
patch3 - > a = patch2 - patch3 ;
2004-08-23 01:38:21 +00:00
if ( patch1 )
2004-10-28 07:03:56 +00:00
{
if ( patch1 - > op = = OP_GOTO )
patch1 - > a = & statements [ numstatements ] - patch1 ;
else
patch1 - > b = & statements [ numstatements ] - patch1 ;
}
2004-08-23 01:38:21 +00:00
if ( breaks ! = num_breaks )
{
for ( i = breaks ; i < num_breaks ; i + + )
{
2004-09-21 03:22:55 +00:00
patch1 = & statements [ pr_breaks [ i ] ] ;
2004-10-26 14:39:55 +00:00
statements [ pr_breaks [ i ] ] . a = & statements [ numstatements ] - patch1 ; //jump to after the return-to-top goto
2004-08-23 01:38:21 +00:00
}
num_breaks = breaks ;
}
if ( continues ! = num_continues )
{
for ( i = continues ; i < num_continues ; i + + )
{
2004-09-21 03:22:55 +00:00
patch1 = & statements [ pr_continues [ i ] ] ;
2004-10-26 14:39:55 +00:00
statements [ pr_continues [ i ] ] . a = patch2 - patch1 ; //jump back to top
2004-08-23 01:38:21 +00:00
}
num_continues = continues ;
}
return ;
}
2005-03-20 02:57:11 +00:00
if ( QCC_PR_CheckKeyword ( keyword_for , " for " ) )
2004-08-23 01:38:21 +00:00
{
int old_numstatements ;
int numtemp , i ;
int linenum [ 32 ] ;
2004-10-28 07:03:56 +00:00
QCC_dstatement_t temp [ sizeof ( linenum ) / sizeof ( linenum [ 0 ] ) ] ;
2004-08-23 01:38:21 +00:00
continues = num_continues ;
breaks = num_breaks ;
QCC_PR_Expect ( " ( " ) ;
2005-03-20 02:57:11 +00:00
if ( ! QCC_PR_CheckToken ( " ; " ) )
2004-08-23 01:38:21 +00:00
{
2009-07-03 19:02:42 +00:00
QCC_FreeTemp ( QCC_PR_Expression ( TOP_PRIORITY , 0 ) ) ;
2004-08-23 01:38:21 +00:00
QCC_PR_Expect ( " ; " ) ;
}
patch2 = & statements [ numstatements ] ;
2005-03-20 02:57:11 +00:00
if ( ! QCC_PR_CheckToken ( " ; " ) )
2004-10-28 07:03:56 +00:00
{
2004-11-29 21:08:02 +00:00
conditional = 1 ;
2009-07-03 19:02:42 +00:00
e = QCC_PR_Expression ( TOP_PRIORITY , 0 ) ;
2004-11-29 21:08:02 +00:00
conditional = 0 ;
2004-10-28 07:03:56 +00:00
QCC_PR_Expect ( " ; " ) ;
}
else
e = NULL ;
2004-08-23 01:38:21 +00:00
2005-03-20 02:57:11 +00:00
if ( ! QCC_PR_CheckToken ( " ) " ) )
2004-08-23 01:38:21 +00:00
{
2004-10-28 07:03:56 +00:00
old_numstatements = numstatements ;
2009-07-03 19:02:42 +00:00
QCC_FreeTemp ( QCC_PR_Expression ( TOP_PRIORITY , 0 ) ) ;
2004-11-16 05:10:48 +00:00
2004-10-28 07:03:56 +00:00
numtemp = numstatements - old_numstatements ;
if ( numtemp > sizeof ( linenum ) / sizeof ( linenum [ 0 ] ) )
QCC_PR_ParseError ( ERR_TOOCOMPLEX , " Update expression too large " ) ;
numstatements = old_numstatements ;
for ( i = 0 ; i < numtemp ; i + + )
{
linenum [ i ] = statement_linenums [ numstatements + i ] ;
temp [ i ] = statements [ numstatements + i ] ;
}
QCC_PR_Expect ( " ) " ) ;
2004-08-23 01:38:21 +00:00
}
2004-10-28 07:03:56 +00:00
else
numtemp = 0 ;
2004-08-23 01:38:21 +00:00
2004-10-28 07:03:56 +00:00
if ( e )
2011-07-08 18:59:48 +00:00
QCC_FreeTemp ( QCC_PR_Statement ( & pr_opcodes [ OP_IFNOT_I ] , e , 0 , & patch1 ) ) ;
2004-10-28 07:03:56 +00:00
else
patch1 = NULL ;
2005-03-20 02:57:11 +00:00
if ( ! QCC_PR_CheckToken ( " ; " ) )
2004-11-06 03:05:39 +00:00
QCC_PR_ParseStatement ( ) ; //don't give the hanging ';' warning.
2004-08-23 01:38:21 +00:00
patch3 = & statements [ numstatements ] ;
for ( i = 0 ; i < numtemp ; i + + )
{
statement_linenums [ numstatements ] = linenum [ i ] ;
statements [ numstatements + + ] = temp [ i ] ;
}
2006-01-28 06:41:20 +00:00
QCC_PR_SimpleStatement ( OP_GOTO , patch2 - & statements [ numstatements ] , 0 , 0 , false ) ;
2004-10-28 07:03:56 +00:00
if ( patch1 )
patch1 - > b = & statements [ numstatements ] - patch1 ;
2004-08-23 01:38:21 +00:00
if ( breaks ! = num_breaks )
{
for ( i = breaks ; i < num_breaks ; i + + )
2011-05-15 13:23:13 +00:00
{
2004-08-23 01:38:21 +00:00
patch1 = & statements [ pr_breaks [ i ] ] ;
statements [ pr_breaks [ i ] ] . a = & statements [ numstatements ] - patch1 ;
}
num_breaks = breaks ;
}
if ( continues ! = num_continues )
{
for ( i = continues ; i < num_continues ; i + + )
{
patch1 = & statements [ pr_continues [ i ] ] ;
statements [ pr_continues [ i ] ] . a = patch3 - patch1 ;
}
num_continues = continues ;
}
return ;
}
2005-03-20 02:57:11 +00:00
if ( QCC_PR_CheckKeyword ( keyword_do , " do " ) )
2004-08-23 01:38:21 +00:00
{
continues = num_continues ;
breaks = num_breaks ;
patch1 = & statements [ numstatements ] ;
QCC_PR_ParseStatement ( ) ;
QCC_PR_Expect ( " while " ) ;
QCC_PR_Expect ( " ( " ) ;
2004-11-29 21:08:02 +00:00
conditional = 1 ;
2009-07-03 19:02:42 +00:00
e = QCC_PR_Expression ( TOP_PRIORITY , 0 ) ;
2004-11-29 21:08:02 +00:00
conditional = 0 ;
2004-12-13 14:25:52 +00:00
2004-11-09 06:02:02 +00:00
if ( e - > constant & & ! e - > temp )
{
if ( G_FLOAT ( e - > ofs ) )
2004-12-13 14:25:52 +00:00
{
QCC_FreeTemp ( QCC_PR_Statement ( & pr_opcodes [ OP_GOTO ] , NULL , 0 , & patch2 ) ) ;
patch2 - > a = patch1 - patch2 ;
}
2004-11-09 06:02:02 +00:00
}
2004-08-23 01:38:21 +00:00
else
2004-11-09 06:02:02 +00:00
{
2013-03-12 22:35:33 +00:00
patch2 = QCC_Generate_OP_IF ( e ) ;
2004-12-13 14:25:52 +00:00
patch2 - > b = patch1 - patch2 ;
2004-11-09 06:02:02 +00:00
}
2004-08-23 01:38:21 +00:00
QCC_PR_Expect ( " ) " ) ;
QCC_PR_Expect ( " ; " ) ;
if ( breaks ! = num_breaks )
{
for ( i = breaks ; i < num_breaks ; i + + )
{
patch2 = & statements [ pr_breaks [ i ] ] ;
statements [ pr_breaks [ i ] ] . a = & statements [ numstatements ] - patch2 ;
}
num_breaks = breaks ;
}
if ( continues ! = num_continues )
{
for ( i = continues ; i < num_continues ; i + + )
{
patch2 = & statements [ pr_continues [ i ] ] ;
statements [ pr_continues [ i ] ] . a = patch1 - patch2 ;
}
num_continues = continues ;
}
return ;
}
2011-05-15 13:23:13 +00:00
2005-03-20 02:57:11 +00:00
if ( QCC_PR_CheckKeyword ( keyword_local , " local " ) )
2004-08-23 01:38:21 +00:00
{
2011-05-15 13:23:13 +00:00
QCC_type_t * functionsclasstype = pr_classtype ;
2004-08-23 01:38:21 +00:00
// if (locals_end != numpr_globals) //is this breaking because of locals?
// QCC_PR_ParseWarning("local vars after temp vars\n");
QCC_PR_ParseDefs ( NULL ) ;
2005-09-08 22:52:46 +00:00
pr_classtype = functionsclasstype ;
2004-08-23 01:38:21 +00:00
return ;
}
if ( pr_token_type = = tt_name )
if ( ( keyword_var & & ! STRCMP ( " var " , pr_token ) ) | |
( keyword_string & & ! STRCMP ( " string " , pr_token ) ) | |
( keyword_float & & ! STRCMP ( " float " , pr_token ) ) | |
( keyword_entity & & ! STRCMP ( " entity " , pr_token ) ) | |
( keyword_vector & & ! STRCMP ( " vector " , pr_token ) ) | |
( keyword_integer & & ! STRCMP ( " integer " , pr_token ) ) | |
( keyword_int & & ! STRCMP ( " int " , pr_token ) ) | |
2004-11-06 03:05:39 +00:00
( keyword_class & & ! STRCMP ( " class " , pr_token ) ) | |
2004-08-23 01:38:21 +00:00
( keyword_const & & ! STRCMP ( " const " , pr_token ) ) )
{
QCC_PR_ParseDefs ( NULL ) ;
return ;
}
2005-03-20 02:57:11 +00:00
if ( QCC_PR_CheckKeyword ( keyword_state , " state " ) )
2004-08-23 01:38:21 +00:00
{
QCC_PR_Expect ( " [ " ) ;
QCC_PR_ParseState ( ) ;
QCC_PR_Expect ( " ; " ) ;
return ;
}
2005-03-20 02:57:11 +00:00
if ( QCC_PR_CheckToken ( " # " ) )
2005-02-09 19:32:30 +00:00
{
char * name ;
float frame = pr_immediate . _float ;
QCC_PR_Lex ( ) ;
name = QCC_PR_ParseName ( ) ;
2011-10-03 02:45:44 +00:00
QCC_FreeTemp ( QCC_PR_Statement ( & pr_opcodes [ OP_STATE ] , QCC_MakeFloatConst ( frame ) , QCC_PR_GetDef ( type_function , name , NULL , false , 0 , false ) , NULL ) ) ;
2005-02-09 19:32:30 +00:00
QCC_PR_Expect ( " ; " ) ;
return ;
}
2011-05-15 13:23:13 +00:00
2005-03-20 02:57:11 +00:00
if ( QCC_PR_CheckKeyword ( keyword_if , " if " ) )
2004-08-23 01:38:21 +00:00
{
2005-06-04 04:20:20 +00:00
pbool negate = QCC_PR_CheckKeyword ( keyword_not , " not " ) ;
2004-11-09 06:02:02 +00:00
2005-06-04 04:20:20 +00:00
QCC_PR_Expect ( " ( " ) ;
conditional = 1 ;
2009-07-03 19:02:42 +00:00
e = QCC_PR_Expression ( TOP_PRIORITY , 0 ) ;
2005-06-04 04:20:20 +00:00
conditional = 0 ;
// negate = negate != 0;
if ( negate )
{
2013-03-12 22:35:33 +00:00
patch1 = QCC_Generate_OP_IF ( e ) ;
2004-08-23 01:38:21 +00:00
}
else
{
2013-03-12 22:35:33 +00:00
patch1 = QCC_Generate_OP_IFNOT ( e ) ;
2004-08-23 01:38:21 +00:00
}
QCC_PR_Expect ( " ) " ) ; //close bracket is after we save the statement to mem (so debugger does not show the if statement as being on the line after
2004-10-28 07:03:56 +00:00
2004-08-23 01:38:21 +00:00
QCC_PR_ParseStatement ( ) ;
2004-10-28 07:03:56 +00:00
2005-03-20 02:57:11 +00:00
if ( QCC_PR_CheckKeyword ( keyword_else , " else " ) )
2004-08-23 01:38:21 +00:00
{
int lastwasreturn ;
2009-09-02 13:22:32 +00:00
lastwasreturn = statements [ numstatements - 1 ] . op = = OP_RETURN | | statements [ numstatements - 1 ] . op = = OP_DONE | |
statements [ numstatements - 1 ] . op = = OP_GOTO ;
2004-08-23 01:38:21 +00:00
2005-04-16 16:21:27 +00:00
//the last statement of the if was a return, so we don't need the goto at the end
2004-10-28 07:03:56 +00:00
if ( lastwasreturn & & opt_compound_jumps & & ! QCC_AStatementJumpsTo ( numstatements , patch1 - statements , numstatements ) )
2004-08-23 01:38:21 +00:00
{
2004-10-28 07:03:56 +00:00
// QCC_PR_ParseWarning(0, "optimised the else");
2004-08-23 01:38:21 +00:00
optres_compound_jumps + + ;
2004-10-28 07:03:56 +00:00
patch1 - > b = & statements [ numstatements ] - patch1 ;
2004-08-23 01:38:21 +00:00
QCC_PR_ParseStatement ( ) ;
}
else
{
2004-11-27 08:16:25 +00:00
// QCC_PR_ParseWarning(0, "using the else");
2004-08-23 01:38:21 +00:00
QCC_FreeTemp ( QCC_PR_Statement ( & pr_opcodes [ OP_GOTO ] , 0 , 0 , & patch2 ) ) ;
patch1 - > b = & statements [ numstatements ] - patch1 ;
QCC_PR_ParseStatement ( ) ;
patch2 - > a = & statements [ numstatements ] - patch2 ;
2005-04-16 16:21:27 +00:00
if ( QCC_PR_StatementBlocksMatch ( patch1 + 1 , patch2 - patch1 , patch2 + 1 , & statements [ numstatements ] - patch2 ) )
QCC_PR_ParseWarning ( 0 , " Two identical blocks each side of an else " ) ;
2004-08-23 01:38:21 +00:00
}
}
else
patch1 - > b = & statements [ numstatements ] - patch1 ;
return ;
}
2005-03-20 02:57:11 +00:00
if ( QCC_PR_CheckKeyword ( keyword_switch , " switch " ) )
2004-08-23 01:38:21 +00:00
{
2004-10-13 07:24:59 +00:00
int op ;
2004-08-23 01:38:21 +00:00
int hcstyle ;
int defaultcase = - 1 ;
2004-08-25 03:41:27 +00:00
temp_t * et ;
2004-11-06 03:05:39 +00:00
int oldst ;
2008-10-05 02:55:01 +00:00
QCC_type_t * switchtype ;
2004-08-25 03:41:27 +00:00
2004-08-23 01:38:21 +00:00
breaks = num_breaks ;
cases = num_cases ;
2004-08-25 03:41:27 +00:00
2004-08-23 01:38:21 +00:00
QCC_PR_Expect ( " ( " ) ;
2004-11-29 21:08:02 +00:00
conditional = 1 ;
2009-07-03 19:02:42 +00:00
e = QCC_PR_Expression ( TOP_PRIORITY , 0 ) ;
2004-11-29 21:08:02 +00:00
conditional = 0 ;
2004-08-25 03:41:27 +00:00
2004-11-27 08:16:25 +00:00
if ( e = = & def_ret )
{ //copy it out, so our hack just below doesn't crash us
2005-10-01 03:09:17 +00:00
/* if (e->type->type == ev_vector)
2005-03-29 07:39:38 +00:00
e = QCC_PR_Statement ( pr_opcodes + OP_STORE_V , e , QCC_GetTemp ( type_vector ) , NULL ) ;
2004-11-27 08:16:25 +00:00
else
2005-03-29 07:39:38 +00:00
e = QCC_PR_Statement ( pr_opcodes + OP_STORE_F , e , QCC_GetTemp ( type_float ) , NULL ) ;
2005-10-01 03:09:17 +00:00
if ( e = = & def_ret ) //this shouldn't be happening
QCC_Error ( ERR_INTERNAL , " internal error: switch: e == &def_ret " ) ;
*/
et = NULL ;
}
else
{
et = e - > temp ;
e - > temp = NULL ; //so noone frees it until we finish this loop
2004-11-27 08:16:25 +00:00
}
2004-08-23 01:38:21 +00:00
//expands
//switch (CONDITION)
//{
//case 1:
// break;
//case 2:
//default:
// break;
//}
2011-05-15 13:23:13 +00:00
2004-08-23 01:38:21 +00:00
//to
// x = CONDITION, goto start
// l1:
// goto end
// l2:
// def:
// goto end
// goto end P1
// start:
// if (x == 1) goto l1;
// if (x == 2) goto l2;
// goto def
// end:
//x is emitted in an opcode, stored as a register that we cannot access later.
//it should be possible to nest these.
2011-05-15 13:23:13 +00:00
2008-10-05 02:55:01 +00:00
switchtype = e - > type ;
switch ( switchtype - > type )
2004-08-23 01:38:21 +00:00
{
2004-10-13 07:24:59 +00:00
case ev_float :
op = OP_SWITCH_F ;
break ;
case ev_entity : //whu???
op = OP_SWITCH_E ;
break ;
case ev_vector :
op = OP_SWITCH_V ;
break ;
case ev_string :
op = OP_SWITCH_S ;
break ;
case ev_function :
op = OP_SWITCH_FNC ;
break ;
default : //err hmm.
op = 0 ;
break ;
2004-08-23 01:38:21 +00:00
}
2004-10-13 07:24:59 +00:00
if ( op )
hcstyle = QCC_OPCodeValid ( & pr_opcodes [ op ] ) ;
else
hcstyle = false ;
if ( hcstyle )
QCC_FreeTemp ( QCC_PR_Statement ( & pr_opcodes [ op ] , e , 0 , & patch1 ) ) ;
else
2004-08-23 01:38:21 +00:00
QCC_FreeTemp ( QCC_PR_Statement ( & pr_opcodes [ OP_GOTO ] , e , 0 , & patch1 ) ) ;
QCC_PR_Expect ( " ) " ) ; //close bracket is after we save the statement to mem (so debugger does not show the if statement as being on the line after
2011-05-15 13:23:13 +00:00
2004-11-06 03:05:39 +00:00
oldst = numstatements ;
2004-08-23 01:38:21 +00:00
QCC_PR_ParseStatement ( ) ;
2004-11-27 08:16:25 +00:00
//this is so that a missing goto at the end of your switch doesn't end up in the jumptable again
2004-12-24 08:45:56 +00:00
if ( oldst = = numstatements | | ! QCC_StatementIsAJump ( numstatements - 1 , numstatements - 1 ) )
2004-11-06 03:05:39 +00:00
{
QCC_FreeTemp ( QCC_PR_Statement ( & pr_opcodes [ OP_GOTO ] , 0 , 0 , & patch2 ) ) ; //the P1 statement/the theyforgotthebreak statement.
2004-11-27 08:16:25 +00:00
// QCC_PR_ParseWarning(0, "emitted goto");
}
else
{
patch2 = NULL ;
// QCC_PR_ParseWarning(0, "No goto");
}
2004-08-23 01:38:21 +00:00
if ( hcstyle )
patch1 - > b = & statements [ numstatements ] - patch1 ; //the goto start part
else
patch1 - > a = & statements [ numstatements ] - patch1 ; //the goto start part
2008-10-05 02:55:01 +00:00
if ( e = = & def_ret )
e - > type = switchtype ; //set it back to the type it was actually meant to be.
2004-08-23 01:38:21 +00:00
for ( i = cases ; i < num_cases ; i + + )
{
if ( ! pr_casesdef [ i ] )
{
if ( defaultcase > = 0 )
QCC_PR_ParseError ( ERR_MULTIPLEDEFAULTS , " Duplicated default case " ) ;
defaultcase = i ;
}
else
{
if ( pr_casesdef [ i ] - > type - > type ! = e - > type - > type )
2005-05-06 11:24:36 +00:00
{
if ( e - > type - > type = = ev_integer & & pr_casesdef [ i ] - > type - > type = = ev_float )
2011-10-03 02:45:44 +00:00
pr_casesdef [ i ] = QCC_MakeIntConst ( ( int ) qcc_pr_globals [ pr_casesdef [ i ] - > ofs ] ) ;
2005-05-06 11:24:36 +00:00
else
QCC_PR_ParseWarning ( WARN_SWITCHTYPEMISMATCH , " switch case type mismatch " ) ;
}
2004-08-23 01:38:21 +00:00
if ( pr_casesdef2 [ i ] )
{
if ( pr_casesdef2 [ i ] - > type - > type ! = e - > type - > type )
2005-05-06 11:24:36 +00:00
{
if ( e - > type - > type = = ev_integer & & pr_casesdef [ i ] - > type - > type = = ev_float )
2011-10-03 02:45:44 +00:00
pr_casesdef2 [ i ] = QCC_MakeIntConst ( ( int ) qcc_pr_globals [ pr_casesdef2 [ i ] - > ofs ] ) ;
2005-05-06 11:24:36 +00:00
else
QCC_PR_ParseWarning ( WARN_SWITCHTYPEMISMATCH , " switch caserange type mismatch " ) ;
}
2004-08-23 01:38:21 +00:00
if ( hcstyle )
{
QCC_FreeTemp ( QCC_PR_Statement ( & pr_opcodes [ OP_CASERANGE ] , pr_casesdef [ i ] , pr_casesdef2 [ i ] , & patch3 ) ) ;
patch3 - > c = & statements [ pr_cases [ i ] ] - patch3 ;
}
else
{
QCC_def_t * e3 ;
2005-03-29 07:39:38 +00:00
2005-05-06 11:24:36 +00:00
if ( e - > type - > type = = ev_float )
{
2011-07-08 18:59:48 +00:00
e2 = QCC_PR_Statement ( & pr_opcodes [ OP_GE_F ] , e , pr_casesdef [ i ] , NULL ) ;
e3 = QCC_PR_Statement ( & pr_opcodes [ OP_LE_F ] , e , pr_casesdef2 [ i ] , NULL ) ;
e2 = QCC_PR_Statement ( & pr_opcodes [ OP_AND_F ] , e2 , e3 , NULL ) ;
QCC_FreeTemp ( QCC_PR_Statement ( & pr_opcodes [ OP_IF_I ] , e2 , 0 , & patch3 ) ) ;
2005-05-06 11:24:36 +00:00
patch3 - > b = & statements [ pr_cases [ i ] ] - patch3 ;
}
else if ( e - > type - > type = = ev_integer )
{
e2 = QCC_PR_Statement ( & pr_opcodes [ OP_GE_I ] , e , pr_casesdef [ i ] , NULL ) ;
e3 = QCC_PR_Statement ( & pr_opcodes [ OP_LE_I ] , e , pr_casesdef2 [ i ] , NULL ) ;
2011-07-08 18:59:48 +00:00
e2 = QCC_PR_Statement ( & pr_opcodes [ OP_AND_I ] , e2 , e3 , NULL ) ;
QCC_FreeTemp ( QCC_PR_Statement ( & pr_opcodes [ OP_IF_I ] , e2 , 0 , & patch3 ) ) ;
2005-05-06 11:24:36 +00:00
patch3 - > b = & statements [ pr_cases [ i ] ] - patch3 ;
}
else
2005-05-08 17:06:12 +00:00
QCC_PR_ParseWarning ( WARN_SWITCHTYPEMISMATCH , " switch caserange MUST be a float or integer " ) ;
2004-08-23 01:38:21 +00:00
}
}
else
{
if ( hcstyle )
{
QCC_FreeTemp ( QCC_PR_Statement ( & pr_opcodes [ OP_CASE ] , pr_casesdef [ i ] , 0 , & patch3 ) ) ;
patch3 - > b = & statements [ pr_cases [ i ] ] - patch3 ;
}
else
{
if ( ! pr_casesdef [ i ] - > constant | | G_INT ( pr_casesdef [ i ] - > ofs ) )
{
switch ( e - > type - > type )
{
case ev_float :
e2 = QCC_PR_Statement ( & pr_opcodes [ OP_EQ_F ] , e , pr_casesdef [ i ] , NULL ) ;
break ;
case ev_entity : //whu???
e2 = QCC_PR_Statement ( & pr_opcodes [ OP_EQ_E ] , e , pr_casesdef [ i ] , & patch1 ) ;
break ;
case ev_vector :
e2 = QCC_PR_Statement ( & pr_opcodes [ OP_EQ_V ] , e , pr_casesdef [ i ] , & patch1 ) ;
break ;
case ev_string :
e2 = QCC_PR_Statement ( & pr_opcodes [ OP_EQ_S ] , e , pr_casesdef [ i ] , & patch1 ) ;
break ;
case ev_function :
e2 = QCC_PR_Statement ( & pr_opcodes [ OP_EQ_FNC ] , e , pr_casesdef [ i ] , & patch1 ) ;
break ;
2004-11-06 03:05:39 +00:00
case ev_field :
e2 = QCC_PR_Statement ( & pr_opcodes [ OP_EQ_FNC ] , e , pr_casesdef [ i ] , & patch1 ) ;
break ;
2004-11-04 05:53:20 +00:00
case ev_integer :
e2 = QCC_PR_Statement ( & pr_opcodes [ OP_EQ_I ] , e , pr_casesdef [ i ] , & patch1 ) ;
break ;
2004-08-23 01:38:21 +00:00
default :
QCC_PR_ParseError ( ERR_BADSWITCHTYPE , " Bad switch type " ) ;
2004-10-13 07:24:59 +00:00
e2 = NULL ;
2004-08-23 01:38:21 +00:00
break ;
}
2011-07-08 18:59:48 +00:00
QCC_FreeTemp ( QCC_PR_Statement ( & pr_opcodes [ OP_IF_I ] , e2 , 0 , & patch3 ) ) ;
2004-08-23 01:38:21 +00:00
}
else
{
2013-03-12 22:35:33 +00:00
patch3 = QCC_Generate_OP_IFNOT ( e ) ;
2004-08-23 01:38:21 +00:00
}
patch3 - > b = & statements [ pr_cases [ i ] ] - patch3 ;
}
}
2011-05-15 13:23:13 +00:00
}
2004-08-23 01:38:21 +00:00
}
if ( defaultcase > = 0 )
{
QCC_FreeTemp ( QCC_PR_Statement ( & pr_opcodes [ OP_GOTO ] , 0 , 0 , & patch3 ) ) ;
patch3 - > a = & statements [ pr_cases [ defaultcase ] ] - patch3 ;
}
num_cases = cases ;
patch3 = & statements [ numstatements ] ;
2004-11-27 08:16:25 +00:00
if ( patch2 )
patch2 - > a = patch3 - patch2 ; //set P1 jump
2004-08-23 01:38:21 +00:00
if ( breaks ! = num_breaks )
{
for ( i = breaks ; i < num_breaks ; i + + )
{
patch2 = & statements [ pr_breaks [ i ] ] ;
patch2 - > a = patch3 - patch2 ;
}
num_breaks = breaks ;
}
2005-10-01 03:09:17 +00:00
if ( et )
{
e - > temp = et ;
QCC_FreeTemp ( e ) ;
}
2004-08-23 01:38:21 +00:00
return ;
}
2005-03-20 02:57:11 +00:00
if ( QCC_PR_CheckKeyword ( keyword_asm , " asm " ) )
2004-08-23 01:38:21 +00:00
{
2005-03-20 02:57:11 +00:00
if ( QCC_PR_CheckToken ( " { " ) )
2004-11-04 04:19:10 +00:00
{
2005-03-20 02:57:11 +00:00
while ( ! QCC_PR_CheckToken ( " } " ) )
2004-11-04 04:19:10 +00:00
QCC_PR_ParseAsm ( ) ;
}
else
2004-08-23 01:38:21 +00:00
QCC_PR_ParseAsm ( ) ;
return ;
}
2005-03-20 02:57:11 +00:00
if ( QCC_PR_CheckToken ( " : " ) )
2004-08-23 01:38:21 +00:00
{
if ( pr_token_type ! = tt_name )
{
QCC_PR_ParseError ( ERR_BADLABELNAME , " invalid label name \" %s \" " , pr_token ) ;
return ;
}
for ( i = 0 ; i < num_labels ; i + + )
if ( ! STRNCMP ( pr_labels [ i ] . name , pr_token , sizeof ( pr_labels [ num_labels ] . name ) - 1 ) )
{
QCC_PR_ParseWarning ( WARN_DUPLICATELABEL , " Duplicate label %s " , pr_token ) ;
QCC_PR_Lex ( ) ;
return ;
}
if ( num_labels > = max_labels )
{
max_labels + = 8 ;
pr_labels = realloc ( pr_labels , sizeof ( * pr_labels ) * max_labels ) ;
}
strncpy ( pr_labels [ num_labels ] . name , pr_token , sizeof ( pr_labels [ num_labels ] . name ) - 1 ) ;
pr_labels [ num_labels ] . lineno = pr_source_line ;
pr_labels [ num_labels ] . statementno = numstatements ;
num_labels + + ;
// QCC_PR_ParseWarning("Gotos are evil");
QCC_PR_Lex ( ) ;
return ;
}
2005-03-20 02:57:11 +00:00
if ( QCC_PR_CheckKeyword ( keyword_goto , " goto " ) )
2004-08-23 01:38:21 +00:00
{
if ( pr_token_type ! = tt_name )
{
QCC_PR_ParseError ( ERR_NOLABEL , " invalid label name \" %s \" " , pr_token ) ;
return ;
}
QCC_PR_Statement ( & pr_opcodes [ OP_GOTO ] , 0 , 0 , & patch2 ) ;
2004-11-13 17:18:34 +00:00
QCC_PR_GotoStatement ( patch2 , pr_token ) ;
2004-08-23 01:38:21 +00:00
// QCC_PR_ParseWarning("Gotos are evil");
QCC_PR_Lex ( ) ;
QCC_PR_Expect ( " ; " ) ;
return ;
}
2005-03-20 02:57:11 +00:00
if ( QCC_PR_CheckKeyword ( keyword_break , " break " ) )
2004-08-23 01:38:21 +00:00
{
if ( ! STRCMP ( " ( " , pr_token ) )
{ //make sure it wasn't a call to the break function.
QCC_PR_IncludeChunk ( " break( " , true , NULL ) ;
QCC_PR_Lex ( ) ; //so it sees the break.
}
else
{
if ( num_breaks > = max_breaks )
{
max_breaks + = 8 ;
pr_breaks = realloc ( pr_breaks , sizeof ( * pr_breaks ) * max_breaks ) ;
}
pr_breaks [ num_breaks ] = numstatements ;
QCC_PR_Statement ( & pr_opcodes [ OP_GOTO ] , 0 , 0 , NULL ) ;
num_breaks + + ;
QCC_PR_Expect ( " ; " ) ;
return ;
}
}
2005-03-20 02:57:11 +00:00
if ( QCC_PR_CheckKeyword ( keyword_continue , " continue " ) )
2004-08-23 01:38:21 +00:00
{
if ( num_continues > = max_continues )
{
max_continues + = 8 ;
pr_continues = realloc ( pr_continues , sizeof ( * pr_continues ) * max_continues ) ;
}
pr_continues [ num_continues ] = numstatements ;
QCC_PR_Statement ( & pr_opcodes [ OP_GOTO ] , 0 , 0 , NULL ) ;
num_continues + + ;
QCC_PR_Expect ( " ; " ) ;
return ;
}
2005-03-20 02:57:11 +00:00
if ( QCC_PR_CheckKeyword ( keyword_case , " case " ) )
2004-08-23 01:38:21 +00:00
{
if ( num_cases > = max_cases )
{
max_cases + = 8 ;
pr_cases = realloc ( pr_cases , sizeof ( * pr_cases ) * max_cases ) ;
pr_casesdef = realloc ( pr_casesdef , sizeof ( * pr_casesdef ) * max_cases ) ;
pr_casesdef2 = realloc ( pr_casesdef2 , sizeof ( * pr_casesdef2 ) * max_cases ) ;
}
pr_cases [ num_cases ] = numstatements ;
2009-07-03 19:02:42 +00:00
pr_casesdef [ num_cases ] = QCC_PR_Expression ( TOP_PRIORITY , EXPR_DISALLOW_COMMA ) ;
2005-03-20 02:57:11 +00:00
if ( QCC_PR_CheckToken ( " .. " ) )
2004-08-23 01:38:21 +00:00
{
2009-07-03 19:02:42 +00:00
pr_casesdef2 [ num_cases ] = QCC_PR_Expression ( TOP_PRIORITY , EXPR_DISALLOW_COMMA ) ;
2004-08-23 01:38:21 +00:00
if ( pr_casesdef [ num_cases ] - > constant & & pr_casesdef2 [ num_cases ] - > constant & &
! pr_casesdef [ num_cases ] - > temp & & ! pr_casesdef2 [ num_cases ] - > temp )
if ( G_FLOAT ( pr_casesdef [ num_cases ] - > ofs ) > = G_FLOAT ( pr_casesdef2 [ num_cases ] - > ofs ) )
QCC_PR_ParseError ( ERR_CASENOTIMMEDIATE , " Caserange statement uses backwards range \n " ) ;
}
else
pr_casesdef2 [ num_cases ] = NULL ;
if ( numstatements ! = pr_cases [ num_cases ] )
QCC_PR_ParseError ( ERR_CASENOTIMMEDIATE , " Case statements may not use formulas \n " ) ;
num_cases + + ;
QCC_PR_Expect ( " : " ) ;
return ;
}
2005-03-20 02:57:11 +00:00
if ( QCC_PR_CheckKeyword ( keyword_default , " default " ) )
2004-08-23 01:38:21 +00:00
{
if ( num_cases > = max_cases )
{
max_cases + = 8 ;
pr_cases = realloc ( pr_cases , sizeof ( * pr_cases ) * max_cases ) ;
pr_casesdef = realloc ( pr_casesdef , sizeof ( * pr_casesdef ) * max_cases ) ;
pr_casesdef2 = realloc ( pr_casesdef2 , sizeof ( * pr_casesdef2 ) * max_cases ) ;
}
pr_cases [ num_cases ] = numstatements ;
pr_casesdef [ num_cases ] = NULL ;
pr_casesdef2 [ num_cases ] = NULL ;
num_cases + + ;
QCC_PR_Expect ( " : " ) ;
return ;
}
2005-03-20 02:57:11 +00:00
if ( QCC_PR_CheckKeyword ( keyword_thinktime , " thinktime " ) )
2004-08-23 01:38:21 +00:00
{
QCC_def_t * nextthink ;
QCC_def_t * time ;
2009-07-03 19:02:42 +00:00
e = QCC_PR_Expression ( TOP_PRIORITY , 0 ) ;
2004-08-23 01:38:21 +00:00
QCC_PR_Expect ( " : " ) ;
2009-07-03 19:02:42 +00:00
e2 = QCC_PR_Expression ( TOP_PRIORITY , 0 ) ;
2004-08-23 01:38:21 +00:00
if ( e - > type - > type ! = ev_entity | | e2 - > type - > type ! = ev_float )
QCC_PR_ParseError ( ERR_THINKTIMETYPEMISMATCH , " thinktime type mismatch " ) ;
if ( QCC_OPCodeValid ( & pr_opcodes [ OP_THINKTIME ] ) )
QCC_FreeTemp ( QCC_PR_Statement ( & pr_opcodes [ OP_THINKTIME ] , e , e2 , NULL ) ) ;
else
{
2008-10-05 02:55:01 +00:00
nextthink = QCC_PR_GetDef ( NULL , " nextthink " , NULL , false , 0 , false ) ;
2004-08-23 01:38:21 +00:00
if ( ! nextthink )
QCC_PR_ParseError ( ERR_UNKNOWNVALUE , " Unknown value \" %s \" " , " nextthink " ) ;
2008-10-05 02:55:01 +00:00
time = QCC_PR_GetDef ( type_float , " time " , NULL , false , 0 , false ) ;
2004-08-23 01:38:21 +00:00
if ( ! time )
QCC_PR_ParseError ( ERR_UNKNOWNVALUE , " Unknown value \" %s \" " , " time " ) ;
nextthink = QCC_PR_Statement ( & pr_opcodes [ OP_ADDRESS ] , e , nextthink , NULL ) ;
time = QCC_PR_Statement ( & pr_opcodes [ OP_ADD_F ] , time , e2 , NULL ) ;
QCC_FreeTemp ( QCC_PR_Statement ( & pr_opcodes [ OP_STOREP_F ] , time , nextthink , NULL ) ) ;
}
QCC_PR_Expect ( " ; " ) ;
return ;
}
2005-03-20 02:57:11 +00:00
if ( QCC_PR_CheckToken ( " ; " ) )
2004-08-23 01:38:21 +00:00
{
2005-12-09 19:35:25 +00:00
int osl = pr_source_line ;
pr_source_line = statementstart ;
2008-11-09 22:29:28 +00:00
if ( ! expandedemptymacro )
QCC_PR_ParseWarning ( WARN_POINTLESSSTATEMENT , " Hanging ';' " ) ;
2005-12-09 19:35:25 +00:00
pr_source_line = osl ;
2004-08-23 01:38:21 +00:00
return ;
}
// qcc_functioncalled=0;
qcc_usefulstatement = false ;
2009-07-03 19:02:42 +00:00
e = QCC_PR_Expression ( TOP_PRIORITY , 0 ) ;
2008-11-09 22:29:28 +00:00
expandedemptymacro = false ;
2004-08-23 01:38:21 +00:00
QCC_PR_Expect ( " ; " ) ;
if ( e - > type - > type ! = ev_void & & ! qcc_usefulstatement )
2005-12-09 19:35:25 +00:00
{
int osl = pr_source_line ;
pr_source_line = statementstart ;
2004-08-23 01:38:21 +00:00
QCC_PR_ParseWarning ( WARN_POINTLESSSTATEMENT , " Effectless statement " ) ;
2005-12-09 19:35:25 +00:00
pr_source_line = osl ;
}
2004-08-23 01:38:21 +00:00
QCC_FreeTemp ( e ) ;
// qcc_functioncalled=false;
}
/*
= = = = = = = = = = = = = =
PR_ParseState
States are special functions made for convenience . They automatically
set frame , nextthink ( implicitly ) , and think ( allowing forward definitions ) .
// void() name = [framenum, nextthink] {code}
// expands to:
// function void name ()
// {
// self.frame=framenum;
// self.nextthink = time + 0.1;
// self.think = nextthink
// <code>
// };
= = = = = = = = = = = = = =
*/
void QCC_PR_ParseState ( void )
{
char * name ;
QCC_def_t * s1 , * def , * sc = pr_scope ;
char f ;
f = * pr_token ;
2005-03-20 02:57:11 +00:00
if ( QCC_PR_CheckToken ( " ++ " ) | | QCC_PR_CheckToken ( " -- " ) )
2004-08-23 01:38:21 +00:00
{
s1 = QCC_PR_ParseImmediate ( ) ;
QCC_PR_Expect ( " .. " ) ;
def = QCC_PR_ParseImmediate ( ) ;
QCC_PR_Expect ( " ] " ) ;
if ( s1 - > type - > type ! = ev_float | | def - > type - > type ! = ev_float )
QCC_PR_ParseError ( ERR_STATETYPEMISMATCH , " state type mismatch " ) ;
2011-05-15 13:23:13 +00:00
2004-08-23 01:38:21 +00:00
if ( QCC_OPCodeValid ( & pr_opcodes [ OP_CSTATE ] ) )
QCC_FreeTemp ( QCC_PR_Statement ( & pr_opcodes [ OP_CSTATE ] , s1 , def , NULL ) ) ;
else
{
QCC_def_t * t1 , * t2 ;
QCC_def_t * framef , * frame ;
QCC_def_t * self ;
QCC_def_t * cycle_wrapped ;
2005-02-28 07:16:19 +00:00
temp_t * ftemp ;
2008-10-05 02:55:01 +00:00
self = QCC_PR_GetDef ( type_entity , " self " , NULL , false , 0 , false ) ;
framef = QCC_PR_GetDef ( NULL , " frame " , NULL , false , 0 , false ) ;
cycle_wrapped = QCC_PR_GetDef ( type_float , " cycle_wrapped " , NULL , false , 0 , false ) ;
2004-08-23 01:38:21 +00:00
frame = QCC_PR_Statement ( & pr_opcodes [ OP_LOAD_F ] , self , framef , NULL ) ;
2005-02-28 07:16:19 +00:00
if ( cycle_wrapped )
2011-10-03 02:45:44 +00:00
QCC_FreeTemp ( QCC_PR_Statement ( & pr_opcodes [ OP_STORE_F ] , QCC_MakeFloatConst ( 0 ) , cycle_wrapped , NULL ) ) ;
2005-02-28 07:16:19 +00:00
QCC_UnFreeTemp ( frame ) ;
2004-08-23 01:38:21 +00:00
//make sure the frame is within the bounds given.
2005-02-28 07:16:19 +00:00
ftemp = frame - > temp ;
frame - > temp = NULL ;
2011-07-08 18:59:48 +00:00
t1 = QCC_PR_Statement ( & pr_opcodes [ OP_LT_F ] , frame , s1 , NULL ) ;
t2 = QCC_PR_Statement ( & pr_opcodes [ OP_GT_F ] , frame , def , NULL ) ;
t1 = QCC_PR_Statement ( & pr_opcodes [ OP_OR_F ] , t1 , t2 , NULL ) ;
QCC_PR_SimpleStatement ( OP_IFNOT_I , t1 - > ofs , 2 , 0 , false ) ;
2004-08-23 01:38:21 +00:00
QCC_FreeTemp ( t1 ) ;
QCC_FreeTemp ( QCC_PR_Statement ( & pr_opcodes [ OP_STORE_F ] , s1 , frame , NULL ) ) ;
2006-01-28 06:41:20 +00:00
QCC_PR_SimpleStatement ( OP_GOTO , t1 - > ofs , 13 , 0 , false ) ;
2004-08-23 01:38:21 +00:00
2011-07-08 18:59:48 +00:00
t1 = QCC_PR_Statement ( & pr_opcodes [ OP_GE_F ] , def , s1 , NULL ) ;
QCC_PR_SimpleStatement ( OP_IFNOT_I , t1 - > ofs , 7 , 0 , false ) ;
2004-08-23 01:38:21 +00:00
QCC_FreeTemp ( t1 ) ; //this block is the 'it's in a forwards direction'
2011-10-03 02:45:44 +00:00
QCC_PR_SimpleStatement ( OP_ADD_F , frame - > ofs , QCC_MakeFloatConst ( 1 ) - > ofs , frame - > ofs , false ) ;
2011-07-08 18:59:48 +00:00
t1 = QCC_PR_Statement ( & pr_opcodes [ OP_GT_F ] , frame , def , NULL ) ;
QCC_PR_SimpleStatement ( OP_IFNOT_I , t1 - > ofs , 2 , 0 , false ) ;
2004-08-23 01:38:21 +00:00
QCC_FreeTemp ( t1 ) ;
QCC_FreeTemp ( QCC_PR_Statement ( & pr_opcodes [ OP_STORE_F ] , s1 , frame , NULL ) ) ;
QCC_UnFreeTemp ( frame ) ;
2005-02-28 07:16:19 +00:00
if ( cycle_wrapped )
2011-10-03 02:45:44 +00:00
QCC_FreeTemp ( QCC_PR_Statement ( & pr_opcodes [ OP_STORE_F ] , QCC_MakeFloatConst ( 1 ) , cycle_wrapped , NULL ) ) ;
2004-08-23 01:38:21 +00:00
2006-01-28 06:41:20 +00:00
QCC_PR_SimpleStatement ( OP_GOTO , 6 , 0 , 0 , false ) ;
2004-08-23 01:38:21 +00:00
//reverse animation.
2011-10-03 02:45:44 +00:00
QCC_PR_SimpleStatement ( OP_SUB_F , frame - > ofs , QCC_MakeFloatConst ( 1 ) - > ofs , frame - > ofs , false ) ;
2011-07-08 18:59:48 +00:00
t1 = QCC_PR_Statement ( & pr_opcodes [ OP_LT_F ] , frame , s1 , NULL ) ;
QCC_PR_SimpleStatement ( OP_IFNOT_I , t1 - > ofs , 2 , 0 , false ) ;
2004-08-23 01:38:21 +00:00
QCC_FreeTemp ( t1 ) ;
QCC_FreeTemp ( QCC_PR_Statement ( & pr_opcodes [ OP_STORE_F ] , def , frame , NULL ) ) ;
QCC_UnFreeTemp ( frame ) ;
2005-02-28 07:16:19 +00:00
if ( cycle_wrapped )
2011-10-03 02:45:44 +00:00
QCC_FreeTemp ( QCC_PR_Statement ( & pr_opcodes [ OP_STORE_F ] , QCC_MakeFloatConst ( 1 ) , cycle_wrapped , NULL ) ) ;
2011-05-15 13:23:13 +00:00
2004-08-23 01:38:21 +00:00
//self.frame = frame happens with the normal state opcode.
QCC_FreeTemp ( QCC_PR_Statement ( & pr_opcodes [ OP_STATE ] , frame , pr_scope , NULL ) ) ;
2005-02-28 07:16:19 +00:00
frame - > temp = ftemp ;
2004-08-23 01:38:21 +00:00
QCC_FreeTemp ( frame ) ;
}
return ;
}
2011-05-15 13:23:13 +00:00
2004-08-23 01:38:21 +00:00
if ( pr_token_type ! = tt_immediate | | pr_immediate_type ! = type_float )
QCC_PR_ParseError ( ERR_STATETYPEMISMATCH , " state frame must be a number " ) ;
s1 = QCC_PR_ParseImmediate ( ) ;
2011-05-15 13:23:13 +00:00
2005-03-20 02:57:11 +00:00
QCC_PR_CheckToken ( " , " ) ;
2004-08-23 01:38:21 +00:00
name = QCC_PR_ParseName ( ) ;
pr_scope = NULL ;
2012-01-17 07:57:46 +00:00
def = QCC_PR_GetDef ( type_function , name , NULL , true , 0 , false ) ;
2004-08-23 01:38:21 +00:00
pr_scope = sc ;
2011-05-15 13:23:13 +00:00
2004-08-23 01:38:21 +00:00
QCC_PR_Expect ( " ] " ) ;
2011-05-15 13:23:13 +00:00
2004-08-23 01:38:21 +00:00
QCC_FreeTemp ( QCC_PR_Statement ( & pr_opcodes [ OP_STATE ] , s1 , def , NULL ) ) ;
}
void QCC_PR_ParseAsm ( void )
{
2004-11-13 17:18:34 +00:00
QCC_dstatement_t * patch1 ;
2004-09-20 23:25:38 +00:00
int op , p ;
2004-08-23 01:38:21 +00:00
QCC_def_t * a , * b , * c ;
2005-03-20 02:57:11 +00:00
if ( QCC_PR_CheckKeyword ( keyword_local , " local " ) )
2004-08-23 01:38:21 +00:00
{
QCC_PR_ParseDefs ( NULL ) ;
return ;
}
for ( op = 0 ; op < OP_NUMOPS ; op + + )
{
if ( ! STRCMP ( pr_token , pr_opcodes [ op ] . opname ) )
{
QCC_PR_Lex ( ) ;
if ( pr_opcodes [ op ] . priority = = - 1 & & pr_opcodes [ op ] . associative ! = ASSOC_LEFT )
{
if ( pr_opcodes [ op ] . type_a = = NULL )
{
patch1 = & statements [ numstatements ] ;
2004-11-13 17:18:34 +00:00
2006-01-28 06:41:20 +00:00
QCC_PR_Statement3 ( & pr_opcodes [ op ] , NULL , NULL , NULL , true ) ;
2004-11-13 17:18:34 +00:00
if ( pr_token_type = = tt_name )
{
QCC_PR_GotoStatement ( patch1 , QCC_PR_ParseName ( ) ) ;
}
else
{
p = ( int ) pr_immediate . _float ;
patch1 - > a = ( int ) p ;
}
QCC_PR_Lex ( ) ;
2004-08-23 01:38:21 +00:00
}
else if ( pr_opcodes [ op ] . type_b = = NULL )
{
patch1 = & statements [ numstatements ] ;
2004-11-13 17:18:34 +00:00
2010-03-26 03:29:44 +00:00
a = QCC_PR_ParseValue ( pr_classtype , false ) ;
2006-01-28 06:41:20 +00:00
QCC_PR_Statement3 ( & pr_opcodes [ op ] , a , NULL , NULL , true ) ;
2004-08-23 01:38:21 +00:00
2004-11-13 17:18:34 +00:00
if ( pr_token_type = = tt_name )
{
QCC_PR_GotoStatement ( patch1 , QCC_PR_ParseName ( ) ) ;
}
else
{
p = ( int ) pr_immediate . _float ;
patch1 - > b = ( int ) p ;
}
QCC_PR_Lex ( ) ;
2004-08-23 01:38:21 +00:00
}
else
{
2004-11-13 17:18:34 +00:00
patch1 = & statements [ numstatements ] ;
2010-03-26 03:29:44 +00:00
a = QCC_PR_ParseValue ( pr_classtype , false ) ;
b = QCC_PR_ParseValue ( pr_classtype , false ) ;
2006-01-28 06:41:20 +00:00
QCC_PR_Statement3 ( & pr_opcodes [ op ] , a , b , NULL , true ) ;
2004-08-23 01:38:21 +00:00
2004-11-13 17:18:34 +00:00
if ( pr_token_type = = tt_name )
{
QCC_PR_GotoStatement ( patch1 , QCC_PR_ParseName ( ) ) ;
}
else
{
p = ( int ) pr_immediate . _float ;
patch1 - > c = ( int ) p ;
}
QCC_PR_Lex ( ) ;
2004-08-23 01:38:21 +00:00
}
}
else
2011-05-15 13:23:13 +00:00
{
2004-08-23 01:38:21 +00:00
if ( pr_opcodes [ op ] . type_a ! = & type_void )
2010-03-26 03:29:44 +00:00
a = QCC_PR_ParseValue ( pr_classtype , false ) ;
2004-08-23 01:38:21 +00:00
else
a = NULL ;
if ( pr_opcodes [ op ] . type_b ! = & type_void )
2010-03-26 03:29:44 +00:00
b = QCC_PR_ParseValue ( pr_classtype , false ) ;
2004-08-23 01:38:21 +00:00
else
b = NULL ;
if ( pr_opcodes [ op ] . associative = = ASSOC_LEFT & & pr_opcodes [ op ] . type_c ! = & type_void )
2010-03-26 03:29:44 +00:00
c = QCC_PR_ParseValue ( pr_classtype , false ) ;
2004-08-23 01:38:21 +00:00
else
c = NULL ;
2006-01-28 06:41:20 +00:00
QCC_PR_Statement3 ( & pr_opcodes [ op ] , a , b , c , true ) ;
2004-08-23 01:38:21 +00:00
}
2011-05-15 13:23:13 +00:00
2004-08-23 01:38:21 +00:00
QCC_PR_Expect ( " ; " ) ;
return ;
}
}
QCC_PR_ParseError ( ERR_BADOPCODE , " Bad op code name %s " , pr_token ) ;
}
2012-05-09 15:30:53 +00:00
static pbool QCC_FuncJumpsTo ( int first , int last , int statement )
2004-08-23 01:38:21 +00:00
{
int st ;
for ( st = first ; st < last ; st + + )
{
if ( pr_opcodes [ statements [ st ] . op ] . type_a = = NULL )
{
if ( st + ( signed ) statements [ st ] . a = = statement )
{
if ( st ! = first )
{
if ( statements [ st - 1 ] . op = = OP_RETURN )
continue ;
if ( statements [ st - 1 ] . op = = OP_DONE )
continue ;
return true ;
}
}
}
if ( pr_opcodes [ statements [ st ] . op ] . type_b = = NULL )
{
if ( st + ( signed ) statements [ st ] . b = = statement )
{
if ( st ! = first )
{
if ( statements [ st - 1 ] . op = = OP_RETURN )
continue ;
if ( statements [ st - 1 ] . op = = OP_DONE )
continue ;
return true ;
}
}
}
if ( pr_opcodes [ statements [ st ] . op ] . type_c = = NULL )
{
if ( st + ( signed ) statements [ st ] . c = = statement )
{
if ( st ! = first )
{
if ( statements [ st - 1 ] . op = = OP_RETURN )
continue ;
if ( statements [ st - 1 ] . op = = OP_DONE )
continue ;
return true ;
}
}
}
}
return false ;
}
2013-03-12 22:47:42 +00:00
/*
2012-05-09 15:30:53 +00:00
static pbool QCC_FuncJumpsToRange ( int first , int last , int firstr , int lastr )
2004-08-23 01:38:21 +00:00
{
int st ;
for ( st = first ; st < last ; st + + )
{
if ( pr_opcodes [ statements [ st ] . op ] . type_a = = NULL )
{
if ( st + ( signed ) statements [ st ] . a > = firstr & & st + ( signed ) statements [ st ] . a < = lastr )
{
if ( st ! = first )
{
if ( statements [ st - 1 ] . op = = OP_RETURN )
continue ;
if ( statements [ st - 1 ] . op = = OP_DONE )
continue ;
return true ;
}
}
}
if ( pr_opcodes [ statements [ st ] . op ] . type_b = = NULL )
{
if ( st + ( signed ) statements [ st ] . b > = firstr & & st + ( signed ) statements [ st ] . b < = lastr )
{
if ( st ! = first )
{
if ( statements [ st - 1 ] . op = = OP_RETURN )
continue ;
if ( statements [ st - 1 ] . op = = OP_DONE )
continue ;
return true ;
}
}
}
if ( pr_opcodes [ statements [ st ] . op ] . type_c = = NULL )
{
if ( st + ( signed ) statements [ st ] . c > = firstr & & st + ( signed ) statements [ st ] . c < = lastr )
{
if ( st ! = first )
{
if ( statements [ st - 1 ] . op = = OP_RETURN )
continue ;
if ( statements [ st - 1 ] . op = = OP_DONE )
continue ;
return true ;
}
}
}
}
return false ;
}
2013-03-12 22:47:42 +00:00
*/
2004-09-21 03:22:55 +00:00
#if 0
2004-08-23 01:38:21 +00:00
void QCC_CompoundJumps ( int first , int last )
{
//jumps to jumps are reordered so they become jumps to the final target.
int statement ;
int st ;
for ( st = first ; st < last ; st + + )
{
if ( pr_opcodes [ statements [ st ] . op ] . type_a = = NULL )
{
statement = st + ( signed ) statements [ st ] . a ;
if ( statements [ statement ] . op = = OP_RETURN | | statements [ statement ] . op = = OP_DONE )
{ //goto leads to return. Copy the command out to remove the goto.
statements [ st ] . op = statements [ statement ] . op ;
statements [ st ] . a = statements [ statement ] . a ;
statements [ st ] . b = statements [ statement ] . b ;
statements [ st ] . c = statements [ statement ] . c ;
optres_compound_jumps + + ;
}
while ( statements [ statement ] . op = = OP_GOTO )
{
2004-09-21 03:22:55 +00:00
statements [ st ] . a = statement + statements [ statement ] . a - st ;
2004-08-23 01:38:21 +00:00
statement = st + ( signed ) statements [ st ] . a ;
optres_compound_jumps + + ;
}
}
if ( pr_opcodes [ statements [ st ] . op ] . type_b = = NULL )
{
statement = st + ( signed ) statements [ st ] . b ;
while ( statements [ statement ] . op = = OP_GOTO )
{
2004-09-21 03:22:55 +00:00
statements [ st ] . b = statement + statements [ statement ] . a - st ;
2004-08-23 01:38:21 +00:00
statement = st + ( signed ) statements [ st ] . b ;
optres_compound_jumps + + ;
}
}
if ( pr_opcodes [ statements [ st ] . op ] . type_c = = NULL )
{
statement = st + ( signed ) statements [ st ] . c ;
while ( statements [ statement ] . op = = OP_GOTO )
{
2004-09-21 03:22:55 +00:00
statements [ st ] . c = statement + statements [ statement ] . a - st ;
2004-08-23 01:38:21 +00:00
statement = st + ( signed ) statements [ st ] . c ;
optres_compound_jumps + + ;
}
}
}
}
2004-09-21 03:22:55 +00:00
# else
void QCC_CompoundJumps ( int first , int last )
{
//jumps to jumps are reordered so they become jumps to the final target.
int statement ;
int st ;
2004-10-28 07:03:56 +00:00
int infloop ;
2004-09-21 03:22:55 +00:00
for ( st = first ; st < last ; st + + )
{
if ( pr_opcodes [ statements [ st ] . op ] . type_a = = NULL )
{
statement = st + ( signed ) statements [ st ] . a ;
if ( statements [ statement ] . op = = OP_RETURN | | statements [ statement ] . op = = OP_DONE )
{ //goto leads to return. Copy the command out to remove the goto.
statements [ st ] . op = statements [ statement ] . op ;
statements [ st ] . a = statements [ statement ] . a ;
statements [ st ] . b = statements [ statement ] . b ;
statements [ st ] . c = statements [ statement ] . c ;
optres_compound_jumps + + ;
}
2004-10-28 07:03:56 +00:00
infloop = 1000 ;
2004-09-21 03:22:55 +00:00
while ( statements [ statement ] . op = = OP_GOTO )
{
2004-10-28 07:03:56 +00:00
if ( ! infloop - - )
{
QCC_PR_ParseWarning ( 0 , " Infinate loop detected " ) ;
break ;
}
2004-09-21 03:22:55 +00:00
statements [ st ] . a = ( statement + statements [ statement ] . a - st ) ;
statement = st + ( signed ) statements [ st ] . a ;
optres_compound_jumps + + ;
}
}
if ( pr_opcodes [ statements [ st ] . op ] . type_b = = NULL )
{
statement = st + ( signed ) statements [ st ] . b ;
2004-10-28 07:03:56 +00:00
infloop = 1000 ;
2004-09-21 03:22:55 +00:00
while ( statements [ statement ] . op = = OP_GOTO )
{
2004-10-28 07:03:56 +00:00
if ( ! infloop - - )
{
QCC_PR_ParseWarning ( 0 , " Infinate loop detected " ) ;
break ;
}
2004-09-21 03:22:55 +00:00
statements [ st ] . b = ( statement + statements [ statement ] . a - st ) ;
statement = st + ( signed ) statements [ st ] . b ;
optres_compound_jumps + + ;
}
}
if ( pr_opcodes [ statements [ st ] . op ] . type_c = = NULL )
{
statement = st + ( signed ) statements [ st ] . c ;
2004-10-28 07:03:56 +00:00
infloop = 1000 ;
2004-09-21 03:22:55 +00:00
while ( statements [ statement ] . op = = OP_GOTO )
{
2004-10-28 07:03:56 +00:00
if ( ! infloop - - )
{
QCC_PR_ParseWarning ( 0 , " Infinate loop detected " ) ;
break ;
}
2004-09-21 03:22:55 +00:00
statements [ st ] . c = ( statement + statements [ statement ] . a - st ) ;
statement = st + ( signed ) statements [ st ] . c ;
optres_compound_jumps + + ;
}
}
}
}
# endif
2004-10-26 16:31:03 +00:00
void QCC_CheckForDeadAndMissingReturns ( int first , int last , int rettype )
{
int st , st2 ;
if ( statements [ last - 1 ] . op = = OP_DONE )
last - - ; //don't want the done
2011-05-15 13:23:13 +00:00
2004-10-26 16:31:03 +00:00
if ( rettype ! = ev_void )
if ( statements [ last - 1 ] . op ! = OP_RETURN )
{
2004-11-27 08:16:25 +00:00
if ( statements [ last - 1 ] . op ! = OP_GOTO | | ( signed ) statements [ last - 1 ] . a > 0 )
{
QCC_PR_ParseWarning ( WARN_MISSINGRETURN , " %s: not all control paths return a value " , pr_scope - > name ) ;
return ;
}
2004-10-26 16:31:03 +00:00
}
for ( st = first ; st < last ; st + + )
{
2004-10-28 07:03:56 +00:00
if ( statements [ st ] . op = = OP_RETURN | | statements [ st ] . op = = OP_GOTO )
2004-10-26 16:31:03 +00:00
{
st + + ;
if ( st = = last )
continue ; //erm... end of function doesn't count as unreachable.
2004-11-04 04:19:10 +00:00
if ( ! opt_compound_jumps )
{ //we can ignore single statements like these without compound jumps (compound jumps correctly removes all).
if ( statements [ st ] . op = = OP_GOTO ) //inefficient compiler, we can ignore this.
continue ;
if ( statements [ st ] . op = = OP_DONE ) //inefficient compiler, we can ignore this.
continue ;
if ( statements [ st ] . op = = OP_RETURN ) //inefficient compiler, we can ignore this.
continue ;
}
2004-10-26 16:31:03 +00:00
//make sure something goes to just after this return.
for ( st2 = first ; st2 < last ; st2 + + )
{
2013-03-12 22:32:25 +00:00
if ( pr_opcodes [ statements [ st2 ] . op ] . associative = = ASSOC_RIGHT )
2004-10-26 16:31:03 +00:00
{
2013-03-12 22:32:25 +00:00
if ( pr_opcodes [ statements [ st2 ] . op ] . type_a = = NULL )
{
if ( st2 + ( signed ) statements [ st2 ] . a = = st )
break ;
}
if ( pr_opcodes [ statements [ st2 ] . op ] . type_b = = NULL )
{
if ( st2 + ( signed ) statements [ st2 ] . b = = st )
break ;
}
if ( pr_opcodes [ statements [ st2 ] . op ] . type_c = = NULL )
{
if ( st2 + ( signed ) statements [ st2 ] . c = = st )
break ;
}
2004-10-26 16:31:03 +00:00
}
}
if ( st2 = = last )
{
QCC_PR_ParseWarning ( WARN_UNREACHABLECODE , " %s: contains unreachable code " , pr_scope - > name ) ;
}
continue ;
}
2013-03-12 22:32:25 +00:00
if ( rettype ! = ev_void & & pr_opcodes [ statements [ st ] . op ] . associative = = ASSOC_RIGHT )
2004-10-26 16:31:03 +00:00
{
if ( pr_opcodes [ statements [ st ] . op ] . type_a = = NULL )
{
if ( st + ( signed ) statements [ st ] . a = = last )
{
QCC_PR_ParseWarning ( WARN_MISSINGRETURN , " %s: not all control paths return a value " , pr_scope - > name ) ;
return ;
}
}
if ( pr_opcodes [ statements [ st ] . op ] . type_b = = NULL )
{
if ( st + ( signed ) statements [ st ] . b = = last )
{
QCC_PR_ParseWarning ( WARN_MISSINGRETURN , " %s: not all control paths return a value " , pr_scope - > name ) ;
return ;
}
}
if ( pr_opcodes [ statements [ st ] . op ] . type_c = = NULL )
{
if ( st + ( signed ) statements [ st ] . c = = last )
{
QCC_PR_ParseWarning ( WARN_MISSINGRETURN , " %s: not all control paths return a value " , pr_scope - > name ) ;
return ;
}
}
}
}
}
2004-10-28 07:03:56 +00:00
2004-12-24 08:45:56 +00:00
pbool QCC_StatementIsAJump ( int stnum , int notifdest ) //only the unconditionals.
{
if ( statements [ stnum ] . op = = OP_RETURN )
return true ;
if ( statements [ stnum ] . op = = OP_DONE )
return true ;
if ( statements [ stnum ] . op = = OP_GOTO )
if ( ( int ) statements [ stnum ] . a ! = notifdest )
return true ;
return false ;
}
2004-10-28 07:03:56 +00:00
int QCC_AStatementJumpsTo ( int targ , int first , int last )
{
int st ;
for ( st = first ; st < last ; st + + )
{
if ( pr_opcodes [ statements [ st ] . op ] . type_a = = NULL )
{
2004-11-27 08:16:25 +00:00
if ( st + ( signed ) statements [ st ] . a = = targ & & statements [ st ] . a )
2004-10-28 07:03:56 +00:00
{
return true ;
}
}
if ( pr_opcodes [ statements [ st ] . op ] . type_b = = NULL )
{
if ( st + ( signed ) statements [ st ] . b = = targ )
{
return true ;
}
}
if ( pr_opcodes [ statements [ st ] . op ] . type_c = = NULL )
{
if ( st + ( signed ) statements [ st ] . c = = targ )
{
return true ;
}
}
}
for ( st = 0 ; st < num_labels ; st + + ) //assume it's used.
{
if ( pr_labels [ st ] . statementno = = targ )
return true ;
}
return false ;
}
2004-08-23 01:38:21 +00:00
/*
//goes through statements, if it sees a matching statement earlier, it'll strim out the current.
void QCC_CommonSubExpressionRemoval ( int first , int last )
{
int cur ; //the current
int prev ; //the earlier statement
for ( cur = last - 1 ; cur > = first ; cur - - )
{
if ( pr_opcodes [ statements [ cur ] . op ] . priority = = - 1 )
continue ;
for ( prev = cur - 1 ; prev > = first ; prev - - )
{
if ( statements [ prev ] . op > = OP_CALL0 & & statements [ prev ] . op < = OP_CALL8 )
{
optres_test1 + + ;
break ;
}
if ( statements [ prev ] . op > = OP_CALL1H & & statements [ prev ] . op < = OP_CALL8H )
{
optres_test1 + + ;
break ;
}
if ( pr_opcodes [ statements [ prev ] . op ] . right_associative )
{ //make sure no changes to var_a occur.
if ( statements [ prev ] . b = = statements [ cur ] . a )
{
optres_test2 + + ;
break ;
}
if ( statements [ prev ] . b = = statements [ cur ] . b & & ! pr_opcodes [ statements [ cur ] . op ] . right_associative )
{
optres_test2 + + ;
break ;
}
}
else
{
if ( statements [ prev ] . c = = statements [ cur ] . a )
{
optres_test2 + + ;
break ;
}
if ( statements [ prev ] . c = = statements [ cur ] . b & & ! pr_opcodes [ statements [ cur ] . op ] . right_associative )
{
optres_test2 + + ;
break ;
}
}
if ( statements [ prev ] . op = = statements [ cur ] . op )
if ( statements [ prev ] . a = = statements [ cur ] . a )
if ( statements [ prev ] . b = = statements [ cur ] . b )
if ( statements [ prev ] . c = = statements [ cur ] . c )
{
if ( ! QCC_FuncJumpsToRange ( first , last , prev , cur ) )
{
statements [ cur ] . op = OP_STORE_F ;
statements [ cur ] . a = 28 ;
statements [ cur ] . b = 28 ;
optres_comexprremoval + + ;
}
else
optres_test1 + + ;
break ;
}
}
}
}
*/
2013-03-12 22:32:25 +00:00
# define OpAssignsToA(op) false
//follow branches (by recursing).
//stop on first read(error, return statement) or write(no error, return -1)
//end-of-block returns 0, done/return/goto returns -2
int QCC_CheckOneUninitialised ( int firststatement , int laststatement , int min , int max )
{
int ret ;
int i ;
QCC_dstatement32_t * st ;
for ( i = firststatement ; i < laststatement ; i + + )
{
st = & statements [ i ] ;
if ( st - > op = = OP_DONE | | st - > op = = OP_RETURN )
{
if ( st - > a > = min & & st - > a < max )
return i ;
return - 2 ;
}
// this code catches gotos, but can cause issues with while statements.
// if (st->op == OP_GOTO && (int)st->a < 1)
// return -2;
if ( pr_opcodes [ st - > op ] . type_a )
{
if ( st - > a > = min & & st - > a < max )
{
if ( OpAssignsToA ( st - > op ) )
return - 1 ;
return i ;
}
}
else if ( pr_opcodes [ st - > op ] . associative = = ASSOC_RIGHT & & ( int ) st - > a > 0 )
{
int jump = i + ( int ) st - > a ;
ret = QCC_CheckOneUninitialised ( i + 1 , jump , min , max ) ;
if ( ret > 0 )
return ret ;
i = jump - 1 ;
}
if ( pr_opcodes [ st - > op ] . type_b )
{
if ( st - > b > = min & & st - > b < max )
{
if ( OpAssignsToB ( st - > op ) )
return - 1 ;
return i ;
}
}
else if ( pr_opcodes [ st - > op ] . associative = = ASSOC_RIGHT & & ( int ) st - > b > 0 )
{
int jump = i + ( int ) st - > b ;
//check if there's an else.
st = & statements [ jump - 1 ] ;
if ( st - > op = = OP_GOTO & & ( int ) st - > a > 0 )
{
int jump2 = jump - 1 + st - > a ;
int rett = QCC_CheckOneUninitialised ( i + 1 , jump - 1 , min , max ) ;
if ( rett > 0 )
return rett ;
ret = QCC_CheckOneUninitialised ( jump , jump2 , min , max ) ;
if ( ret > 0 )
return ret ;
if ( rett < 0 & & ret < 0 )
return ( rett = = ret ) ? ret : - 1 ; //inited or aborted in both, don't need to continue along this branch
i = jump2 - 1 ;
}
else
{
ret = QCC_CheckOneUninitialised ( i + 1 , jump , min , max ) ;
if ( ret > 0 )
return ret ;
i = jump - 1 ;
}
continue ;
}
if ( pr_opcodes [ st - > op ] . type_c & & st - > c > = min & & st - > c < max )
{
if ( OpAssignsToC ( st - > op ) )
return - 1 ;
return i ;
}
else if ( pr_opcodes [ st - > op ] . associative = = ASSOC_RIGHT & & ( int ) st - > c > 0 )
{
int jump = i + ( int ) st - > c ;
ret = QCC_CheckOneUninitialised ( i + 1 , jump , min , max ) ;
if ( ret > 0 )
return ret ;
i = jump - 1 ;
continue ;
}
}
return 0 ;
}
pbool QCC_CheckUninitialised ( int firststatement , int laststatement )
{
QCC_def_t * local ;
int i ;
int min , max ;
pbool result = false ;
int paramend = FIRST_LOCAL ;
QCC_type_t * type = pr_scope - > type ;
int err ;
for ( type = pr_scope - > type , i = type - > num_parms , type = type - > param ; i > 0 ; i - - , type = type - > next )
paramend + = type - > size ;
for ( local = pr . localvars ; local ; local = local - > nextlocal )
{
if ( local - > constant )
continue ; //will get some other warning, so we don't care.
if ( local - > ofs < paramend )
continue ;
min = local - > ofs ;
max = local - > ofs + ( local - > type - > size * ( local - > arraysize ? local - > arraysize : 1 ) ) ;
err = QCC_CheckOneUninitialised ( firststatement , laststatement , min , max ) ;
if ( err > 0 )
{
QCC_PR_Warning ( WARN_UNINITIALIZED , strings + s_file , statement_linenums [ err ] , " Potentially uninitialised variable %s " , local - > name ) ;
result = true ;
// break;
}
}
return result ;
}
2004-08-23 01:38:21 +00:00
void QCC_RemapOffsets ( unsigned int firststatement , unsigned int laststatement , unsigned int min , unsigned int max , unsigned int newmin )
{
QCC_dstatement_t * st ;
unsigned int i ;
for ( i = firststatement , st = & statements [ i ] ; i < laststatement ; i + + , st + + )
{
if ( pr_opcodes [ st - > op ] . type_a & & st - > a > = min & & st - > a < max )
st - > a = st - > a - min + newmin ;
if ( pr_opcodes [ st - > op ] . type_b & & st - > b > = min & & st - > b < max )
st - > b = st - > b - min + newmin ;
if ( pr_opcodes [ st - > op ] . type_c & & st - > c > = min & & st - > c < max )
st - > c = st - > c - min + newmin ;
}
}
2013-03-12 22:32:25 +00:00
void QCC_Marshal_Locals ( int firststatement , int laststatement )
2004-08-23 01:38:21 +00:00
{
QCC_def_t * local ;
2013-03-12 22:32:25 +00:00
pbool error = false ;
int localsused = locals_end - locals_start ;
2004-08-25 03:41:27 +00:00
2004-08-23 01:38:21 +00:00
if ( ! pr . localvars ) //nothing to marshal
{
locals_start = numpr_globals ;
locals_end = numpr_globals ;
return ;
}
2013-03-12 22:32:25 +00:00
if ( ! opt_locals_overlapping )
2004-08-23 01:38:21 +00:00
{
2013-03-12 22:32:25 +00:00
if ( qccwarningaction [ WARN_UNINITIALIZED ] )
QCC_CheckUninitialised ( firststatement , laststatement ) ;
error = true ; //always use the legacy behaviour
2004-08-23 01:38:21 +00:00
}
2013-03-12 22:32:25 +00:00
else if ( QCC_CheckUninitialised ( firststatement , laststatement ) )
2004-08-23 01:38:21 +00:00
{
2013-03-12 22:32:25 +00:00
error = true ;
// QCC_PR_Note(ERR_INTERNAL, strings+s_file, pr_source_line, "Not overlapping locals from %s due to uninitialised locals", pr_scope->name);
2004-08-23 01:38:21 +00:00
}
2013-03-12 22:32:25 +00:00
else
2004-08-23 01:38:21 +00:00
{
2013-03-12 22:32:25 +00:00
//make sure we're allowed to marshall this function's locals
for ( local = pr . localvars ; local ; local = local - > nextlocal )
{
//FIXME: check for uninitialised locals.
//these matter when the function goes recursive (and locals marshalling counts as recursive every time).
if ( ( ( int * ) qcc_pr_globals ) [ local - > ofs ] )
{
QCC_PR_Note ( ERR_INTERNAL , strings + local - > s_file , local - > s_line , " Marshaling non-const initialised %s " , local - > name ) ;
error = true ;
}
2005-05-04 14:45:00 +00:00
2013-03-12 22:32:25 +00:00
if ( local - > constant )
{
QCC_PR_Note ( ERR_INTERNAL , strings + local - > s_file , local - > s_line , " Marshaling const %s " , local - > name ) ;
error = true ;
}
}
}
2012-01-17 07:57:46 +00:00
2013-03-12 22:32:25 +00:00
if ( error )
{
//move all the locals into a vanilla-style single block, per function.
locals_start = QCC_GetFreeGlobalOffsetSpace ( localsused ) ;
locals_end = locals_start + localsused ;
2004-08-23 01:38:21 +00:00
2013-03-12 22:32:25 +00:00
QCC_RemapOffsets ( firststatement , laststatement , FIRST_LOCAL , FIRST_LOCAL + localsused , locals_start ) ;
memcpy ( qcc_pr_globals + locals_start , qcc_pr_globals + FIRST_LOCAL , localsused * sizeof ( float ) ) ;
memset ( qcc_pr_globals + FIRST_LOCAL , 0 , localsused * sizeof ( float ) ) ;
for ( local = pr . localvars ; local ; local = local - > nextlocal )
{
if ( local - > ofs > = FIRST_LOCAL )
local - > ofs = local - > ofs - FIRST_LOCAL + locals_start ;
}
for ( local = pr . def_tail ; local ; local = local - > next )
{
if ( local - > scope ! = pr_scope )
break ;
2004-08-23 01:38:21 +00:00
2013-03-12 22:32:25 +00:00
if ( local - > ofs > = FIRST_LOCAL )
local - > ofs = local - > ofs - FIRST_LOCAL + locals_start ;
}
}
else
{
// QCC_PR_Note(ERR_INTERNAL, strings+s_file, pr_source_line, "Overlapping %s", pr_scope->name);
2004-08-23 01:38:21 +00:00
}
pr . localvars = NULL ;
}
# ifdef WRITEASM
void QCC_WriteAsmFunction ( QCC_def_t * sc , unsigned int firststatement , gofs_t firstparm )
{
unsigned int i ;
unsigned int p ;
gofs_t o ;
QCC_type_t * type ;
QCC_def_t * param ;
if ( ! asmfile )
return ;
type = sc - > type ;
fprintf ( asmfile , " %s( " , TypeName ( type - > aux_type ) ) ;
p = type - > num_parms ;
for ( o = firstparm , i = 0 , type = type - > param ; i < p ; i + + , type = type - > next )
{
if ( i )
fprintf ( asmfile , " , " ) ;
for ( param = pr . localvars ; param ; param = param - > nextlocal )
{
if ( param - > ofs = = o )
break ;
}
if ( param )
fprintf ( asmfile , " %s %s " , TypeName ( type ) , param - > name ) ;
else
fprintf ( asmfile , " %s " , TypeName ( type ) ) ;
o + = type - > size ;
}
fprintf ( asmfile , " ) %s = asm \n { \n " , sc - > name ) ;
QCC_fprintfLocals ( asmfile , firstparm , o ) ;
for ( i = firststatement ; i < ( unsigned int ) numstatements ; i + + )
{
fprintf ( asmfile , " \t %s " , pr_opcodes [ statements [ i ] . op ] . opname ) ;
if ( pr_opcodes [ statements [ i ] . op ] . type_a ! = & type_void )
{
if ( strlen ( pr_opcodes [ statements [ i ] . op ] . opname ) < 6 )
fprintf ( asmfile , " \t " ) ;
if ( pr_opcodes [ statements [ i ] . op ] . type_a )
2012-11-27 03:23:19 +00:00
{
2004-08-23 01:38:21 +00:00
fprintf ( asmfile , " \t %s " , QCC_VarAtOffset ( statements [ i ] . a , ( * pr_opcodes [ statements [ i ] . op ] . type_a ) - > size ) ) ;
2012-11-27 03:23:19 +00:00
fprintf ( asmfile , " /*%i*/ " , statements [ i ] . a ) ;
}
2004-08-23 01:38:21 +00:00
else
fprintf ( asmfile , " \t %i " , statements [ i ] . a ) ;
if ( pr_opcodes [ statements [ i ] . op ] . type_b ! = & type_void )
{
if ( pr_opcodes [ statements [ i ] . op ] . type_b )
2012-11-27 03:23:19 +00:00
{
2004-08-23 01:38:21 +00:00
fprintf ( asmfile , " , \t %s " , QCC_VarAtOffset ( statements [ i ] . b , ( * pr_opcodes [ statements [ i ] . op ] . type_b ) - > size ) ) ;
2012-11-27 03:23:19 +00:00
fprintf ( asmfile , " /*%i*/ " , statements [ i ] . b ) ;
}
2004-08-23 01:38:21 +00:00
else
fprintf ( asmfile , " , \t %i " , statements [ i ] . b ) ;
if ( pr_opcodes [ statements [ i ] . op ] . type_c ! = & type_void & & pr_opcodes [ statements [ i ] . op ] . associative = = ASSOC_LEFT )
{
if ( pr_opcodes [ statements [ i ] . op ] . type_c )
2012-11-27 03:23:19 +00:00
{
2004-08-23 01:38:21 +00:00
fprintf ( asmfile , " , \t %s " , QCC_VarAtOffset ( statements [ i ] . c , ( * pr_opcodes [ statements [ i ] . op ] . type_c ) - > size ) ) ;
2012-11-27 03:23:19 +00:00
fprintf ( asmfile , " /*%i*/ " , statements [ i ] . c ) ;
}
2004-08-23 01:38:21 +00:00
else
fprintf ( asmfile , " , \t %i " , statements [ i ] . c ) ;
}
}
2004-11-16 04:43:12 +00:00
else
{
if ( pr_opcodes [ statements [ i ] . op ] . type_c ! = & type_void )
{
if ( pr_opcodes [ statements [ i ] . op ] . type_c )
2012-11-27 03:23:19 +00:00
{
2004-11-16 04:43:12 +00:00
fprintf ( asmfile , " , \t %s " , QCC_VarAtOffset ( statements [ i ] . c , ( * pr_opcodes [ statements [ i ] . op ] . type_c ) - > size ) ) ;
2012-11-27 03:23:19 +00:00
fprintf ( asmfile , " /*%i*/ " , statements [ i ] . c ) ;
}
2004-11-16 04:43:12 +00:00
else
fprintf ( asmfile , " , \t %i " , statements [ i ] . c ) ;
}
}
2004-08-23 01:38:21 +00:00
}
2011-09-03 03:49:43 +00:00
fprintf ( asmfile , " ; /*%i*/ \n " , statement_linenums [ i ] ) ;
2004-08-23 01:38:21 +00:00
}
fprintf ( asmfile , " } \n \n " ) ;
}
# endif
/*
= = = = = = = = = = = =
PR_ParseImmediateStatements
Parse a function body
= = = = = = = = = = = =
*/
QCC_function_t * QCC_PR_ParseImmediateStatements ( QCC_type_t * type )
{
int i ;
QCC_function_t * f ;
QCC_def_t * defs [ MAX_PARMS + MAX_EXTRA_PARMS ] , * e2 ;
QCC_type_t * parm ;
pbool needsdone = false ;
2004-11-29 21:08:02 +00:00
conditional = 0 ;
2004-08-23 01:38:21 +00:00
2008-11-09 22:29:28 +00:00
expandedemptymacro = false ;
2004-08-23 01:38:21 +00:00
f = ( void * ) qccHunkAlloc ( sizeof ( QCC_function_t ) ) ;
//
// check for builtin function definition #1, #2, etc
//
// hexenC has void name() : 2;
2005-03-20 02:57:11 +00:00
if ( QCC_PR_CheckToken ( " # " ) | | QCC_PR_CheckToken ( " : " ) )
2004-08-23 01:38:21 +00:00
{
2009-08-29 14:56:42 +00:00
int binum = 0 ;
if ( pr_token_type = = tt_immediate
& & pr_immediate_type = = type_float
& & pr_immediate . _float = = ( int ) pr_immediate . _float )
binum = ( int ) pr_immediate . _float ;
else if ( pr_token_type = = tt_immediate & & pr_immediate_type = = type_integer )
binum = pr_immediate . _int ;
else
2004-08-23 01:38:21 +00:00
QCC_PR_ParseError ( ERR_BADBUILTINIMMEDIATE , " Bad builtin immediate " ) ;
2009-08-29 14:56:42 +00:00
f - > builtin = binum ;
2004-08-23 01:38:21 +00:00
QCC_PR_Lex ( ) ;
locals_start = locals_end = OFS_PARM0 ; //hmm...
return f ;
}
2005-03-20 02:57:11 +00:00
if ( QCC_PR_CheckKeyword ( keyword_external , " external " ) )
2005-02-09 19:32:30 +00:00
{ //reacc style builtin
if ( pr_token_type ! = tt_immediate
| | pr_immediate_type ! = type_float
| | pr_immediate . _float ! = ( int ) pr_immediate . _float )
QCC_PR_ParseError ( ERR_BADBUILTINIMMEDIATE , " Bad builtin immediate " ) ;
f - > builtin = ( int ) - pr_immediate . _float ;
QCC_PR_Lex ( ) ;
QCC_PR_Expect ( " ; " ) ;
locals_start = locals_end = OFS_PARM0 ; //hmm...
return f ;
}
2004-11-04 04:19:10 +00:00
if ( type - > num_parms < 0 )
QCC_PR_ParseError ( ERR_FUNCTIONWITHVARGS , " QC function with variable arguments and function body " ) ;
2011-05-15 13:23:13 +00:00
2004-08-23 01:38:21 +00:00
f - > builtin = 0 ;
//
// define the parms
//
2013-03-12 22:32:25 +00:00
locals_start = locals_end = FIRST_LOCAL ;
2004-08-23 01:38:21 +00:00
parm = type - > param ;
for ( i = 0 ; i < type - > num_parms ; i + + )
{
if ( ! * pr_parm_names [ i ] )
QCC_PR_ParseError ( ERR_PARAMWITHNONAME , " Parameter is not named " ) ;
2012-01-17 07:57:46 +00:00
defs [ i ] = QCC_PR_GetDef ( parm , pr_parm_names [ i ] , pr_scope , true , 0 , false ) ;
2004-08-23 01:38:21 +00:00
defs [ i ] - > references + + ;
if ( i < MAX_PARMS )
{
f - > parm_ofs [ i ] = defs [ i ] - > ofs ;
if ( i > 0 & & f - > parm_ofs [ i ] < f - > parm_ofs [ i - 1 ] )
QCC_Error ( ERR_BADPARAMORDER , " bad parm order " ) ;
if ( i > 0 & & f - > parm_ofs [ i ] ! = f - > parm_ofs [ i - 1 ] + defs [ i - 1 ] - > type - > size )
QCC_Error ( ERR_BADPARAMORDER , " parms not packed " ) ;
}
parm = parm - > next ;
}
f - > code = numstatements ;
if ( type - > num_parms > MAX_PARMS )
{
for ( i = MAX_PARMS ; i < type - > num_parms ; i + + )
{
if ( ! extra_parms [ i - MAX_PARMS ] )
{
e2 = ( QCC_def_t * ) qccHunkAlloc ( sizeof ( QCC_def_t ) ) ;
e2 - > name = " extra parm " ;
2013-03-12 22:32:25 +00:00
e2 - > ofs = QCC_GetFreeGlobalOffsetSpace ( 3 ) ;
2004-08-23 01:38:21 +00:00
extra_parms [ i - MAX_PARMS ] = e2 ;
}
2004-09-21 03:22:55 +00:00
extra_parms [ i - MAX_PARMS ] - > type = defs [ i ] - > type ;
2004-08-23 01:38:21 +00:00
if ( defs [ i ] - > type - > type ! = ev_vector )
QCC_PR_Statement ( & pr_opcodes [ OP_STORE_F ] , extra_parms [ i - MAX_PARMS ] , defs [ i ] , NULL ) ;
else
QCC_PR_Statement ( & pr_opcodes [ OP_STORE_V ] , extra_parms [ i - MAX_PARMS ] , defs [ i ] , NULL ) ;
}
}
QCC_RemapLockedTemps ( - 1 , - 1 ) ;
/*if (pr_classtype)
{
QCC_def_t * e , * e2 ;
2012-01-17 07:57:46 +00:00
e = QCC_PR_GetDef ( pr_classtype , " __oself " , pr_scope , true , 0 ) ;
e2 = QCC_PR_GetDef ( type_entity , " self " , NULL , true , 0 ) ;
QCC_FreeTemp ( QCC_PR_Statement ( & pr_opcodes [ OP_STORE_ENT ] , QCC_PR_DummyDef ( pr_classtype , " self " , pr_scope , 0 , e2 - > ofs , false ) , e , NULL ) ) ;
2004-08-23 01:38:21 +00:00
} */
//
// check for a state opcode
//
2005-03-20 02:57:11 +00:00
if ( QCC_PR_CheckToken ( " [ " ) )
2004-08-23 01:38:21 +00:00
QCC_PR_ParseState ( ) ;
2005-03-20 02:57:11 +00:00
if ( QCC_PR_CheckKeyword ( keyword_asm , " asm " ) )
2004-08-23 01:38:21 +00:00
{
QCC_PR_Expect ( " { " ) ;
2005-03-20 02:57:11 +00:00
while ( ! QCC_PR_CheckToken ( " } " ) )
2004-08-23 01:38:21 +00:00
QCC_PR_ParseAsm ( ) ;
}
else
{
2005-03-20 02:57:11 +00:00
if ( QCC_PR_CheckKeyword ( keyword_var , " var " ) ) //reacc support
2005-02-09 19:32:30 +00:00
{ //parse lots of locals
char * name ;
do {
name = QCC_PR_ParseName ( ) ;
QCC_PR_Expect ( " : " ) ;
2012-01-17 07:57:46 +00:00
e2 = QCC_PR_GetDef ( QCC_PR_ParseType ( false , false ) , name , pr_scope , true , 0 , false ) ;
2005-02-09 19:32:30 +00:00
QCC_PR_Expect ( " ; " ) ;
2005-03-20 02:57:11 +00:00
} while ( ! QCC_PR_CheckToken ( " { " ) ) ;
2005-02-09 19:32:30 +00:00
}
else
QCC_PR_Expect ( " { " ) ;
2004-08-23 01:38:21 +00:00
//
// parse regular statements
//
2005-03-20 02:57:11 +00:00
while ( ! QCC_PR_CheckToken ( " } " ) )
2004-08-25 03:41:27 +00:00
{
2004-08-23 01:38:21 +00:00
QCC_PR_ParseStatement ( ) ;
2004-08-25 03:41:27 +00:00
QCC_FreeTemps ( ) ;
}
2004-08-23 01:38:21 +00:00
}
2004-08-25 03:41:27 +00:00
QCC_FreeTemps ( ) ;
2004-08-23 01:38:21 +00:00
// this is cheap
2004-10-26 16:31:03 +00:00
// if (type->aux_type->type)
// if (statements[numstatements - 1].op != OP_RETURN)
// QCC_PR_ParseWarning(WARN_MISSINGRETURN, "%s: not all control paths return a value", pr_scope->name );
2004-08-23 01:38:21 +00:00
if ( f - > code = = numstatements )
needsdone = true ;
else if ( statements [ numstatements - 1 ] . op ! = OP_RETURN & & statements [ numstatements - 1 ] . op ! = OP_DONE )
needsdone = true ;
if ( num_gotos )
{
int j ;
for ( i = 0 ; i < num_gotos ; i + + )
{
for ( j = 0 ; j < num_labels ; j + + )
{
if ( ! strcmp ( pr_gotos [ i ] . name , pr_labels [ j ] . name ) )
{
2004-11-13 17:18:34 +00:00
if ( ! pr_opcodes [ statements [ pr_gotos [ i ] . statementno ] . op ] . type_a )
statements [ pr_gotos [ i ] . statementno ] . a + = pr_labels [ j ] . statementno - pr_gotos [ i ] . statementno ;
else if ( ! pr_opcodes [ statements [ pr_gotos [ i ] . statementno ] . op ] . type_b )
statements [ pr_gotos [ i ] . statementno ] . b + = pr_labels [ j ] . statementno - pr_gotos [ i ] . statementno ;
else
statements [ pr_gotos [ i ] . statementno ] . c + = pr_labels [ j ] . statementno - pr_gotos [ i ] . statementno ;
2004-08-23 01:38:21 +00:00
break ;
}
}
if ( j = = num_labels )
{
num_gotos = 0 ;
QCC_PR_ParseError ( ERR_NOLABEL , " Goto statement with no matching label \" %s \" " , pr_gotos [ i ] . name ) ;
}
}
num_gotos = 0 ;
}
if ( opt_return_only & & ! needsdone )
needsdone = QCC_FuncJumpsTo ( f - > code , numstatements , numstatements ) ;
// emit an end of statements opcode
if ( ! opt_return_only | | needsdone )
{
/*if (pr_classtype)
{
QCC_def_t * e , * e2 ;
e = QCC_PR_GetDef ( NULL , " __oself " , pr_scope , false , 0 ) ;
e2 = QCC_PR_GetDef ( NULL , " self " , NULL , false , 0 ) ;
2012-01-17 07:57:46 +00:00
QCC_FreeTemp ( QCC_PR_Statement ( & pr_opcodes [ OP_STORE_ENT ] , e , QCC_PR_DummyDef ( pr_classtype , " self " , pr_scope , 0 , e2 - > ofs , false ) , NULL ) ) ;
2004-08-23 01:38:21 +00:00
} */
QCC_PR_Statement ( pr_opcodes , 0 , 0 , NULL ) ;
}
else
optres_return_only + + ;
2004-10-28 07:03:56 +00:00
QCC_CheckForDeadAndMissingReturns ( f - > code , numstatements , type - > aux_type - > type ) ;
2004-08-23 01:38:21 +00:00
// if (opt_comexprremoval)
// QCC_CommonSubExpressionRemoval(f->code, numstatements);
QCC_RemapLockedTemps ( f - > code , numstatements ) ;
QCC_WriteAsmFunction ( pr_scope , f - > code , locals_start ) ;
QCC_Marshal_Locals ( f - > code , numstatements ) ;
2013-03-12 22:32:25 +00:00
if ( opt_compound_jumps )
QCC_CompoundJumps ( f - > code , numstatements ) ;
2004-08-23 01:38:21 +00:00
if ( num_labels )
num_labels = 0 ;
if ( num_continues )
{
num_continues = 0 ;
2008-11-09 22:29:28 +00:00
QCC_PR_ParseError ( ERR_ILLEGALCONTINUES , " %s: function contains illegal continues " , pr_scope - > name ) ;
2004-08-23 01:38:21 +00:00
}
if ( num_breaks )
{
num_breaks = 0 ;
2008-11-09 22:29:28 +00:00
QCC_PR_ParseError ( ERR_ILLEGALBREAKS , " %s: function contains illegal breaks " , pr_scope - > name ) ;
2004-08-23 01:38:21 +00:00
}
if ( num_cases )
{
num_cases = 0 ;
2008-11-09 22:29:28 +00:00
QCC_PR_ParseError ( ERR_ILLEGALCASES , " %s: function contains illegal cases " , pr_scope - > name ) ;
2004-08-23 01:38:21 +00:00
}
return f ;
}
void QCC_PR_ArrayRecurseDivideRegular ( QCC_def_t * array , QCC_def_t * index , int min , int max )
{
QCC_dstatement_t * st ;
QCC_def_t * eq ;
2012-07-05 19:42:36 +00:00
int stride ;
if ( array - > type - > type = = ev_vector )
stride = 3 ;
else
stride = 1 ; //struct arrays should be 1, so that every element can be accessed...
2004-08-23 01:38:21 +00:00
if ( min = = max | | min + 1 = = max )
{
2011-10-03 02:45:44 +00:00
eq = QCC_PR_Statement ( pr_opcodes + OP_LT_F , index , QCC_MakeFloatConst ( min + 0.5f ) , NULL ) ;
2004-11-08 11:44:05 +00:00
QCC_UnFreeTemp ( index ) ;
2011-07-08 18:59:48 +00:00
QCC_FreeTemp ( QCC_PR_Statement ( pr_opcodes + OP_IFNOT_I , eq , 0 , & st ) ) ;
2004-08-23 01:38:21 +00:00
st - > b = 2 ;
QCC_PR_Statement ( pr_opcodes + OP_RETURN , 0 , 0 , & st ) ;
2012-07-05 19:42:36 +00:00
st - > a = array - > ofs + min * stride ;
2004-08-23 01:38:21 +00:00
}
else
{
int mid = min + ( max - min ) / 2 ;
if ( max - min > 4 )
{
2011-10-03 02:45:44 +00:00
eq = QCC_PR_Statement ( pr_opcodes + OP_LT_F , index , QCC_MakeFloatConst ( mid + 0.5f ) , NULL ) ;
2004-11-08 11:44:05 +00:00
QCC_UnFreeTemp ( index ) ;
2011-07-08 18:59:48 +00:00
QCC_FreeTemp ( QCC_PR_Statement ( pr_opcodes + OP_IFNOT_I , eq , 0 , & st ) ) ;
2004-08-23 01:38:21 +00:00
}
else
st = NULL ;
QCC_PR_ArrayRecurseDivideRegular ( array , index , min , mid ) ;
if ( st )
st - > b = numstatements - ( st - statements ) ;
QCC_PR_ArrayRecurseDivideRegular ( array , index , mid , max ) ;
}
}
//the idea here is that we return a vector, the caller then figures out the extra 3rd.
//This is useful when we have a load of indexes.
void QCC_PR_ArrayRecurseDivideUsingVectors ( QCC_def_t * array , QCC_def_t * index , int min , int max )
{
QCC_dstatement_t * st ;
QCC_def_t * eq ;
if ( min = = max | | min + 1 = = max )
{
2011-10-03 02:45:44 +00:00
eq = QCC_PR_Statement ( pr_opcodes + OP_LT_F , index , QCC_MakeFloatConst ( min + 0.5f ) , NULL ) ;
2004-11-08 11:44:05 +00:00
QCC_UnFreeTemp ( index ) ;
2011-07-08 18:59:48 +00:00
QCC_FreeTemp ( QCC_PR_Statement ( pr_opcodes + OP_IFNOT_I , eq , 0 , & st ) ) ;
2004-08-23 01:38:21 +00:00
st - > b = 2 ;
QCC_PR_Statement ( pr_opcodes + OP_RETURN , 0 , 0 , & st ) ;
st - > a = array - > ofs + min * 3 ;
}
else
{
int mid = min + ( max - min ) / 2 ;
if ( max - min > 4 )
{
2011-10-03 02:45:44 +00:00
eq = QCC_PR_Statement ( pr_opcodes + OP_LT_F , index , QCC_MakeFloatConst ( mid + 0.5f ) , NULL ) ;
2004-11-08 11:44:05 +00:00
QCC_UnFreeTemp ( index ) ;
2011-07-08 18:59:48 +00:00
QCC_FreeTemp ( QCC_PR_Statement ( pr_opcodes + OP_IFNOT_I , eq , 0 , & st ) ) ;
2004-08-23 01:38:21 +00:00
}
else
st = NULL ;
QCC_PR_ArrayRecurseDivideUsingVectors ( array , index , min , mid ) ;
if ( st )
st - > b = numstatements - ( st - statements ) ;
QCC_PR_ArrayRecurseDivideUsingVectors ( array , index , mid , max ) ;
}
}
//returns a vector overlapping the result needed.
QCC_def_t * QCC_PR_EmitArrayGetVector ( QCC_def_t * array )
{
QCC_dfunction_t * df ;
QCC_def_t * temp , * index , * func ;
2012-07-05 19:42:36 +00:00
int numslots ;
//array shouldn't ever be a vector array
numslots = array - > arraysize * array - > type - > size ;
numslots = ( numslots + 2 ) / 3 ;
2013-03-12 22:44:00 +00:00
s_file = array - > s_file ;
2012-01-17 07:57:46 +00:00
func = QCC_PR_GetDef ( type_function , qcva ( " ArrayGetVec*%s " , array - > name ) , NULL , true , 0 , false ) ;
2004-08-23 01:38:21 +00:00
2004-11-04 04:19:10 +00:00
pr_scope = func ;
2011-08-16 04:12:15 +00:00
if ( numfunctions > = MAX_FUNCTIONS )
QCC_Error ( ERR_INTERNAL , " Too many function defs " ) ;
2004-08-23 01:38:21 +00:00
df = & functions [ numfunctions ] ;
numfunctions + + ;
df - > s_file = 0 ;
df - > s_name = QCC_CopyString ( func - > name ) ;
df - > first_statement = numstatements ;
df - > parm_size [ 0 ] = 1 ;
df - > numparms = 1 ;
2013-03-12 22:32:25 +00:00
locals_start = locals_end = FIRST_LOCAL ;
2012-01-17 07:57:46 +00:00
index = QCC_PR_GetDef ( type_float , " index___ " , func , true , 0 , false ) ;
2004-11-04 04:19:10 +00:00
index - > references + + ;
2012-01-17 07:57:46 +00:00
temp = QCC_PR_GetDef ( type_float , " div3___ " , func , true , 0 , false ) ;
2011-10-03 02:45:44 +00:00
QCC_PR_Statement3 ( pr_opcodes + OP_DIV_F , index , QCC_MakeFloatConst ( 3 ) , temp , false ) ;
2011-07-08 18:59:48 +00:00
QCC_PR_Statement3 ( pr_opcodes + OP_BITAND_F , temp , temp , temp , false ) ; //round down to int
2004-08-23 01:38:21 +00:00
2012-07-05 19:42:36 +00:00
QCC_PR_ArrayRecurseDivideUsingVectors ( array , temp , 0 , numslots ) ;
2004-08-23 01:38:21 +00:00
2011-10-03 02:45:44 +00:00
QCC_PR_Statement ( pr_opcodes + OP_RETURN , QCC_MakeFloatConst ( 0 ) , 0 , NULL ) ; //err... we didn't find it, give up.
2004-11-04 04:19:10 +00:00
QCC_PR_Statement ( pr_opcodes + OP_DONE , 0 , 0 , NULL ) ; //err... we didn't find it, give up.
2004-08-23 01:38:21 +00:00
G_FUNCTION ( func - > ofs ) = df - functions ;
func - > initialized = 1 ;
2013-03-12 22:32:25 +00:00
QCC_WriteAsmFunction ( pr_scope , df - > first_statement , df - > parm_start ) ;
QCC_Marshal_Locals ( df - > first_statement , numstatements ) ;
QCC_FreeTemps ( ) ;
df - > parm_start = locals_start ;
df - > numparms = locals_end - locals_start ;
2004-08-23 01:38:21 +00:00
return func ;
}
2004-11-04 04:19:10 +00:00
void QCC_PR_EmitArrayGetFunction ( QCC_def_t * scope , char * arrayname )
2004-08-23 01:38:21 +00:00
{
QCC_def_t * vectortrick ;
QCC_dfunction_t * df ;
QCC_def_t * def , * index ;
QCC_dstatement_t * st ;
QCC_def_t * eq ;
2005-09-14 04:36:07 +00:00
QCC_def_t * fasttrackpossible ;
2012-07-05 19:42:36 +00:00
int numslots ;
2005-09-14 04:36:07 +00:00
if ( flag_fasttrackarrays )
2012-01-17 07:57:46 +00:00
fasttrackpossible = QCC_PR_GetDef ( type_float , " __ext__fasttrackarrays " , NULL , true , 0 , false ) ;
2005-09-14 04:36:07 +00:00
else
fasttrackpossible = NULL ;
2013-03-12 22:44:00 +00:00
s_file = scope - > s_file ;
2008-10-05 02:55:01 +00:00
def = QCC_PR_GetDef ( NULL , arrayname , NULL , false , 0 , false ) ;
2004-08-23 01:38:21 +00:00
2012-07-05 19:42:36 +00:00
if ( def - > type - > type = = ev_vector )
numslots = def - > arraysize ;
else
numslots = def - > arraysize * def - > type - > size ;
if ( numslots > = 15 & & def - > type - > type ! = ev_vector )
2004-08-23 01:38:21 +00:00
vectortrick = QCC_PR_EmitArrayGetVector ( def ) ;
else
vectortrick = NULL ;
2004-11-04 04:19:10 +00:00
pr_scope = scope ;
2011-08-16 04:12:15 +00:00
if ( numfunctions > = MAX_FUNCTIONS )
QCC_Error ( ERR_INTERNAL , " Too many function defs " ) ;
2004-08-23 01:38:21 +00:00
df = & functions [ numfunctions ] ;
numfunctions + + ;
df - > s_file = 0 ;
2004-11-04 04:19:10 +00:00
df - > s_name = QCC_CopyString ( scope - > name ) ;
2004-08-23 01:38:21 +00:00
df - > first_statement = numstatements ;
df - > parm_size [ 0 ] = 1 ;
df - > numparms = 1 ;
2013-03-12 22:32:25 +00:00
locals_start = locals_end = FIRST_LOCAL ;
2012-01-17 07:57:46 +00:00
index = QCC_PR_GetDef ( type_float , " indexg___ " , def , true , 0 , false ) ;
2004-11-04 04:19:10 +00:00
G_FUNCTION ( scope - > ofs ) = df - functions ;
2004-08-23 01:38:21 +00:00
2005-09-14 04:36:07 +00:00
if ( fasttrackpossible )
{
2011-07-08 18:59:48 +00:00
QCC_PR_Statement ( pr_opcodes + OP_IFNOT_I , fasttrackpossible , NULL , & st ) ;
2005-09-14 04:36:07 +00:00
//fetch_gbl takes: (float size, variant array[]), float index, variant pos
//note that the array size is coded into the globals, one index before the array.
2008-07-17 07:41:59 +00:00
2012-07-05 19:42:36 +00:00
if ( def - > type - > type = = ev_vector )
2006-01-28 06:41:20 +00:00
QCC_PR_Statement3 ( & pr_opcodes [ OP_FETCH_GBL_V ] , def , index , & def_ret , true ) ;
2005-09-14 04:36:07 +00:00
else
2006-01-28 06:41:20 +00:00
QCC_PR_Statement3 ( & pr_opcodes [ OP_FETCH_GBL_F ] , def , index , & def_ret , true ) ;
2008-07-17 07:41:59 +00:00
2009-04-19 00:50:42 +00:00
QCC_FreeTemp ( QCC_PR_Statement ( & pr_opcodes [ OP_RETURN ] , & def_ret , NULL , NULL ) ) ;
2005-09-14 04:36:07 +00:00
//finish the jump
st - > b = & statements [ numstatements ] - st ;
}
2004-08-23 01:38:21 +00:00
if ( vectortrick )
{
2004-11-08 11:44:05 +00:00
QCC_def_t * div3 , * intdiv3 , * ret ;
//okay, we've got a function to retrieve the var as part of a vector.
//we need to work out which part, x/y/z that it's stored in.
//0,1,2 = i - ((int)i/3 *) 3;
2012-01-17 07:57:46 +00:00
div3 = QCC_PR_GetDef ( type_float , " div3___ " , def , true , 0 , false ) ;
intdiv3 = QCC_PR_GetDef ( type_float , " intdiv3___ " , def , true , 0 , false ) ;
2004-08-23 01:38:21 +00:00
2012-07-05 19:42:36 +00:00
eq = QCC_PR_Statement ( pr_opcodes + OP_GE_F , index , QCC_MakeFloatConst ( ( float ) numslots ) , NULL ) ; //escape clause - should call some sort of error function instead.. that'd rule!
2011-07-08 18:59:48 +00:00
QCC_FreeTemp ( QCC_PR_Statement ( pr_opcodes + OP_IFNOT_I , eq , 0 , & st ) ) ;
2004-08-23 01:38:21 +00:00
st - > b = 2 ;
2011-10-03 02:45:44 +00:00
QCC_PR_Statement ( pr_opcodes + OP_RETURN , QCC_MakeFloatConst ( 0 ) , 0 , & st ) ;
2004-08-23 01:38:21 +00:00
2004-11-08 11:44:05 +00:00
div3 - > references + + ;
2011-07-08 18:59:48 +00:00
QCC_PR_Statement3 ( pr_opcodes + OP_BITAND_F , index , index , index , false ) ;
2011-10-03 02:45:44 +00:00
QCC_PR_Statement3 ( pr_opcodes + OP_DIV_F , index , QCC_MakeFloatConst ( 3 ) , div3 , false ) ;
2011-07-08 18:59:48 +00:00
QCC_PR_Statement3 ( pr_opcodes + OP_BITAND_F , div3 , div3 , intdiv3 , false ) ;
2004-08-23 01:38:21 +00:00
2006-01-28 06:41:20 +00:00
QCC_PR_Statement3 ( pr_opcodes + OP_STORE_F , index , & def_parms [ 0 ] , NULL , false ) ;
QCC_PR_Statement3 ( pr_opcodes + OP_CALL1 , vectortrick , NULL , NULL , false ) ;
2004-08-23 01:38:21 +00:00
vectortrick - > references + + ;
2012-01-17 07:57:46 +00:00
ret = QCC_PR_GetDef ( type_vector , " vec__ " , pr_scope , true , 0 , false ) ;
2004-11-04 04:19:10 +00:00
ret - > references + = 4 ;
2006-01-28 06:41:20 +00:00
QCC_PR_Statement3 ( pr_opcodes + OP_STORE_V , & def_ret , ret , NULL , false ) ;
2009-04-19 00:50:42 +00:00
QCC_FreeTemp ( & def_ret ) ;
2004-08-23 01:38:21 +00:00
2011-10-03 02:45:44 +00:00
div3 = QCC_PR_Statement ( pr_opcodes + OP_MUL_F , intdiv3 , QCC_MakeFloatConst ( 3 ) , NULL ) ;
2006-01-28 06:41:20 +00:00
QCC_PR_Statement3 ( pr_opcodes + OP_SUB_F , index , div3 , index , false ) ;
2004-11-06 14:27:03 +00:00
QCC_FreeTemp ( div3 ) ;
2004-08-23 01:38:21 +00:00
2011-10-03 02:45:44 +00:00
eq = QCC_PR_Statement ( pr_opcodes + OP_LT_F , index , QCC_MakeFloatConst ( 0 + 0.5f ) , NULL ) ;
2011-07-08 18:59:48 +00:00
QCC_FreeTemp ( QCC_PR_Statement ( pr_opcodes + OP_IFNOT_I , eq , 0 , & st ) ) ;
2004-08-23 01:38:21 +00:00
st - > b = 2 ;
QCC_PR_Statement ( pr_opcodes + OP_RETURN , 0 , 0 , & st ) ;
st - > a = ret - > ofs + 0 ;
2011-10-03 02:45:44 +00:00
eq = QCC_PR_Statement ( pr_opcodes + OP_LT_F , index , QCC_MakeFloatConst ( 1 + 0.5f ) , NULL ) ;
2011-07-08 18:59:48 +00:00
QCC_FreeTemp ( QCC_PR_Statement ( pr_opcodes + OP_IFNOT_I , eq , 0 , & st ) ) ;
2004-08-23 01:38:21 +00:00
st - > b = 2 ;
QCC_PR_Statement ( pr_opcodes + OP_RETURN , 0 , 0 , & st ) ;
st - > a = ret - > ofs + 1 ;
2011-10-03 02:45:44 +00:00
eq = QCC_PR_Statement ( pr_opcodes + OP_LT_F , index , QCC_MakeFloatConst ( 2 + 0.5 ) , NULL ) ;
2011-07-08 18:59:48 +00:00
QCC_FreeTemp ( QCC_PR_Statement ( pr_opcodes + OP_IFNOT_I , eq , 0 , & st ) ) ;
2004-08-23 01:38:21 +00:00
st - > b = 2 ;
QCC_PR_Statement ( pr_opcodes + OP_RETURN , 0 , 0 , & st ) ;
st - > a = ret - > ofs + 2 ;
2004-11-06 14:27:03 +00:00
QCC_FreeTemp ( ret ) ;
QCC_FreeTemp ( index ) ;
2004-08-23 01:38:21 +00:00
}
else
{
2011-07-08 18:59:48 +00:00
QCC_PR_Statement3 ( pr_opcodes + OP_BITAND_F , index , index , index , false ) ;
2012-07-05 19:42:36 +00:00
QCC_PR_ArrayRecurseDivideRegular ( def , index , 0 , numslots ) ;
2004-08-23 01:38:21 +00:00
}
2011-10-03 02:45:44 +00:00
QCC_PR_Statement ( pr_opcodes + OP_RETURN , QCC_MakeFloatConst ( 0 ) , 0 , NULL ) ;
2004-08-23 01:38:21 +00:00
2004-11-04 04:19:10 +00:00
QCC_PR_Statement ( pr_opcodes + OP_DONE , 0 , 0 , NULL ) ;
QCC_WriteAsmFunction ( pr_scope , df - > first_statement , df - > parm_start ) ;
2013-03-12 22:32:25 +00:00
QCC_Marshal_Locals ( df - > first_statement , numstatements ) ;
2004-11-06 14:27:03 +00:00
QCC_FreeTemps ( ) ;
2013-03-12 22:32:25 +00:00
df - > parm_start = locals_start ;
df - > numparms = locals_end - locals_start ;
2004-08-23 01:38:21 +00:00
}
void QCC_PR_ArraySetRecurseDivide ( QCC_def_t * array , QCC_def_t * index , QCC_def_t * value , int min , int max )
{
QCC_dstatement_t * st ;
QCC_def_t * eq ;
2012-07-05 19:42:36 +00:00
int stride ;
if ( array - > type - > type = = ev_vector )
stride = 3 ;
else
stride = 1 ; //struct arrays should be 1, so that every element can be accessed...
2004-08-23 01:38:21 +00:00
if ( min = = max | | min + 1 = = max )
{
2011-10-03 02:45:44 +00:00
eq = QCC_PR_Statement ( pr_opcodes + OP_EQ_F , index , QCC_MakeFloatConst ( ( float ) min ) , NULL ) ;
2004-11-08 11:44:05 +00:00
QCC_UnFreeTemp ( index ) ;
2011-07-08 18:59:48 +00:00
QCC_FreeTemp ( QCC_PR_Statement ( pr_opcodes + OP_IFNOT_I , eq , 0 , & st ) ) ;
2004-08-23 01:38:21 +00:00
st - > b = 3 ;
2012-07-05 19:42:36 +00:00
if ( stride = = 3 )
2004-08-23 01:38:21 +00:00
QCC_PR_Statement ( pr_opcodes + OP_STORE_V , value , array , & st ) ;
else
QCC_PR_Statement ( pr_opcodes + OP_STORE_F , value , array , & st ) ;
2012-07-05 19:42:36 +00:00
st - > b = array - > ofs + min * stride ;
2004-08-23 01:38:21 +00:00
QCC_PR_Statement ( pr_opcodes + OP_RETURN , 0 , 0 , & st ) ;
}
else
{
int mid = min + ( max - min ) / 2 ;
if ( max - min > 4 )
{
2011-10-03 02:45:44 +00:00
eq = QCC_PR_Statement ( pr_opcodes + OP_LT_F , index , QCC_MakeFloatConst ( ( float ) mid ) , NULL ) ;
2004-11-08 11:44:05 +00:00
QCC_UnFreeTemp ( index ) ;
2011-07-08 18:59:48 +00:00
QCC_FreeTemp ( QCC_PR_Statement ( pr_opcodes + OP_IFNOT_I , eq , 0 , & st ) ) ;
2004-08-23 01:38:21 +00:00
}
else
st = NULL ;
QCC_PR_ArraySetRecurseDivide ( array , index , value , min , mid ) ;
if ( st )
st - > b = numstatements - ( st - statements ) ;
QCC_PR_ArraySetRecurseDivide ( array , index , value , mid , max ) ;
}
}
2004-11-04 04:19:10 +00:00
void QCC_PR_EmitArraySetFunction ( QCC_def_t * scope , char * arrayname )
2004-08-23 01:38:21 +00:00
{
QCC_dfunction_t * df ;
QCC_def_t * def , * index , * value ;
2005-09-14 04:36:07 +00:00
QCC_def_t * fasttrackpossible ;
2012-07-05 19:42:36 +00:00
int numslots ;
2005-09-14 04:36:07 +00:00
if ( flag_fasttrackarrays )
2012-01-17 07:57:46 +00:00
fasttrackpossible = QCC_PR_GetDef ( type_float , " __ext__fasttrackarrays " , NULL , true , 0 , false ) ;
2005-09-14 04:36:07 +00:00
else
fasttrackpossible = NULL ;
2013-03-12 22:44:00 +00:00
s_file = scope - > s_file ;
2008-10-05 02:55:01 +00:00
def = QCC_PR_GetDef ( NULL , arrayname , NULL , false , 0 , false ) ;
2004-11-04 04:19:10 +00:00
pr_scope = scope ;
2004-08-23 01:38:21 +00:00
2012-07-05 19:42:36 +00:00
if ( def - > type - > type = = ev_vector )
numslots = def - > arraysize ;
else
numslots = def - > arraysize * def - > type - > size ;
2011-08-16 04:12:15 +00:00
if ( numfunctions > = MAX_FUNCTIONS )
QCC_Error ( ERR_INTERNAL , " Too many function defs " ) ;
2004-08-23 01:38:21 +00:00
df = & functions [ numfunctions ] ;
numfunctions + + ;
df - > s_file = 0 ;
2004-11-04 04:19:10 +00:00
df - > s_name = QCC_CopyString ( scope - > name ) ;
2004-08-23 01:38:21 +00:00
df - > first_statement = numstatements ;
df - > parm_size [ 0 ] = 1 ;
df - > parm_size [ 1 ] = def - > type - > size ;
df - > numparms = 2 ;
2013-03-12 22:32:25 +00:00
locals_start = locals_end = FIRST_LOCAL ;
2012-01-17 07:57:46 +00:00
index = QCC_PR_GetDef ( type_float , " indexs___ " , def , true , 0 , false ) ;
value = QCC_PR_GetDef ( def - > type , " value___ " , def , true , 0 , false ) ;
2004-08-23 01:38:21 +00:00
2004-11-04 04:19:10 +00:00
G_FUNCTION ( scope - > ofs ) = df - functions ;
2005-09-14 04:36:07 +00:00
if ( fasttrackpossible )
{
QCC_dstatement_t * st ;
2011-07-08 18:59:48 +00:00
QCC_PR_Statement ( pr_opcodes + OP_IFNOT_I , fasttrackpossible , NULL , & st ) ;
2005-09-14 04:36:07 +00:00
//note that the array size is coded into the globals, one index before the array.
2006-01-28 06:41:20 +00:00
QCC_PR_Statement3 ( & pr_opcodes [ OP_CONV_FTOI ] , index , NULL , index , true ) ; //address stuff is integer based, but standard qc (which this accelerates in supported engines) only supports floats
2009-04-19 00:50:42 +00:00
QCC_PR_SimpleStatement ( OP_BOUNDCHECK , index - > ofs , ( ( int * ) qcc_pr_globals ) [ def - > ofs - 1 ] + 1 , 0 , true ) ; //annoy the programmer. :p
2005-09-14 04:36:07 +00:00
if ( def - > type - > size ! = 1 ) //shift it upwards for larger types
2011-10-03 02:45:44 +00:00
QCC_PR_Statement3 ( & pr_opcodes [ OP_MUL_I ] , index , QCC_MakeIntConst ( def - > type - > size ) , index , true ) ;
2006-01-28 06:41:20 +00:00
QCC_PR_Statement3 ( & pr_opcodes [ OP_GLOBALADDRESS ] , def , index , index , true ) ; //comes with built in add
2005-09-14 04:36:07 +00:00
if ( def - > type - > size > = 3 )
2006-01-28 06:41:20 +00:00
QCC_PR_Statement3 ( & pr_opcodes [ OP_STOREP_V ] , value , index , NULL , true ) ; //*b = a
2005-09-14 04:36:07 +00:00
else
2006-01-28 06:41:20 +00:00
QCC_PR_Statement3 ( & pr_opcodes [ OP_STOREP_F ] , value , index , NULL , true ) ;
2008-07-17 07:41:59 +00:00
QCC_PR_Statement ( & pr_opcodes [ OP_RETURN ] , value , NULL , NULL ) ;
2005-09-14 04:36:07 +00:00
//finish the jump
st - > b = & statements [ numstatements ] - st ;
}
2011-07-08 18:59:48 +00:00
QCC_PR_Statement3 ( pr_opcodes + OP_BITAND_F , index , index , index , false ) ;
2012-07-05 19:42:36 +00:00
QCC_PR_ArraySetRecurseDivide ( def , index , value , 0 , numslots ) ;
2004-08-23 01:38:21 +00:00
QCC_PR_Statement ( pr_opcodes + OP_DONE , 0 , 0 , NULL ) ;
2004-11-04 04:19:10 +00:00
QCC_WriteAsmFunction ( pr_scope , df - > first_statement , df - > parm_start ) ;
2013-03-12 22:32:25 +00:00
QCC_Marshal_Locals ( df - > first_statement , numstatements ) ;
2004-11-06 14:27:03 +00:00
QCC_FreeTemps ( ) ;
2013-03-12 22:32:25 +00:00
df - > parm_start = locals_start ;
df - > numparms = locals_end - locals_start ;
2004-08-23 01:38:21 +00:00
}
//register a def, and all of it's sub parts.
//only the main def is of use to the compiler.
//the subparts are emitted to the compiler and allow correct saving/loading
//be careful with fields, this doesn't allocated space, so will it allocate fields. It only creates defs at specified offsets.
2013-03-12 22:32:25 +00:00
QCC_def_t * QCC_PR_DummyDef ( QCC_type_t * type , char * name , QCC_def_t * scope , int arraysize , unsigned int ofs , int referable , unsigned int flags )
2004-08-23 01:38:21 +00:00
{
char array [ 64 ] ;
char newname [ 256 ] ;
2005-04-02 18:00:45 +00:00
int a ;
2004-08-23 01:38:21 +00:00
QCC_def_t * def , * first = NULL ;
# define KEYWORD(x) if (!STRCMP(name, #x) && keyword_##x) {if (keyword_##x)QCC_PR_ParseWarning(WARN_KEYWORDDISABLED, "\""#x"\" keyword used as variable name%s", keywords_coexist?" - coexisting":" - disabling");keyword_##x=keywords_coexist;}
if ( name )
{
KEYWORD ( var ) ;
KEYWORD ( thinktime ) ;
KEYWORD ( for ) ;
KEYWORD ( switch ) ;
KEYWORD ( case ) ;
KEYWORD ( default ) ;
KEYWORD ( goto ) ;
if ( type - > type ! = ev_function )
KEYWORD ( break ) ;
KEYWORD ( continue ) ;
KEYWORD ( state ) ;
KEYWORD ( string ) ;
if ( qcc_targetformat ! = QCF_HEXEN2 )
KEYWORD ( float ) ; //hmm... hexen2 requires this...
KEYWORD ( entity ) ;
KEYWORD ( vector ) ;
KEYWORD ( const ) ;
KEYWORD ( asm ) ;
}
2012-01-17 07:57:46 +00:00
for ( a = 0 ; a < ( arraysize ? arraysize : 1 ) ; a + + )
2004-08-23 01:38:21 +00:00
{
if ( a = = 0 )
* array = ' \0 ' ;
else
sprintf ( array , " [%i] " , a ) ;
if ( name )
sprintf ( newname , " %s%s " , name , array ) ;
else
* newname = * " " ;
// allocate a new def
def = ( void * ) qccHunkAlloc ( sizeof ( QCC_def_t ) ) ;
memset ( def , 0 , sizeof ( * def ) ) ;
def - > next = NULL ;
2012-01-17 07:57:46 +00:00
def - > arraysize = a ? 0 : arraysize ;
2004-08-23 01:38:21 +00:00
if ( name )
{
pr . def_tail - > next = def ;
pr . def_tail = def ;
}
if ( a > 0 )
def - > references + + ;
def - > s_line = pr_source_line ;
def - > s_file = s_file ;
2011-10-03 02:45:44 +00:00
if ( a )
def - > initialized = 1 ;
2004-08-23 01:38:21 +00:00
def - > name = ( void * ) qccHunkAlloc ( strlen ( newname ) + 1 ) ;
strcpy ( def - > name , newname ) ;
def - > type = type ;
2011-05-15 13:23:13 +00:00
def - > scope = scope ;
2013-03-12 22:32:25 +00:00
def - > saved = ! ! ( flags & GDF_SAVED ) ;
def - > constant = ! ! ( flags & GDF_CONST ) ;
def - > isstatic = ! ! ( flags & GDF_STATIC ) ;
2004-08-23 01:38:21 +00:00
def - > ofs = ofs + type - > size * a ;
if ( ! first )
first = def ;
// printf("Emited %s\n", newname);
if ( type - > type = = ev_struct )
{
int partnum ;
QCC_type_t * parttype ;
2011-05-15 13:23:13 +00:00
parttype = type - > param ;
2004-08-23 01:38:21 +00:00
for ( partnum = 0 ; partnum < type - > num_parms ; partnum + + )
{
switch ( parttype - > type )
{
case ev_vector :
sprintf ( newname , " %s%s.%s " , name , array , parttype - > name ) ;
2013-03-12 22:32:25 +00:00
QCC_PR_DummyDef ( parttype , newname , scope , 0 , ofs + type - > size * a + parttype - > ofs , false , flags | GDF_CONST ) ;
2004-08-23 01:38:21 +00:00
sprintf ( newname , " %s%s.%s_x " , name , array , parttype - > name ) ;
2013-03-12 22:32:25 +00:00
QCC_PR_DummyDef ( type_float , newname , scope , 0 , ofs + type - > size * a + parttype - > ofs , false , flags | GDF_CONST ) ;
2004-08-23 01:38:21 +00:00
sprintf ( newname , " %s%s.%s_y " , name , array , parttype - > name ) ;
2013-03-12 22:32:25 +00:00
QCC_PR_DummyDef ( type_float , newname , scope , 0 , ofs + type - > size * a + parttype - > ofs + 1 , false , flags | GDF_CONST ) ;
2004-08-23 01:38:21 +00:00
sprintf ( newname , " %s%s.%s_z " , name , array , parttype - > name ) ;
2013-03-12 22:32:25 +00:00
QCC_PR_DummyDef ( type_float , newname , scope , 0 , ofs + type - > size * a + parttype - > ofs + 2 , false , flags | GDF_CONST ) ;
2004-08-23 01:38:21 +00:00
break ;
case ev_float :
case ev_string :
case ev_entity :
2011-05-15 13:23:13 +00:00
case ev_field :
2004-08-23 01:38:21 +00:00
case ev_pointer :
case ev_integer :
case ev_struct :
case ev_union :
2005-05-04 14:45:00 +00:00
case ev_variant : //for lack of any better alternative
2004-08-23 01:38:21 +00:00
sprintf ( newname , " %s%s.%s " , name , array , parttype - > name ) ;
2013-03-12 22:32:25 +00:00
QCC_PR_DummyDef ( parttype , newname , scope , 0 , ofs + type - > size * a + parttype - > ofs , false , flags ) ;
2004-08-23 01:38:21 +00:00
break ;
case ev_function :
sprintf ( newname , " %s%s.%s " , name , array , parttype - > name ) ;
2013-03-12 22:32:25 +00:00
QCC_PR_DummyDef ( parttype , newname , scope , 0 , ofs + type - > size * a + parttype - > ofs , false , flags ) - > initialized = true ;
2004-08-23 01:38:21 +00:00
break ;
case ev_void :
break ;
}
parttype = parttype - > next ;
2011-05-15 13:23:13 +00:00
}
2004-08-23 01:38:21 +00:00
}
else if ( type - > type = = ev_vector )
{ //do the vector thing.
sprintf ( newname , " %s%s_x " , name , array ) ;
2013-03-12 22:32:25 +00:00
QCC_PR_DummyDef ( type_float , newname , scope , 0 , ofs + type - > size * a + 0 , referable , flags | GDF_CONST ) ;
2004-08-23 01:38:21 +00:00
sprintf ( newname , " %s%s_y " , name , array ) ;
2013-03-12 22:32:25 +00:00
QCC_PR_DummyDef ( type_float , newname , scope , 0 , ofs + type - > size * a + 1 , referable , flags | GDF_CONST ) ;
2004-08-23 01:38:21 +00:00
sprintf ( newname , " %s%s_z " , name , array ) ;
2013-03-12 22:32:25 +00:00
QCC_PR_DummyDef ( type_float , newname , scope , 0 , ofs + type - > size * a + 2 , referable , flags | GDF_CONST ) ;
2004-08-23 01:38:21 +00:00
}
else if ( type - > type = = ev_field )
{
if ( type - > aux_type - > type = = ev_vector )
{
//do the vector thing.
sprintf ( newname , " %s%s_x " , name , array ) ;
2013-03-12 22:32:25 +00:00
QCC_PR_DummyDef ( type_floatfield , newname , scope , 0 , ofs + type - > size * a + 0 , referable , flags | GDF_CONST ) ;
2004-08-23 01:38:21 +00:00
sprintf ( newname , " %s%s_y " , name , array ) ;
2013-03-12 22:32:25 +00:00
QCC_PR_DummyDef ( type_floatfield , newname , scope , 0 , ofs + type - > size * a + 1 , referable , flags | GDF_CONST ) ;
2004-08-23 01:38:21 +00:00
sprintf ( newname , " %s%s_z " , name , array ) ;
2013-03-12 22:32:25 +00:00
QCC_PR_DummyDef ( type_floatfield , newname , scope , 0 , ofs + type - > size * a + 2 , referable , flags | GDF_CONST ) ;
2004-08-23 01:38:21 +00:00
}
}
2011-11-08 06:00:35 +00:00
first - > deftail = pr . def_tail ;
2004-08-23 01:38:21 +00:00
}
if ( referable )
{
2005-02-09 19:32:30 +00:00
if ( ! pHash_Get ( & globalstable , " end_sys_fields " ) )
2004-08-23 01:38:21 +00:00
first - > references + + ; //anything above needs to be left in, and so warning about not using it is just going to pee people off.
2012-01-17 07:57:46 +00:00
if ( ! arraysize & & first - > type - > type ! = ev_field )
2004-08-23 01:38:21 +00:00
first - > constant = false ;
2004-11-04 04:19:10 +00:00
if ( scope )
2005-02-09 19:32:30 +00:00
pHash_Add ( & localstable , first - > name , first , qccHunkAlloc ( sizeof ( bucket_t ) ) ) ;
2004-08-23 01:38:21 +00:00
else
2005-02-09 19:32:30 +00:00
pHash_Add ( & globalstable , first - > name , first , qccHunkAlloc ( sizeof ( bucket_t ) ) ) ;
2004-08-23 01:38:21 +00:00
2004-11-04 04:19:10 +00:00
if ( ! scope & & asmfile )
2004-08-23 01:38:21 +00:00
fprintf ( asmfile , " %s %s; \n " , TypeName ( first - > type ) , first - > name ) ;
}
return first ;
}
/*
= = = = = = = = = = = =
PR_GetDef
If type is NULL , it will match any type
If allocate is true , a new def will be allocated if it can ' t be found
2012-01-17 07:57:46 +00:00
If arraysize = 0 , its not an array and has 1 element .
If arraysize > 0 , its an array and requires array notation
If arraysize < 0 , its an array with undefined size - GetDef will fail if its not already allocated .
2004-08-23 01:38:21 +00:00
= = = = = = = = = = = =
*/
2013-03-12 22:32:25 +00:00
QCC_def_t * QCC_PR_GetDef ( QCC_type_t * type , char * name , QCC_def_t * scope , pbool allocate , int arraysize , unsigned int flags )
2004-08-23 01:38:21 +00:00
{
int ofs ;
QCC_def_t * def ;
// char element[MAX_NAME];
2009-03-29 23:47:29 +00:00
QCC_def_t * foundstatic = NULL ;
2004-08-23 01:38:21 +00:00
2012-01-17 07:57:46 +00:00
if ( ! allocate )
arraysize = - 1 ;
2004-08-23 01:38:21 +00:00
if ( scope )
{
def = Hash_Get ( & localstable , name ) ;
while ( def )
{
if ( def - > scope & & def - > scope ! = scope )
{
def = Hash_GetNext ( & localstable , name , def ) ;
continue ; // in a different function
}
if ( type & & typecmp ( def - > type , type ) )
2008-11-09 22:29:28 +00:00
QCC_PR_ParseErrorPrintDef ( ERR_TYPEMISMATCHREDEC , def , " Type mismatch on redeclaration of %s. %s, should be %s " , name , TypeName ( type ) , TypeName ( def - > type ) ) ;
2012-01-17 07:57:46 +00:00
if ( def - > arraysize ! = arraysize & & arraysize > = 0 )
2008-11-09 22:29:28 +00:00
QCC_PR_ParseErrorPrintDef ( ERR_TYPEMISMATCHARRAYSIZE , def , " Array sizes for redecleration of %s do not match " , name ) ;
2004-08-23 01:38:21 +00:00
if ( allocate & & scope )
{
QCC_PR_ParseWarning ( WARN_DUPLICATEDEFINITION , " %s duplicate definition ignored " , name ) ;
QCC_PR_ParsePrintDef ( WARN_DUPLICATEDEFINITION , def ) ;
// if (!scope)
// QCC_PR_ParsePrintDef(def);
}
return def ;
}
}
def = Hash_Get ( & globalstable , name ) ;
while ( def )
{
if ( def - > scope & & def - > scope ! = scope )
{
def = Hash_GetNext ( & globalstable , name , def ) ;
continue ; // in a different function
}
------------------------------------------------------------------------
r4169 | acceptthis | 2013-01-17 08:55:12 +0000 (Thu, 17 Jan 2013) | 31 lines
removed MAX_VISEDICTS limit.
PEXT2_REPLACEMENTDELTAS tweaked, now has 4 million entity limit. still not enabled by default.
TE_BEAM now maps to a separate TEQW_BEAM to avoid conflicts with QW.
added android multitouch emulation for windows/rawinput (in_simulatemultitouch).
split topcolor/bottomcolor from scoreboard, for dp's colormap|1024 feature.
now using utf-8 for windows consoles.
qcc warnings/errors now give clickable console links for quick+easy editing.
disabled menutint when the currently active item changes contrast or gamma (for OneManClan).
Added support for drawfont/drawfontscale.
tweaked the qcvm a little to reduce the number of pointers.
.doll file loading. still experimental and will likely crash. requires csqc active, even if its a dummy progs. this will be fixed in time. Still other things that need cleaning up.
windows: gl_font "?" shows the standard windows font-selection dialog, and can be used to select windows fonts. not all work. and you probably don't want to use windings.
fixed splitscreen support when playing mvds. added mini-scoreboards to splitscreen.
editor/debugger now shows asm if there's no linenumber info. also, pressing f1 for help shows the shortcuts.
Added support for .framegroups files for psk(psa) and iqm formats.
True support for ezquake's colour codes. Mutually exclusive with background colours.
path command output slightly more readable.
added support for digest_hex (MD4, SHA1, CRC16).
skingroups now colourmap correctly.
Fix terrain colour hints, and litdata from the wrong bsp.
fix ftp dual-homed issue. support epsv command, and enable ipv6 (eprt still not supported).
remove d3d11 compilation from the makefile. the required headers are not provided by mingw, and are not available to the build bot, so don't bother.
fix v *= v.x and similar opcodes.
fteqcc: fixed support for áéÃóú type chars in names. utf-8 files now properly supported (even with the utf-8 bom/identifier). utf-16 also supported.
fteqcc: fixed '#if 1 == 3 && 4' parsing.
fteqcc: -Werror acts on the warning, rather than as a separate error. Line numbers are thus more readable.
fteqcc: copyright message now includes compile date instead.
fteqccgui: the treeview control is now coloured depending on whether there were warnings/errors in the last compile.
fteqccgui: the output window is now focused and scrolls down as compilation progresses.
pr_dumpplatform command dumps out some pragmas to convert more serious warnings to errors. This is to avoid the infamous 'fteqcc sucks cos my code sucks' issue.
rewrote prespawn/modelist/soundlist code. server tracks progress now.
------------------------------------------------------------------------
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4167 fc73d0e0-1445-4013-8a0c-d673dee63da5
2013-03-12 22:29:40 +00:00
if ( def - > isstatic & & strcmp ( strings + def - > s_file , strings + s_file ) )
2009-03-29 23:47:29 +00:00
{ //warn? or would that be pointless?
foundstatic = def ;
def = Hash_GetNext ( & globalstable , name , def ) ;
continue ; // in a different function
}
2004-08-23 01:38:21 +00:00
if ( type & & typecmp ( def - > type , type ) )
{
if ( ! pr_scope )
2012-11-27 03:23:19 +00:00
{
if ( typecmp_lax ( def - > type , type ) )
{
//unequal even when we're lax
QCC_PR_ParseError ( ERR_TYPEMISMATCHREDEC , " Type mismatch on redeclaration of %s. %s, should be %s " , name , TypeName ( type ) , TypeName ( def - > type ) ) ;
}
else
QCC_PR_ParseWarning ( WARN_LAXCAST , " Optional arguments differ on redeclaration of %s. %s, should be %s " , name , TypeName ( type ) , TypeName ( def - > type ) ) ;
}
2004-08-23 01:38:21 +00:00
}
2012-01-17 07:57:46 +00:00
if ( def - > arraysize ! = arraysize & & arraysize > = 0 )
2008-11-09 22:29:28 +00:00
QCC_PR_ParseErrorPrintDef ( ERR_TYPEMISMATCHARRAYSIZE , def , " Array sizes for redecleration of %s do not match " , name ) ;
2004-08-23 01:38:21 +00:00
if ( allocate & & scope )
{
if ( pr_scope )
{ //warn? or would that be pointless?
def = Hash_GetNext ( & globalstable , name , def ) ;
continue ; // in a different function
}
QCC_PR_ParseWarning ( WARN_DUPLICATEDEFINITION , " %s duplicate definition ignored " , name ) ;
QCC_PR_ParsePrintDef ( WARN_DUPLICATEDEFINITION , def ) ;
// if (!scope)
// QCC_PR_ParsePrintDef(def);
}
return def ;
}
2005-02-09 19:32:30 +00:00
if ( pHash_Get ! = & Hash_Get & & ! allocate ) //do we want to try case insensative too?
{
if ( scope )
{
def = pHash_Get ( & localstable , name ) ;
while ( def )
{
if ( def - > scope & & def - > scope ! = scope )
{
def = pHash_GetNext ( & localstable , name , def ) ;
continue ; // in a different function
}
if ( type & & typecmp ( def - > type , type ) )
QCC_PR_ParseError ( ERR_TYPEMISMATCHREDEC , " Type mismatch on redeclaration of %s. %s, should be %s " , name , TypeName ( type ) , TypeName ( def - > type ) ) ;
2012-01-17 07:57:46 +00:00
if ( def - > arraysize ! = arraysize & & arraysize > = 0 )
2005-02-09 19:32:30 +00:00
QCC_PR_ParseError ( ERR_TYPEMISMATCHARRAYSIZE , " Array sizes for redecleration of %s do not match " , name ) ;
if ( allocate & & scope )
{
QCC_PR_ParseWarning ( WARN_DUPLICATEDEFINITION , " %s duplicate definition ignored " , name ) ;
QCC_PR_ParsePrintDef ( WARN_DUPLICATEDEFINITION , def ) ;
// if (!scope)
// QCC_PR_ParsePrintDef(def);
}
return def ;
}
}
def = pHash_Get ( & globalstable , name ) ;
while ( def )
{
if ( def - > scope & & def - > scope ! = scope )
{
def = pHash_GetNext ( & globalstable , name , def ) ;
continue ; // in a different function
}
2009-03-29 23:47:29 +00:00
if ( def - > isstatic & & def - > s_file ! = s_file )
{ //warn? or would that be pointless?
foundstatic = def ;
def = Hash_GetNext ( & globalstable , name , def ) ;
continue ; // in a different function
}
2005-02-09 19:32:30 +00:00
if ( type & & typecmp ( def - > type , type ) )
{
if ( ! pr_scope )
2012-11-27 03:23:19 +00:00
{
if ( typecmp_lax ( def - > type , type ) )
{
//unequal even when we're lax
QCC_PR_ParseError ( ERR_TYPEMISMATCHREDEC , " Type mismatch on redeclaration of %s. %s, should be %s " , name , TypeName ( type ) , TypeName ( def - > type ) ) ;
}
else
QCC_PR_ParseWarning ( WARN_LAXCAST , " Optional arguments differ on redeclaration of %s. %s, should be %s " , name , TypeName ( type ) , TypeName ( def - > type ) ) ;
}
2005-02-09 19:32:30 +00:00
}
2012-01-17 07:57:46 +00:00
if ( def - > arraysize ! = arraysize & & arraysize > = 0 )
2005-02-09 19:32:30 +00:00
QCC_PR_ParseError ( ERR_TYPEMISMATCHARRAYSIZE , " Array sizes for redecleration of %s do not match " , name ) ;
if ( allocate & & scope )
{
if ( pr_scope )
{ //warn? or would that be pointless?
def = pHash_GetNext ( & globalstable , name , def ) ;
continue ; // in a different function
}
QCC_PR_ParseWarning ( WARN_DUPLICATEDEFINITION , " %s duplicate definition ignored " , name ) ;
QCC_PR_ParsePrintDef ( WARN_DUPLICATEDEFINITION , def ) ;
// if (!scope)
// QCC_PR_ParsePrintDef(def);
}
return def ;
}
}
2009-03-29 23:47:29 +00:00
if ( foundstatic & & ! allocate )
{
QCC_PR_ParseWarning ( WARN_DUPLICATEDEFINITION , " %s defined static " , name ) ;
QCC_PR_ParsePrintDef ( WARN_DUPLICATEDEFINITION , foundstatic ) ;
}
2004-08-23 01:38:21 +00:00
if ( ! allocate )
return NULL ;
2009-03-29 23:47:29 +00:00
2012-01-17 07:57:46 +00:00
if ( arraysize < 0 )
2004-08-23 01:38:21 +00:00
{
QCC_PR_ParseError ( ERR_ARRAYNEEDSSIZE , " First declaration of array %s with no size " , name ) ;
}
2005-01-04 08:22:31 +00:00
if ( scope )
{
------------------------------------------------------------------------
r4169 | acceptthis | 2013-01-17 08:55:12 +0000 (Thu, 17 Jan 2013) | 31 lines
removed MAX_VISEDICTS limit.
PEXT2_REPLACEMENTDELTAS tweaked, now has 4 million entity limit. still not enabled by default.
TE_BEAM now maps to a separate TEQW_BEAM to avoid conflicts with QW.
added android multitouch emulation for windows/rawinput (in_simulatemultitouch).
split topcolor/bottomcolor from scoreboard, for dp's colormap|1024 feature.
now using utf-8 for windows consoles.
qcc warnings/errors now give clickable console links for quick+easy editing.
disabled menutint when the currently active item changes contrast or gamma (for OneManClan).
Added support for drawfont/drawfontscale.
tweaked the qcvm a little to reduce the number of pointers.
.doll file loading. still experimental and will likely crash. requires csqc active, even if its a dummy progs. this will be fixed in time. Still other things that need cleaning up.
windows: gl_font "?" shows the standard windows font-selection dialog, and can be used to select windows fonts. not all work. and you probably don't want to use windings.
fixed splitscreen support when playing mvds. added mini-scoreboards to splitscreen.
editor/debugger now shows asm if there's no linenumber info. also, pressing f1 for help shows the shortcuts.
Added support for .framegroups files for psk(psa) and iqm formats.
True support for ezquake's colour codes. Mutually exclusive with background colours.
path command output slightly more readable.
added support for digest_hex (MD4, SHA1, CRC16).
skingroups now colourmap correctly.
Fix terrain colour hints, and litdata from the wrong bsp.
fix ftp dual-homed issue. support epsv command, and enable ipv6 (eprt still not supported).
remove d3d11 compilation from the makefile. the required headers are not provided by mingw, and are not available to the build bot, so don't bother.
fix v *= v.x and similar opcodes.
fteqcc: fixed support for áéÃóú type chars in names. utf-8 files now properly supported (even with the utf-8 bom/identifier). utf-16 also supported.
fteqcc: fixed '#if 1 == 3 && 4' parsing.
fteqcc: -Werror acts on the warning, rather than as a separate error. Line numbers are thus more readable.
fteqcc: copyright message now includes compile date instead.
fteqccgui: the treeview control is now coloured depending on whether there were warnings/errors in the last compile.
fteqccgui: the output window is now focused and scrolls down as compilation progresses.
pr_dumpplatform command dumps out some pragmas to convert more serious warnings to errors. This is to avoid the infamous 'fteqcc sucks cos my code sucks' issue.
rewrote prespawn/modelist/soundlist code. server tracks progress now.
------------------------------------------------------------------------
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4167 fc73d0e0-1445-4013-8a0c-d673dee63da5
2013-03-12 22:29:40 +00:00
def = QCC_PR_GetDef ( type , name , NULL , false , arraysize , false ) ;
if ( def )
{
2005-09-28 16:57:10 +00:00
QCC_PR_ParseWarning ( WARN_SAMENAMEASGLOBAL , " Local \" %s \" defined with name of a global " , name ) ;
------------------------------------------------------------------------
r4169 | acceptthis | 2013-01-17 08:55:12 +0000 (Thu, 17 Jan 2013) | 31 lines
removed MAX_VISEDICTS limit.
PEXT2_REPLACEMENTDELTAS tweaked, now has 4 million entity limit. still not enabled by default.
TE_BEAM now maps to a separate TEQW_BEAM to avoid conflicts with QW.
added android multitouch emulation for windows/rawinput (in_simulatemultitouch).
split topcolor/bottomcolor from scoreboard, for dp's colormap|1024 feature.
now using utf-8 for windows consoles.
qcc warnings/errors now give clickable console links for quick+easy editing.
disabled menutint when the currently active item changes contrast or gamma (for OneManClan).
Added support for drawfont/drawfontscale.
tweaked the qcvm a little to reduce the number of pointers.
.doll file loading. still experimental and will likely crash. requires csqc active, even if its a dummy progs. this will be fixed in time. Still other things that need cleaning up.
windows: gl_font "?" shows the standard windows font-selection dialog, and can be used to select windows fonts. not all work. and you probably don't want to use windings.
fixed splitscreen support when playing mvds. added mini-scoreboards to splitscreen.
editor/debugger now shows asm if there's no linenumber info. also, pressing f1 for help shows the shortcuts.
Added support for .framegroups files for psk(psa) and iqm formats.
True support for ezquake's colour codes. Mutually exclusive with background colours.
path command output slightly more readable.
added support for digest_hex (MD4, SHA1, CRC16).
skingroups now colourmap correctly.
Fix terrain colour hints, and litdata from the wrong bsp.
fix ftp dual-homed issue. support epsv command, and enable ipv6 (eprt still not supported).
remove d3d11 compilation from the makefile. the required headers are not provided by mingw, and are not available to the build bot, so don't bother.
fix v *= v.x and similar opcodes.
fteqcc: fixed support for áéÃóú type chars in names. utf-8 files now properly supported (even with the utf-8 bom/identifier). utf-16 also supported.
fteqcc: fixed '#if 1 == 3 && 4' parsing.
fteqcc: -Werror acts on the warning, rather than as a separate error. Line numbers are thus more readable.
fteqcc: copyright message now includes compile date instead.
fteqccgui: the treeview control is now coloured depending on whether there were warnings/errors in the last compile.
fteqccgui: the output window is now focused and scrolls down as compilation progresses.
pr_dumpplatform command dumps out some pragmas to convert more serious warnings to errors. This is to avoid the infamous 'fteqcc sucks cos my code sucks' issue.
rewrote prespawn/modelist/soundlist code. server tracks progress now.
------------------------------------------------------------------------
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4167 fc73d0e0-1445-4013-8a0c-d673dee63da5
2013-03-12 22:29:40 +00:00
QCC_PR_ParsePrintDef ( WARN_SAMENAMEASGLOBAL , def ) ;
}
2005-01-04 08:22:31 +00:00
}
2004-08-23 01:38:21 +00:00
ofs = numpr_globals ;
2012-01-17 07:57:46 +00:00
if ( arraysize )
2004-08-23 01:38:21 +00:00
{ //write the array size
2013-03-12 22:32:25 +00:00
if ( scope & & ! ( flags & ( GDF_CONST | GDF_STATIC ) ) )
ofs = QCC_GetFreeLocalOffsetSpace ( 1 + ( type - > size * arraysize ) ) ;
else
ofs = QCC_GetFreeGlobalOffsetSpace ( 1 + ( type - > size * arraysize ) ) ;
2004-08-23 01:38:21 +00:00
2012-07-05 19:42:36 +00:00
//An array needs the size written first. This is a hexen2 opcode thing.
//note that for struct emulation, union and struct arrays, the size is the total size of global slots, rather than array elements
if ( type - > type = = ev_vector )
( ( int * ) qcc_pr_globals ) [ ofs ] = arraysize - 1 ;
else
( ( int * ) qcc_pr_globals ) [ ofs ] = ( arraysize * type - > size ) - 1 ;
2004-08-23 01:38:21 +00:00
ofs + + ;
}
2013-03-12 22:32:25 +00:00
else if ( scope & & ! ( flags & ( GDF_CONST | GDF_STATIC ) ) )
ofs = QCC_GetFreeLocalOffsetSpace ( type - > size ) ;
2004-08-23 01:38:21 +00:00
else
2013-03-12 22:32:25 +00:00
ofs = QCC_GetFreeGlobalOffsetSpace ( type - > size ) ;
2004-08-23 01:38:21 +00:00
2013-03-12 22:32:25 +00:00
def = QCC_PR_DummyDef ( type , name , scope , arraysize , ofs , true , flags ) ;
2004-08-23 01:38:21 +00:00
2013-03-12 22:32:25 +00:00
if ( scope & & ! ( flags & ( GDF_CONST | GDF_STATIC ) ) )
2004-08-23 01:38:21 +00:00
{
def - > nextlocal = pr . localvars ;
pr . localvars = def ;
}
return def ;
}
2008-10-05 02:55:01 +00:00
QCC_def_t * QCC_PR_DummyFieldDef ( QCC_type_t * type , char * name , QCC_def_t * scope , int arraysize , unsigned int * fieldofs , pbool saved )
2004-08-23 01:38:21 +00:00
{
char array [ 64 ] ;
char newname [ 256 ] ;
2004-12-24 08:45:56 +00:00
int a , parms ;
2004-08-23 01:38:21 +00:00
QCC_def_t * def , * first = NULL ;
unsigned int maxfield , startfield ;
QCC_type_t * ftype ;
pbool isunion ;
startfield = * fieldofs ;
maxfield = startfield ;
2012-01-17 07:57:46 +00:00
for ( a = 0 ; a < ( arraysize ? arraysize : 1 ) ; a + + )
2004-08-23 01:38:21 +00:00
{
if ( a = = 0 )
* array = ' \0 ' ;
else
sprintf ( array , " [%i] " , a ) ;
if ( * name )
{
sprintf ( newname , " %s%s " , name , array ) ;
// allocate a new def
def = ( void * ) qccHunkAlloc ( sizeof ( QCC_def_t ) ) ;
memset ( def , 0 , sizeof ( * def ) ) ;
def - > next = NULL ;
def - > arraysize = arraysize ;
pr . def_tail - > next = def ;
pr . def_tail = def ;
def - > s_line = pr_source_line ;
def - > s_file = s_file ;
def - > name = ( void * ) qccHunkAlloc ( strlen ( newname ) + 1 ) ;
strcpy ( def - > name , newname ) ;
def - > type = type ;
2011-05-15 13:23:13 +00:00
def - > scope = scope ;
2004-08-23 01:38:21 +00:00
2013-03-12 22:32:25 +00:00
def - > ofs = scope ? QCC_GetFreeLocalOffsetSpace ( 1 ) : QCC_GetFreeGlobalOffsetSpace ( 1 ) ;
2004-08-23 01:38:21 +00:00
( ( int * ) qcc_pr_globals ) [ def - > ofs ] = * fieldofs ;
2010-12-22 00:13:49 +00:00
fieldofs + + ;
2004-08-23 01:38:21 +00:00
if ( ! first )
first = def ;
}
else
{
def = NULL ;
}
// printf("Emited %s\n", newname);
if ( ( type ) - > type = = ev_struct | | ( type ) - > type = = ev_union )
{
int partnum ;
QCC_type_t * parttype ;
if ( def )
def - > references + + ;
parttype = ( type ) - > param ;
isunion = ( ( type ) - > type = = ev_union ) ;
for ( partnum = 0 , parms = ( type ) - > num_parms ; partnum < parms ; partnum + + )
{
switch ( parttype - > type )
{
case ev_union :
case ev_struct :
if ( * name )
sprintf ( newname , " %s%s.%s " , name , array , parttype - > name ) ;
else
sprintf ( newname , " %s%s " , parttype - > name , array ) ;
2008-10-05 02:55:01 +00:00
def = QCC_PR_DummyFieldDef ( parttype , newname , scope , 1 , fieldofs , saved ) ;
2004-08-23 01:38:21 +00:00
break ;
case ev_float :
case ev_string :
case ev_vector :
case ev_entity :
2004-12-03 16:08:43 +00:00
case ev_field :
2004-08-23 01:38:21 +00:00
case ev_pointer :
case ev_integer :
2005-05-04 14:45:00 +00:00
case ev_variant :
2004-08-23 01:38:21 +00:00
if ( * name )
sprintf ( newname , " %s%s.%s " , name , array , parttype - > name ) ;
else
sprintf ( newname , " %s%s " , parttype - > name , array ) ;
2012-02-05 01:38:51 +00:00
ftype = QCC_PR_NewType ( " FIELD TYPE " , ev_field , false ) ;
2004-08-23 01:38:21 +00:00
ftype - > aux_type = parttype ;
2004-12-12 18:43:57 +00:00
if ( parttype - > type = = ev_vector )
ftype - > size = parttype - > size ; //vector fields create a _y and _z too, so we need this still.
2012-01-17 07:57:46 +00:00
def = QCC_PR_GetDef ( NULL , newname , scope , false , 0 , saved ) ;
2004-08-23 01:38:21 +00:00
if ( ! def )
{
2012-01-17 07:57:46 +00:00
def = QCC_PR_GetDef ( ftype , newname , scope , true , 0 , saved ) ;
2004-08-23 01:38:21 +00:00
}
else
{
QCC_PR_ParseWarning ( WARN_CONFLICTINGUNIONMEMBER , " conflicting offsets for union/struct expansion of %s. Ignoring new def. " , newname ) ;
QCC_PR_ParsePrintDef ( WARN_CONFLICTINGUNIONMEMBER , def ) ;
}
break ;
case ev_function :
if ( * name )
sprintf ( newname , " %s%s.%s " , name , array , parttype - > name ) ;
else
sprintf ( newname , " %s%s " , parttype - > name , array ) ;
2012-02-05 01:38:51 +00:00
ftype = QCC_PR_NewType ( " FIELD TYPE " , ev_field , false ) ;
2004-08-23 01:38:21 +00:00
ftype - > aux_type = parttype ;
2012-01-17 07:57:46 +00:00
def = QCC_PR_GetDef ( ftype , newname , scope , true , 0 , saved ) ;
2004-08-23 01:38:21 +00:00
def - > initialized = true ;
( ( int * ) qcc_pr_globals ) [ def - > ofs ] = * fieldofs ;
* fieldofs + = parttype - > size ;
break ;
case ev_void :
break ;
}
if ( * fieldofs > maxfield )
maxfield = * fieldofs ;
if ( isunion )
* fieldofs = startfield ;
type = parttype ;
parttype = parttype - > next ;
2011-05-15 13:23:13 +00:00
}
2004-08-23 01:38:21 +00:00
}
}
2004-12-12 18:43:57 +00:00
* fieldofs = maxfield ; //final size of the union.
2004-08-23 01:38:21 +00:00
return first ;
}
void QCC_PR_ExpandUnionToFields ( QCC_type_t * type , int * fields )
{
QCC_type_t * pass = type - > aux_type ;
2008-10-05 02:55:01 +00:00
QCC_PR_DummyFieldDef ( pass , " " , pr_scope , 1 , fields , true ) ;
2004-08-23 01:38:21 +00:00
}
2011-10-03 02:45:44 +00:00
void QCC_PR_ParseInitializerType ( int arraysize , QCC_def_t * def , QCC_type_t * type , int offset )
{
QCC_def_t * tmp ;
int i ;
2012-01-17 07:57:46 +00:00
if ( arraysize )
2011-10-03 02:45:44 +00:00
{
//arrays go recursive
QCC_PR_Expect ( " { " ) ;
for ( i = 0 ; i < arraysize ; i + + )
{
2012-01-17 07:57:46 +00:00
QCC_PR_ParseInitializerType ( 0 , def , type , offset + i * type - > size ) ;
2011-10-03 02:45:44 +00:00
if ( ! QCC_PR_CheckToken ( " , " ) )
break ;
}
QCC_PR_Expect ( " } " ) ;
}
else
{
2011-11-08 06:00:35 +00:00
if ( type - > type = = ev_function & & pr_token_type = = tt_punct )
2011-10-03 02:45:44 +00:00
{
/*begin function special case*/
QCC_def_t * parentfunc = pr_scope ;
QCC_function_t * f ;
QCC_dfunction_t * df ;
QCC_type_t * parm ;
2011-11-08 06:00:35 +00:00
tmp = NULL ;
2011-10-03 02:45:44 +00:00
def - > references + + ;
pr_scope = def ;
if ( QCC_PR_CheckToken ( " # " ) | | QCC_PR_CheckToken ( " : " ) )
{
int binum = 0 ;
if ( pr_token_type = = tt_immediate
& & pr_immediate_type = = type_float
& & pr_immediate . _float = = ( int ) pr_immediate . _float )
binum = ( int ) pr_immediate . _float ;
else if ( pr_token_type = = tt_immediate & & pr_immediate_type = = type_integer )
binum = pr_immediate . _int ;
else
QCC_PR_ParseError ( ERR_BADBUILTINIMMEDIATE , " Bad builtin immediate " ) ;
QCC_PR_Lex ( ) ;
2011-11-08 06:00:35 +00:00
if ( def - > initialized )
for ( i = 0 ; i < numfunctions ; i + + )
{
if ( functions [ i ] . first_statement = = - binum )
{
tmp = QCC_MakeIntConst ( i ) ;
break ;
}
}
if ( ! tmp )
{
f = ( void * ) qccHunkAlloc ( sizeof ( QCC_function_t ) ) ;
f - > builtin = binum ;
locals_start = locals_end = OFS_PARM0 ; //hmm...
}
else
f = NULL ;
2011-10-03 02:45:44 +00:00
}
else
f = QCC_PR_ParseImmediateStatements ( type ) ;
2011-11-08 06:00:35 +00:00
if ( ! tmp )
{
pr_scope = parentfunc ;
tmp = QCC_MakeIntConst ( numfunctions ) ;
f - > def = def ;
2011-10-03 02:45:44 +00:00
2011-11-08 06:00:35 +00:00
if ( numfunctions > = MAX_FUNCTIONS )
QCC_Error ( ERR_INTERNAL , " Too many function defs " ) ;
// fill in the dfunction
df = & functions [ numfunctions ] ;
numfunctions + + ;
if ( f - > builtin )
df - > first_statement = - f - > builtin ;
else
df - > first_statement = f - > code ;
if ( f - > builtin & & opt_function_names )
optres_function_names + = strlen ( f - > def - > name ) ;
else
df - > s_name = QCC_CopyString ( f - > def - > name ) ;
df - > s_file = s_file2 ;
df - > numparms = f - > def - > type - > num_parms ;
df - > locals = locals_end - locals_start ;
df - > parm_start = locals_start ;
for ( i = 0 , parm = type - > param ; i < df - > numparms ; i + + , parm = parm - > next )
{
df - > parm_size [ i ] = parm - > size ;
}
/*end function special case*/
}
}
else if ( type - > type = = ev_string & & QCC_PR_CheckName ( " _ " ) )
{
char trname [ 128 ] ;
QCC_PR_Expect ( " ( " ) ;
if ( pr_token_type ! = tt_immediate | | pr_immediate_type - > type ! = ev_string )
QCC_PR_ParseError ( 0 , " _() intrinsic accepts only a string immediate " ) ;
tmp = QCC_MakeStringConst ( pr_immediate_string ) ;
QCC_PR_Lex ( ) ;
QCC_PR_Expect ( " ) " ) ;
if ( ! pr_scope | | def - > constant )
2011-10-03 02:45:44 +00:00
{
2011-11-08 06:00:35 +00:00
QCC_def_t * dt ;
sprintf ( trname , " dotranslate_%i " , + + dotranslate_count ) ;
2013-03-12 22:32:25 +00:00
dt = QCC_PR_DummyDef ( type_string , trname , pr_scope , 0 , offset , true , GDF_CONST ) ;
2011-11-08 06:00:35 +00:00
dt - > references = 1 ;
dt - > constant = 1 ;
dt - > initialized = 1 ;
2011-10-03 02:45:44 +00:00
}
}
2012-01-17 07:57:46 +00:00
else if ( type - > type = = ev_struct | | type - > type = = ev_union )
{
//structs go recursive
QCC_type_t * parttype ;
int partnum ;
int parms ;
pbool isunion ;
QCC_PR_Expect ( " { " ) ;
isunion = ( ( type ) - > type = = ev_union ) ;
for ( partnum = 0 , parttype = ( type ) - > param , parms = ( type ) - > num_parms ; partnum < parms ; partnum + + , parttype = parttype - > next )
{
QCC_PR_ParseInitializerType ( parttype - > arraysize , def , parttype , offset + parttype - > ofs ) ;
if ( isunion | | ! QCC_PR_CheckToken ( " , " ) )
break ;
}
QCC_PR_Expect ( " } " ) ;
return ;
}
2011-10-03 02:45:44 +00:00
else
{
tmp = QCC_PR_Expression ( TOP_PRIORITY , EXPR_DISALLOW_COMMA ) ;
if ( typecmp ( type , tmp - > type ) )
{
/*you can cast from const 0 to anything*/
if ( tmp - > type - > size = = type - > size & & ( tmp - > type - > type = = ev_integer | | tmp - > type - > type = = ev_float ) & & tmp - > constant & & ! G_INT ( tmp - > ofs ) )
{
}
/*cast from int->float will convert*/
else if ( type - > type = = ev_float & & tmp - > type - > type = = ev_integer )
tmp = QCC_PR_Statement ( & pr_opcodes [ OP_CONV_ITOF ] , tmp , 0 , NULL ) ;
/*cast from float->int will convert*/
else if ( type - > type = = ev_integer & & tmp - > type - > type = = ev_float )
tmp = QCC_PR_Statement ( & pr_opcodes [ OP_CONV_FTOI ] , tmp , 0 , NULL ) ;
else
2011-10-06 19:59:53 +00:00
QCC_PR_ParseErrorPrintDef ( ERR_BADIMMEDIATETYPE , def , " wrong initializer type " ) ;
2011-10-03 02:45:44 +00:00
}
}
2013-03-12 22:35:33 +00:00
tmp - > references + + ;
if ( ! pr_scope | | def - > constant | | def - > isstatic )
2011-10-03 02:45:44 +00:00
{
if ( ! tmp - > constant )
QCC_PR_ParseErrorPrintDef ( ERR_BADIMMEDIATETYPE , def , " initializer is not constant " ) ;
2013-03-12 22:32:25 +00:00
if ( def - > initialized & & def - > initialized ! = 3 )
2011-11-08 06:00:35 +00:00
{
for ( i = 0 ; ( unsigned ) i < type - > size ; i + + )
if ( G_INT ( offset + i ) ! = G_INT ( tmp - > ofs + i ) )
QCC_PR_ParseErrorPrintDef ( ERR_REDECLARATION , def , " incompatible redeclaration " ) ;
}
else
{
for ( i = 0 ; ( unsigned ) i < type - > size ; i + + )
G_INT ( offset + i ) = G_INT ( tmp - > ofs + i ) ;
}
2011-10-03 02:45:44 +00:00
}
else
{
QCC_def_t lhs , rhs ;
2011-11-08 06:00:35 +00:00
if ( def - > initialized )
QCC_PR_ParseErrorPrintDef ( ERR_REDECLARATION , def , " %s initialised twice " , def - > name ) ;
2011-10-03 02:45:44 +00:00
memset ( & lhs , 0 , sizeof ( lhs ) ) ;
memset ( & rhs , 0 , sizeof ( rhs ) ) ;
2011-11-08 06:00:35 +00:00
def - > references + + ;
for ( i = 0 ; ( unsigned ) i < type - > size ; )
2011-10-03 02:45:44 +00:00
{
lhs . ofs = offset + i ;
2011-11-08 06:00:35 +00:00
tmp - > references + + ;
2011-10-03 02:45:44 +00:00
rhs . ofs = tmp - > ofs + i ;
2011-11-08 06:00:35 +00:00
if ( type - > size - i > = 3 )
2011-10-03 02:45:44 +00:00
{
------------------------------------------------------------------------
r4169 | acceptthis | 2013-01-17 08:55:12 +0000 (Thu, 17 Jan 2013) | 31 lines
removed MAX_VISEDICTS limit.
PEXT2_REPLACEMENTDELTAS tweaked, now has 4 million entity limit. still not enabled by default.
TE_BEAM now maps to a separate TEQW_BEAM to avoid conflicts with QW.
added android multitouch emulation for windows/rawinput (in_simulatemultitouch).
split topcolor/bottomcolor from scoreboard, for dp's colormap|1024 feature.
now using utf-8 for windows consoles.
qcc warnings/errors now give clickable console links for quick+easy editing.
disabled menutint when the currently active item changes contrast or gamma (for OneManClan).
Added support for drawfont/drawfontscale.
tweaked the qcvm a little to reduce the number of pointers.
.doll file loading. still experimental and will likely crash. requires csqc active, even if its a dummy progs. this will be fixed in time. Still other things that need cleaning up.
windows: gl_font "?" shows the standard windows font-selection dialog, and can be used to select windows fonts. not all work. and you probably don't want to use windings.
fixed splitscreen support when playing mvds. added mini-scoreboards to splitscreen.
editor/debugger now shows asm if there's no linenumber info. also, pressing f1 for help shows the shortcuts.
Added support for .framegroups files for psk(psa) and iqm formats.
True support for ezquake's colour codes. Mutually exclusive with background colours.
path command output slightly more readable.
added support for digest_hex (MD4, SHA1, CRC16).
skingroups now colourmap correctly.
Fix terrain colour hints, and litdata from the wrong bsp.
fix ftp dual-homed issue. support epsv command, and enable ipv6 (eprt still not supported).
remove d3d11 compilation from the makefile. the required headers are not provided by mingw, and are not available to the build bot, so don't bother.
fix v *= v.x and similar opcodes.
fteqcc: fixed support for áéÃóú type chars in names. utf-8 files now properly supported (even with the utf-8 bom/identifier). utf-16 also supported.
fteqcc: fixed '#if 1 == 3 && 4' parsing.
fteqcc: -Werror acts on the warning, rather than as a separate error. Line numbers are thus more readable.
fteqcc: copyright message now includes compile date instead.
fteqccgui: the treeview control is now coloured depending on whether there were warnings/errors in the last compile.
fteqccgui: the output window is now focused and scrolls down as compilation progresses.
pr_dumpplatform command dumps out some pragmas to convert more serious warnings to errors. This is to avoid the infamous 'fteqcc sucks cos my code sucks' issue.
rewrote prespawn/modelist/soundlist code. server tracks progress now.
------------------------------------------------------------------------
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4167 fc73d0e0-1445-4013-8a0c-d673dee63da5
2013-03-12 22:29:40 +00:00
rhs . type = lhs . type = type_vector ;
2011-10-03 02:45:44 +00:00
QCC_FreeTemp ( QCC_PR_Statement ( & pr_opcodes [ OP_STORE_V ] , & rhs , & lhs , NULL ) ) ;
i + = 3 ;
}
else
{
------------------------------------------------------------------------
r4169 | acceptthis | 2013-01-17 08:55:12 +0000 (Thu, 17 Jan 2013) | 31 lines
removed MAX_VISEDICTS limit.
PEXT2_REPLACEMENTDELTAS tweaked, now has 4 million entity limit. still not enabled by default.
TE_BEAM now maps to a separate TEQW_BEAM to avoid conflicts with QW.
added android multitouch emulation for windows/rawinput (in_simulatemultitouch).
split topcolor/bottomcolor from scoreboard, for dp's colormap|1024 feature.
now using utf-8 for windows consoles.
qcc warnings/errors now give clickable console links for quick+easy editing.
disabled menutint when the currently active item changes contrast or gamma (for OneManClan).
Added support for drawfont/drawfontscale.
tweaked the qcvm a little to reduce the number of pointers.
.doll file loading. still experimental and will likely crash. requires csqc active, even if its a dummy progs. this will be fixed in time. Still other things that need cleaning up.
windows: gl_font "?" shows the standard windows font-selection dialog, and can be used to select windows fonts. not all work. and you probably don't want to use windings.
fixed splitscreen support when playing mvds. added mini-scoreboards to splitscreen.
editor/debugger now shows asm if there's no linenumber info. also, pressing f1 for help shows the shortcuts.
Added support for .framegroups files for psk(psa) and iqm formats.
True support for ezquake's colour codes. Mutually exclusive with background colours.
path command output slightly more readable.
added support for digest_hex (MD4, SHA1, CRC16).
skingroups now colourmap correctly.
Fix terrain colour hints, and litdata from the wrong bsp.
fix ftp dual-homed issue. support epsv command, and enable ipv6 (eprt still not supported).
remove d3d11 compilation from the makefile. the required headers are not provided by mingw, and are not available to the build bot, so don't bother.
fix v *= v.x and similar opcodes.
fteqcc: fixed support for áéÃóú type chars in names. utf-8 files now properly supported (even with the utf-8 bom/identifier). utf-16 also supported.
fteqcc: fixed '#if 1 == 3 && 4' parsing.
fteqcc: -Werror acts on the warning, rather than as a separate error. Line numbers are thus more readable.
fteqcc: copyright message now includes compile date instead.
fteqccgui: the treeview control is now coloured depending on whether there were warnings/errors in the last compile.
fteqccgui: the output window is now focused and scrolls down as compilation progresses.
pr_dumpplatform command dumps out some pragmas to convert more serious warnings to errors. This is to avoid the infamous 'fteqcc sucks cos my code sucks' issue.
rewrote prespawn/modelist/soundlist code. server tracks progress now.
------------------------------------------------------------------------
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4167 fc73d0e0-1445-4013-8a0c-d673dee63da5
2013-03-12 22:29:40 +00:00
rhs . type = lhs . type = type_float ;
2011-10-03 02:45:44 +00:00
QCC_FreeTemp ( QCC_PR_Statement ( & pr_opcodes [ OP_STORE_F ] , & rhs , & lhs , NULL ) ) ;
i + + ;
}
}
}
QCC_FreeTemp ( tmp ) ;
}
}
2013-03-12 22:32:25 +00:00
void QCC_PR_ParseInitializerDef ( QCC_def_t * def )
2011-10-03 02:45:44 +00:00
{
QCC_PR_ParseInitializerType ( def - > arraysize , def , def - > type , def - > ofs ) ;
if ( ! def - > initialized )
def - > initialized = 1 ;
}
2005-02-09 19:32:30 +00:00
int accglobalsblock ; //0 = error, 1 = var, 2 = function, 3 = objdata
2004-08-23 01:38:21 +00:00
/*
= = = = = = = = = = = = = = = =
PR_ParseDefs
Called at the outer layer and when a local statement is hit
= = = = = = = = = = = = = = = =
*/
void QCC_PR_ParseDefs ( char * classname )
{
char * name ;
QCC_type_t * type , * parm ;
QCC_def_t * def , * d ;
QCC_function_t * f ;
QCC_dfunction_t * df ;
2011-05-15 13:23:13 +00:00
int i = 0 ; // warning: <20> i<EFBFBD> may be used uninitialized in this function
2004-08-23 01:38:21 +00:00
pbool shared = false ;
2009-03-29 23:47:29 +00:00
pbool isstatic = defaultstatic ;
2004-08-23 01:38:21 +00:00
pbool externfnc = false ;
2005-04-23 19:55:49 +00:00
pbool isconstant = false ;
pbool isvar = false ;
2010-05-01 22:47:47 +00:00
pbool noref = defaultnoref ;
2004-08-23 01:38:21 +00:00
pbool nosave = false ;
pbool allocatenew = true ;
2007-04-15 17:35:58 +00:00
pbool inlinefunction = false ;
2004-08-23 01:38:21 +00:00
int arraysize ;
2013-03-12 22:32:25 +00:00
unsigned int gd_flags ;
2004-08-23 01:38:21 +00:00
2011-09-03 03:49:43 +00:00
while ( QCC_PR_CheckToken ( " ; " ) )
;
2005-03-20 02:57:11 +00:00
if ( QCC_PR_CheckKeyword ( keyword_enum , " enum " ) )
2004-08-23 01:38:21 +00:00
{
2008-11-09 22:29:28 +00:00
if ( QCC_PR_CheckKeyword ( keyword_integer , " integer " ) | | QCC_PR_CheckKeyword ( keyword_int , " int " ) )
2004-08-23 01:38:21 +00:00
{
2008-11-09 22:29:28 +00:00
int iv = 0 ;
QCC_PR_Expect ( " { " ) ;
i = 0 ;
d = NULL ;
while ( 1 )
2004-08-23 01:38:21 +00:00
{
2008-11-09 22:29:28 +00:00
name = QCC_PR_ParseName ( ) ;
if ( QCC_PR_CheckToken ( " = " ) )
2004-10-16 13:18:58 +00:00
{
2008-11-09 22:29:28 +00:00
if ( pr_token_type ! = tt_immediate & & pr_immediate_type - > type ! = ev_integer )
2004-10-16 13:18:58 +00:00
{
2008-11-09 22:29:28 +00:00
def = QCC_PR_GetDef ( NULL , QCC_PR_ParseName ( ) , NULL , false , 0 , false ) ;
if ( def )
{
if ( ! def - > constant )
QCC_PR_ParseError ( ERR_NOTANUMBER , " enum - %s is not a constant " , def - > name ) ;
else
iv = G_INT ( def - > ofs ) ;
}
2004-10-16 13:18:58 +00:00
else
2008-11-09 22:29:28 +00:00
QCC_PR_ParseError ( ERR_NOTANUMBER , " enum - not a number " ) ;
2004-10-16 13:18:58 +00:00
}
else
2008-11-09 22:29:28 +00:00
{
iv = pr_immediate . _int ;
QCC_PR_Lex ( ) ;
}
2004-10-16 13:18:58 +00:00
}
2011-10-03 02:45:44 +00:00
def = QCC_MakeIntConst ( iv ) ;
2008-11-09 22:29:28 +00:00
pHash_Add ( & globalstable , name , def , qccHunkAlloc ( sizeof ( bucket_t ) ) ) ;
iv + + ;
if ( QCC_PR_CheckToken ( " } " ) )
break ;
QCC_PR_Expect ( " , " ) ;
2011-05-03 22:37:56 +00:00
if ( QCC_PR_CheckToken ( " } " ) )
break ; // accept trailing comma
2008-11-09 22:29:28 +00:00
}
}
else
{
float fv = 0 ;
QCC_PR_CheckKeyword ( keyword_float , " float " ) ;
QCC_PR_Expect ( " { " ) ;
i = 0 ;
d = NULL ;
while ( 1 )
{
name = QCC_PR_ParseName ( ) ;
if ( QCC_PR_CheckToken ( " = " ) )
2004-10-16 14:05:46 +00:00
{
2008-11-09 22:29:28 +00:00
if ( pr_token_type ! = tt_immediate & & pr_immediate_type - > type ! = ev_float )
{
def = QCC_PR_GetDef ( NULL , QCC_PR_ParseName ( ) , NULL , false , 0 , false ) ;
if ( def )
{
if ( ! def - > constant )
QCC_PR_ParseError ( ERR_NOTANUMBER , " enum - %s is not a constant " , def - > name ) ;
else
fv = G_FLOAT ( def - > ofs ) ;
}
else
QCC_PR_ParseError ( ERR_NOTANUMBER , " enum - not a number " ) ;
}
else
{
fv = pr_immediate . _float ;
QCC_PR_Lex ( ) ;
}
2004-10-16 14:05:46 +00:00
}
2011-10-03 02:45:44 +00:00
def = QCC_MakeFloatConst ( fv ) ;
2008-11-09 22:29:28 +00:00
pHash_Add ( & globalstable , name , def , qccHunkAlloc ( sizeof ( bucket_t ) ) ) ;
fv + + ;
2004-08-23 01:38:21 +00:00
2008-11-09 22:29:28 +00:00
if ( QCC_PR_CheckToken ( " } " ) )
break ;
QCC_PR_Expect ( " , " ) ;
2011-05-03 22:37:56 +00:00
if ( QCC_PR_CheckToken ( " } " ) )
break ; // accept trailing comma
2008-11-09 22:29:28 +00:00
}
2004-08-23 01:38:21 +00:00
}
QCC_PR_Expect ( " ; " ) ;
return ;
}
2005-03-20 02:57:11 +00:00
if ( QCC_PR_CheckKeyword ( keyword_enumflags , " enumflags " ) )
2004-08-23 01:38:21 +00:00
{
int bits ;
2008-11-09 22:29:28 +00:00
if ( QCC_PR_CheckKeyword ( keyword_integer , " integer " ) | | QCC_PR_CheckKeyword ( keyword_int , " int " ) )
2004-08-23 01:38:21 +00:00
{
2008-11-09 22:29:28 +00:00
int iv = 1 ;
QCC_PR_Expect ( " { " ) ;
i = 0 ;
d = NULL ;
while ( 1 )
2004-08-23 01:38:21 +00:00
{
2008-11-09 22:29:28 +00:00
name = QCC_PR_ParseName ( ) ;
if ( QCC_PR_CheckToken ( " = " ) )
2004-10-16 13:18:58 +00:00
{
2008-11-09 22:29:28 +00:00
if ( pr_token_type ! = tt_immediate & & pr_immediate_type - > type ! = ev_integer )
2004-10-16 13:18:58 +00:00
{
2008-11-09 22:29:28 +00:00
def = QCC_PR_GetDef ( NULL , QCC_PR_ParseName ( ) , NULL , false , 0 , false ) ;
if ( def )
{
if ( ! def - > constant )
QCC_PR_ParseError ( ERR_NOTANUMBER , " enumflags - %s is not a constant " , def - > name ) ;
else
iv = G_INT ( def - > ofs ) ;
}
2004-10-16 13:18:58 +00:00
else
2008-11-09 22:29:28 +00:00
QCC_PR_ParseError ( ERR_NOTANUMBER , " enumflags - not a number " ) ;
2004-10-16 13:18:58 +00:00
}
else
2008-11-09 22:29:28 +00:00
{
iv = pr_immediate . _int ;
QCC_PR_Lex ( ) ;
}
2004-10-16 13:18:58 +00:00
}
2008-11-09 22:29:28 +00:00
bits = 0 ;
i = ( int ) iv ;
if ( i ! = iv )
QCC_PR_ParseWarning ( WARN_ENUMFLAGS_NOTINTEGER , " enumflags - %f not an integer " , iv ) ;
2004-10-16 13:18:58 +00:00
else
2004-10-16 14:05:46 +00:00
{
2008-11-09 22:29:28 +00:00
while ( i )
{
if ( ( ( i > > 1 ) < < 1 ) ! = i )
bits + + ;
i > > = 1 ;
}
2011-10-03 02:45:44 +00:00
if ( bits > 1 )
2008-11-09 22:29:28 +00:00
QCC_PR_ParseWarning ( WARN_ENUMFLAGS_NOTBINARY , " enumflags - value %i not a single bit " , ( int ) iv ) ;
2004-10-16 14:05:46 +00:00
}
2008-11-09 22:29:28 +00:00
2011-10-03 02:45:44 +00:00
def = QCC_MakeIntConst ( iv ) ;
2008-11-09 22:29:28 +00:00
pHash_Add ( & globalstable , name , def , qccHunkAlloc ( sizeof ( bucket_t ) ) ) ;
iv * = 2 ;
if ( QCC_PR_CheckToken ( " } " ) )
break ;
QCC_PR_Expect ( " , " ) ;
2005-06-14 04:52:10 +00:00
}
2008-11-09 22:29:28 +00:00
}
else
{
float fv = 1 ;
QCC_PR_CheckKeyword ( keyword_float , " float " ) ;
2004-10-16 13:18:58 +00:00
2008-11-09 22:29:28 +00:00
QCC_PR_Expect ( " { " ) ;
i = 0 ;
d = NULL ;
while ( 1 )
2005-06-14 04:52:10 +00:00
{
2008-11-09 22:29:28 +00:00
name = QCC_PR_ParseName ( ) ;
if ( QCC_PR_CheckToken ( " = " ) )
{
if ( pr_token_type ! = tt_immediate & & pr_immediate_type - > type ! = ev_float )
{
def = QCC_PR_GetDef ( NULL , QCC_PR_ParseName ( ) , NULL , false , 0 , false ) ;
if ( def )
{
if ( ! def - > constant )
QCC_PR_ParseError ( ERR_NOTANUMBER , " enumflags - %s is not a constant " , def - > name ) ;
else
fv = G_FLOAT ( def - > ofs ) ;
}
else
QCC_PR_ParseError ( ERR_NOTANUMBER , " enumflags - not a number " ) ;
}
else
{
fv = pr_immediate . _float ;
QCC_PR_Lex ( ) ;
}
}
bits = 0 ;
i = ( int ) fv ;
if ( i ! = fv )
QCC_PR_ParseWarning ( WARN_ENUMFLAGS_NOTINTEGER , " enumflags - %f not an integer " , fv ) ;
else
2004-08-23 01:38:21 +00:00
{
2008-11-09 22:29:28 +00:00
while ( i )
{
if ( ( ( i > > 1 ) < < 1 ) ! = i )
bits + + ;
i > > = 1 ;
}
2011-10-03 02:45:44 +00:00
if ( bits > 1 )
2008-11-09 22:29:28 +00:00
QCC_PR_ParseWarning ( WARN_ENUMFLAGS_NOTBINARY , " enumflags - value %i not a single bit " , ( int ) fv ) ;
2004-08-23 01:38:21 +00:00
}
2005-06-14 04:52:10 +00:00
2011-10-03 02:45:44 +00:00
def = QCC_MakeFloatConst ( fv ) ;
2008-11-09 22:29:28 +00:00
pHash_Add ( & globalstable , name , def , qccHunkAlloc ( sizeof ( bucket_t ) ) ) ;
2005-06-14 04:52:10 +00:00
2008-11-09 22:29:28 +00:00
fv * = 2 ;
2004-08-23 01:38:21 +00:00
2008-11-09 22:29:28 +00:00
if ( QCC_PR_CheckToken ( " } " ) )
break ;
QCC_PR_Expect ( " , " ) ;
}
2004-08-23 01:38:21 +00:00
}
QCC_PR_Expect ( " ; " ) ;
return ;
}
2005-03-20 02:57:11 +00:00
if ( QCC_PR_CheckKeyword ( keyword_typedef , " typedef " ) )
2004-08-23 01:38:21 +00:00
{
2011-09-03 03:49:43 +00:00
type = QCC_PR_ParseType ( true , false ) ;
2004-08-23 01:38:21 +00:00
if ( ! type )
{
QCC_PR_ParseError ( ERR_NOTANAME , " typedef found unexpected tokens " ) ;
}
type - > name = QCC_CopyString ( pr_token ) + strings ;
2012-02-05 01:38:51 +00:00
type - > typedefed = true ;
2004-08-23 01:38:21 +00:00
QCC_PR_Lex ( ) ;
QCC_PR_Expect ( " ; " ) ;
return ;
}
2005-02-28 07:16:19 +00:00
if ( flag_acc )
2005-02-09 19:32:30 +00:00
{
char * oldp ;
2005-03-20 02:57:11 +00:00
if ( QCC_PR_CheckKeyword ( keyword_codesys , " CodeSys " ) ) //reacc support.
2005-02-09 19:32:30 +00:00
{
if ( ForcedCRC )
QCC_PR_ParseError ( ERR_BADEXTENSION , " progs crc was already specified - only one is allowed " ) ;
2005-03-10 03:55:18 +00:00
ForcedCRC = ( int ) pr_immediate . _float ;
2005-02-09 19:32:30 +00:00
QCC_PR_Lex ( ) ;
QCC_PR_Expect ( " ; " ) ;
return ;
}
oldp = pr_file_p ;
2005-03-20 02:57:11 +00:00
if ( QCC_PR_CheckKeyword ( keyword_var , " var " ) ) //reacc support.
2005-02-09 19:32:30 +00:00
{
if ( accglobalsblock = = 3 )
{
2008-10-05 02:55:01 +00:00
if ( ! QCC_PR_GetDef ( type_void , " end_sys_fields " , NULL , false , 0 , false ) )
2012-01-17 07:57:46 +00:00
QCC_PR_GetDef ( type_void , " end_sys_fields " , NULL , true , 0 , false ) ;
2005-02-09 19:32:30 +00:00
}
QCC_PR_ParseName ( ) ;
2005-03-20 02:57:11 +00:00
if ( QCC_PR_CheckToken ( " : " ) )
2005-02-09 19:32:30 +00:00
accglobalsblock = 1 ;
pr_file_p = oldp ;
QCC_PR_Lex ( ) ;
}
2005-03-20 02:57:11 +00:00
if ( QCC_PR_CheckKeyword ( keyword_function , " function " ) ) //reacc support.
2005-02-09 19:32:30 +00:00
{
accglobalsblock = 2 ;
}
2005-03-20 02:57:11 +00:00
if ( QCC_PR_CheckKeyword ( keyword_objdata , " objdata " ) ) //reacc support.
2005-02-09 19:32:30 +00:00
{
if ( accglobalsblock = = 3 )
{
2008-10-05 02:55:01 +00:00
if ( ! QCC_PR_GetDef ( type_void , " end_sys_fields " , NULL , false , 0 , false ) )
2012-01-17 07:57:46 +00:00
QCC_PR_GetDef ( type_void , " end_sys_fields " , NULL , true , 0 , false ) ;
2005-02-09 19:32:30 +00:00
}
else
2008-10-05 02:55:01 +00:00
if ( ! QCC_PR_GetDef ( type_void , " end_sys_globals " , NULL , false , 0 , false ) )
2012-01-17 07:57:46 +00:00
QCC_PR_GetDef ( type_void , " end_sys_globals " , NULL , true , 0 , false ) ;
2005-02-09 19:32:30 +00:00
accglobalsblock = 3 ;
}
}
if ( ! pr_scope )
switch ( accglobalsblock ) //reacc support.
{
case 1 :
{
char * oldp = pr_file_p ;
name = QCC_PR_ParseName ( ) ;
2005-03-20 02:57:11 +00:00
if ( ! QCC_PR_CheckToken ( " : " ) ) //nope, it wasn't!
2005-02-09 19:32:30 +00:00
{
QCC_PR_IncludeChunk ( name , true , NULL ) ;
QCC_PR_Lex ( ) ;
QCC_PR_UnInclude ( ) ;
pr_file_p = oldp ;
break ;
}
2005-03-20 02:57:11 +00:00
if ( QCC_PR_CheckKeyword ( keyword_object , " object " ) )
2012-01-17 07:57:46 +00:00
QCC_PR_GetDef ( type_entity , name , NULL , true , 0 , true ) ;
2005-03-20 02:57:11 +00:00
else if ( QCC_PR_CheckKeyword ( keyword_string , " string " ) )
2012-01-17 07:57:46 +00:00
QCC_PR_GetDef ( type_string , name , NULL , true , 0 , true ) ;
2005-03-20 02:57:11 +00:00
else if ( QCC_PR_CheckKeyword ( keyword_real , " real " ) )
2005-02-09 19:32:30 +00:00
{
2012-01-17 07:57:46 +00:00
def = QCC_PR_GetDef ( type_float , name , NULL , true , 0 , true ) ;
2005-03-20 02:57:11 +00:00
if ( QCC_PR_CheckToken ( " = " ) )
2005-02-09 19:32:30 +00:00
{
G_FLOAT ( def - > ofs ) = pr_immediate . _float ;
QCC_PR_Lex ( ) ;
}
}
2005-03-20 02:57:11 +00:00
else if ( QCC_PR_CheckKeyword ( keyword_vector , " vector " ) )
2005-02-09 19:32:30 +00:00
{
2012-01-17 07:57:46 +00:00
def = QCC_PR_GetDef ( type_vector , name , NULL , true , 0 , true ) ;
2005-03-20 02:57:11 +00:00
if ( QCC_PR_CheckToken ( " = " ) )
2005-02-09 19:32:30 +00:00
{
QCC_PR_Expect ( " [ " ) ;
G_FLOAT ( def - > ofs + 0 ) = pr_immediate . _float ;
QCC_PR_Lex ( ) ;
G_FLOAT ( def - > ofs + 1 ) = pr_immediate . _float ;
QCC_PR_Lex ( ) ;
G_FLOAT ( def - > ofs + 2 ) = pr_immediate . _float ;
QCC_PR_Lex ( ) ;
QCC_PR_Expect ( " ] " ) ;
}
}
2005-03-20 02:57:11 +00:00
else if ( QCC_PR_CheckKeyword ( keyword_pfunc , " pfunc " ) )
2012-01-17 07:57:46 +00:00
QCC_PR_GetDef ( type_function , name , NULL , true , 0 , true ) ;
2005-02-09 19:32:30 +00:00
else
QCC_PR_ParseError ( ERR_BADNOTTYPE , " Bad type \n " ) ;
QCC_PR_Expect ( " ; " ) ;
2005-03-20 02:57:11 +00:00
if ( QCC_PR_CheckKeyword ( keyword_system , " system " ) )
2005-02-09 19:32:30 +00:00
QCC_PR_Expect ( " ; " ) ;
return ;
}
case 2 :
name = QCC_PR_ParseName ( ) ;
2008-10-05 02:55:01 +00:00
QCC_PR_GetDef ( type_function , name , NULL , true , 1 , true ) ;
2005-03-20 02:57:11 +00:00
QCC_PR_CheckToken ( " ; " ) ;
2005-02-09 19:32:30 +00:00
return ;
case 3 :
{
char * oldp = pr_file_p ;
name = QCC_PR_ParseName ( ) ;
2005-03-20 02:57:11 +00:00
if ( ! QCC_PR_CheckToken ( " : " ) ) //nope, it wasn't!
2005-02-09 19:32:30 +00:00
{
QCC_PR_IncludeChunk ( name , true , NULL ) ;
QCC_PR_Lex ( ) ;
QCC_PR_UnInclude ( ) ;
pr_file_p = oldp ;
break ;
}
2005-03-20 02:57:11 +00:00
if ( QCC_PR_CheckKeyword ( keyword_object , " object " ) )
2012-01-17 07:57:46 +00:00
QCC_PR_GetDef ( QCC_PR_FieldType ( type_entity ) , name , NULL , true , 0 , true ) ;
2005-03-20 02:57:11 +00:00
else if ( QCC_PR_CheckKeyword ( keyword_string , " string " ) )
2012-01-17 07:57:46 +00:00
QCC_PR_GetDef ( QCC_PR_FieldType ( type_string ) , name , NULL , true , 0 , true ) ;
2005-03-20 02:57:11 +00:00
else if ( QCC_PR_CheckKeyword ( keyword_real , " real " ) )
2012-01-17 07:57:46 +00:00
QCC_PR_GetDef ( QCC_PR_FieldType ( type_float ) , name , NULL , true , 0 , true ) ;
2005-03-20 02:57:11 +00:00
else if ( QCC_PR_CheckKeyword ( keyword_vector , " vector " ) )
2012-01-17 07:57:46 +00:00
QCC_PR_GetDef ( QCC_PR_FieldType ( type_vector ) , name , NULL , true , 0 , true ) ;
2005-03-20 02:57:11 +00:00
else if ( QCC_PR_CheckKeyword ( keyword_pfunc , " pfunc " ) )
2012-01-17 07:57:46 +00:00
QCC_PR_GetDef ( QCC_PR_FieldType ( type_function ) , name , NULL , true , 0 , true ) ;
2005-02-09 19:32:30 +00:00
else
QCC_PR_ParseError ( ERR_BADNOTTYPE , " Bad type \n " ) ;
QCC_PR_Expect ( " ; " ) ;
return ;
}
}
2004-08-23 01:38:21 +00:00
while ( 1 )
{
2005-03-20 02:57:11 +00:00
if ( QCC_PR_CheckKeyword ( keyword_extern , " extern " ) )
2004-08-23 01:38:21 +00:00
externfnc = true ;
2005-03-20 02:57:11 +00:00
else if ( QCC_PR_CheckKeyword ( keyword_shared , " shared " ) )
2004-08-23 01:38:21 +00:00
{
shared = true ;
if ( pr_scope )
QCC_PR_ParseError ( ERR_NOSHAREDLOCALS , " Cannot have shared locals " ) ;
}
2005-03-20 02:57:11 +00:00
else if ( QCC_PR_CheckKeyword ( keyword_const , " const " ) )
2005-04-23 19:55:49 +00:00
isconstant = true ;
2005-03-20 02:57:11 +00:00
else if ( QCC_PR_CheckKeyword ( keyword_var , " var " ) )
2005-05-04 14:45:00 +00:00
isvar = true ;
2009-03-29 23:47:29 +00:00
else if ( ! pr_scope & & QCC_PR_CheckKeyword ( keyword_var , " static " ) )
isstatic = true ;
else if ( ! pr_scope & & QCC_PR_CheckKeyword ( keyword_var , " nonstatic " ) )
isstatic = false ;
2005-03-20 02:57:11 +00:00
else if ( QCC_PR_CheckKeyword ( keyword_noref , " noref " ) )
2004-08-23 01:38:21 +00:00
noref = true ;
2005-03-20 02:57:11 +00:00
else if ( QCC_PR_CheckKeyword ( keyword_nosave , " nosave " ) )
2004-08-23 01:38:21 +00:00
nosave = true ;
else
break ;
}
2011-09-03 03:49:43 +00:00
type = QCC_PR_ParseType ( false , false ) ;
2004-08-23 01:38:21 +00:00
if ( type = = NULL ) //ignore
return ;
2007-04-15 17:35:58 +00:00
inlinefunction = type_inlinefunction ;
2004-08-23 01:38:21 +00:00
if ( externfnc & & type - > type ! = ev_function )
{
printf ( " Only functions may be defined as external (yet) \n " ) ;
externfnc = false ;
}
2005-03-20 02:57:11 +00:00
if ( ! pr_scope & & QCC_PR_CheckKeyword ( keyword_function , " function " ) ) //reacc support.
2005-02-09 19:32:30 +00:00
{
name = QCC_PR_ParseName ( ) ;
QCC_PR_Expect ( " ( " ) ;
type = QCC_PR_ParseFunctionTypeReacc ( false , type ) ;
QCC_PR_Expect ( " ; " ) ;
2012-01-17 07:57:46 +00:00
def = QCC_PR_GetDef ( type , name , NULL , true , 0 , false ) ;
2005-02-09 19:32:30 +00:00
if ( autoprototype )
{ //ignore the code and stuff
2005-03-20 02:57:11 +00:00
if ( QCC_PR_CheckKeyword ( keyword_external , " external " ) )
2005-02-09 19:32:30 +00:00
{ //builtin
QCC_PR_Lex ( ) ;
QCC_PR_Expect ( " ; " ) ;
}
else
{
int blev = 1 ;
2005-03-20 02:57:11 +00:00
while ( ! QCC_PR_CheckToken ( " { " ) ) //skip over the locals.
2005-02-09 19:32:30 +00:00
{
if ( pr_token_type = = tt_eof )
{
QCC_PR_ParseError ( 0 , " Unexpected EOF " ) ;
break ;
}
QCC_PR_Lex ( ) ;
}
//balance out the { and }
while ( blev )
{
if ( pr_token_type = = tt_eof )
break ;
2005-03-20 02:57:11 +00:00
if ( QCC_PR_CheckToken ( " { " ) )
2005-02-09 19:32:30 +00:00
blev + + ;
2005-03-20 02:57:11 +00:00
else if ( QCC_PR_CheckToken ( " } " ) )
2005-02-09 19:32:30 +00:00
blev - - ;
else
QCC_PR_Lex ( ) ; //ignore it.
}
}
return ;
}
def - > references + + ;
pr_scope = def ;
f = QCC_PR_ParseImmediateStatements ( type ) ;
pr_scope = NULL ;
def - > initialized = 1 ;
2009-03-29 23:47:29 +00:00
def - > isstatic = isstatic ;
2005-02-09 19:32:30 +00:00
G_FUNCTION ( def - > ofs ) = numfunctions ;
f - > def = def ;
// if (pr_dumpasm)
// PR_PrintFunction (def);
2011-08-16 04:12:15 +00:00
if ( numfunctions > = MAX_FUNCTIONS )
QCC_Error ( ERR_INTERNAL , " Too many function defs " ) ;
2005-02-09 19:32:30 +00:00
// fill in the dfunction
df = & functions [ numfunctions ] ;
numfunctions + + ;
if ( f - > builtin )
df - > first_statement = - f - > builtin ;
else
df - > first_statement = f - > code ;
if ( f - > builtin & & opt_function_names )
optres_function_names + = strlen ( f - > def - > name ) ;
else
df - > s_name = QCC_CopyString ( f - > def - > name ) ;
df - > s_file = s_file2 ;
df - > numparms = f - > def - > type - > num_parms ;
df - > locals = locals_end - locals_start ;
df - > parm_start = locals_start ;
for ( i = 0 , parm = type - > param ; i < df - > numparms ; i + + , parm = parm - > next )
{
df - > parm_size [ i ] = parm - > size ;
}
return ;
}
2004-08-23 01:38:21 +00:00
// if (pr_scope && (type->type == ev_field) )
// QCC_PR_ParseError ("Fields must be global");
do
2011-09-03 03:49:43 +00:00
{
if ( QCC_PR_CheckToken ( " ; " ) )
2004-08-23 01:38:21 +00:00
{
if ( type - > type = = ev_field & & ( type - > aux_type - > type = = ev_union | | type - > aux_type - > type = = ev_struct ) )
{
QCC_PR_ExpandUnionToFields ( type , & pr . size_fields ) ;
return ;
}
// if (type->type == ev_union)
// {
// return;
// }
QCC_PR_ParseError ( ERR_TYPEWITHNONAME , " type with no name " ) ;
2004-10-13 07:24:59 +00:00
name = NULL ;
2004-08-23 01:38:21 +00:00
}
else
2004-11-04 04:19:10 +00:00
{
2004-08-23 01:38:21 +00:00
name = QCC_PR_ParseName ( ) ;
2004-11-04 04:19:10 +00:00
}
2004-08-23 01:38:21 +00:00
2005-03-20 02:57:11 +00:00
if ( QCC_PR_CheckToken ( " :: " ) & & ! classname )
2004-08-23 01:38:21 +00:00
{
classname = name ;
name = QCC_PR_ParseName ( ) ;
}
//check for an array
2011-05-15 13:23:13 +00:00
2005-03-20 02:57:11 +00:00
if ( QCC_PR_CheckToken ( " [ " ) )
2004-08-23 01:38:21 +00:00
{
2005-02-28 07:16:19 +00:00
char * oldprfile = pr_file_p ;
------------------------------------------------------------------------
r4169 | acceptthis | 2013-01-17 08:55:12 +0000 (Thu, 17 Jan 2013) | 31 lines
removed MAX_VISEDICTS limit.
PEXT2_REPLACEMENTDELTAS tweaked, now has 4 million entity limit. still not enabled by default.
TE_BEAM now maps to a separate TEQW_BEAM to avoid conflicts with QW.
added android multitouch emulation for windows/rawinput (in_simulatemultitouch).
split topcolor/bottomcolor from scoreboard, for dp's colormap|1024 feature.
now using utf-8 for windows consoles.
qcc warnings/errors now give clickable console links for quick+easy editing.
disabled menutint when the currently active item changes contrast or gamma (for OneManClan).
Added support for drawfont/drawfontscale.
tweaked the qcvm a little to reduce the number of pointers.
.doll file loading. still experimental and will likely crash. requires csqc active, even if its a dummy progs. this will be fixed in time. Still other things that need cleaning up.
windows: gl_font "?" shows the standard windows font-selection dialog, and can be used to select windows fonts. not all work. and you probably don't want to use windings.
fixed splitscreen support when playing mvds. added mini-scoreboards to splitscreen.
editor/debugger now shows asm if there's no linenumber info. also, pressing f1 for help shows the shortcuts.
Added support for .framegroups files for psk(psa) and iqm formats.
True support for ezquake's colour codes. Mutually exclusive with background colours.
path command output slightly more readable.
added support for digest_hex (MD4, SHA1, CRC16).
skingroups now colourmap correctly.
Fix terrain colour hints, and litdata from the wrong bsp.
fix ftp dual-homed issue. support epsv command, and enable ipv6 (eprt still not supported).
remove d3d11 compilation from the makefile. the required headers are not provided by mingw, and are not available to the build bot, so don't bother.
fix v *= v.x and similar opcodes.
fteqcc: fixed support for áéÃóú type chars in names. utf-8 files now properly supported (even with the utf-8 bom/identifier). utf-16 also supported.
fteqcc: fixed '#if 1 == 3 && 4' parsing.
fteqcc: -Werror acts on the warning, rather than as a separate error. Line numbers are thus more readable.
fteqcc: copyright message now includes compile date instead.
fteqccgui: the treeview control is now coloured depending on whether there were warnings/errors in the last compile.
fteqccgui: the output window is now focused and scrolls down as compilation progresses.
pr_dumpplatform command dumps out some pragmas to convert more serious warnings to errors. This is to avoid the infamous 'fteqcc sucks cos my code sucks' issue.
rewrote prespawn/modelist/soundlist code. server tracks progress now.
------------------------------------------------------------------------
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4167 fc73d0e0-1445-4013-8a0c-d673dee63da5
2013-03-12 22:29:40 +00:00
int depth ;
2005-02-28 07:16:19 +00:00
arraysize = 0 ;
2005-03-20 02:57:11 +00:00
if ( QCC_PR_CheckToken ( " ] " ) )
2005-02-28 07:16:19 +00:00
{
QCC_PR_Expect ( " = " ) ;
QCC_PR_Expect ( " { " ) ;
arraysize + + ;
------------------------------------------------------------------------
r4169 | acceptthis | 2013-01-17 08:55:12 +0000 (Thu, 17 Jan 2013) | 31 lines
removed MAX_VISEDICTS limit.
PEXT2_REPLACEMENTDELTAS tweaked, now has 4 million entity limit. still not enabled by default.
TE_BEAM now maps to a separate TEQW_BEAM to avoid conflicts with QW.
added android multitouch emulation for windows/rawinput (in_simulatemultitouch).
split topcolor/bottomcolor from scoreboard, for dp's colormap|1024 feature.
now using utf-8 for windows consoles.
qcc warnings/errors now give clickable console links for quick+easy editing.
disabled menutint when the currently active item changes contrast or gamma (for OneManClan).
Added support for drawfont/drawfontscale.
tweaked the qcvm a little to reduce the number of pointers.
.doll file loading. still experimental and will likely crash. requires csqc active, even if its a dummy progs. this will be fixed in time. Still other things that need cleaning up.
windows: gl_font "?" shows the standard windows font-selection dialog, and can be used to select windows fonts. not all work. and you probably don't want to use windings.
fixed splitscreen support when playing mvds. added mini-scoreboards to splitscreen.
editor/debugger now shows asm if there's no linenumber info. also, pressing f1 for help shows the shortcuts.
Added support for .framegroups files for psk(psa) and iqm formats.
True support for ezquake's colour codes. Mutually exclusive with background colours.
path command output slightly more readable.
added support for digest_hex (MD4, SHA1, CRC16).
skingroups now colourmap correctly.
Fix terrain colour hints, and litdata from the wrong bsp.
fix ftp dual-homed issue. support epsv command, and enable ipv6 (eprt still not supported).
remove d3d11 compilation from the makefile. the required headers are not provided by mingw, and are not available to the build bot, so don't bother.
fix v *= v.x and similar opcodes.
fteqcc: fixed support for áéÃóú type chars in names. utf-8 files now properly supported (even with the utf-8 bom/identifier). utf-16 also supported.
fteqcc: fixed '#if 1 == 3 && 4' parsing.
fteqcc: -Werror acts on the warning, rather than as a separate error. Line numbers are thus more readable.
fteqcc: copyright message now includes compile date instead.
fteqccgui: the treeview control is now coloured depending on whether there were warnings/errors in the last compile.
fteqccgui: the output window is now focused and scrolls down as compilation progresses.
pr_dumpplatform command dumps out some pragmas to convert more serious warnings to errors. This is to avoid the infamous 'fteqcc sucks cos my code sucks' issue.
rewrote prespawn/modelist/soundlist code. server tracks progress now.
------------------------------------------------------------------------
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4167 fc73d0e0-1445-4013-8a0c-d673dee63da5
2013-03-12 22:29:40 +00:00
depth = 1 ;
2005-02-28 07:16:19 +00:00
while ( 1 )
{
if ( pr_token_type = = tt_eof )
------------------------------------------------------------------------
r4169 | acceptthis | 2013-01-17 08:55:12 +0000 (Thu, 17 Jan 2013) | 31 lines
removed MAX_VISEDICTS limit.
PEXT2_REPLACEMENTDELTAS tweaked, now has 4 million entity limit. still not enabled by default.
TE_BEAM now maps to a separate TEQW_BEAM to avoid conflicts with QW.
added android multitouch emulation for windows/rawinput (in_simulatemultitouch).
split topcolor/bottomcolor from scoreboard, for dp's colormap|1024 feature.
now using utf-8 for windows consoles.
qcc warnings/errors now give clickable console links for quick+easy editing.
disabled menutint when the currently active item changes contrast or gamma (for OneManClan).
Added support for drawfont/drawfontscale.
tweaked the qcvm a little to reduce the number of pointers.
.doll file loading. still experimental and will likely crash. requires csqc active, even if its a dummy progs. this will be fixed in time. Still other things that need cleaning up.
windows: gl_font "?" shows the standard windows font-selection dialog, and can be used to select windows fonts. not all work. and you probably don't want to use windings.
fixed splitscreen support when playing mvds. added mini-scoreboards to splitscreen.
editor/debugger now shows asm if there's no linenumber info. also, pressing f1 for help shows the shortcuts.
Added support for .framegroups files for psk(psa) and iqm formats.
True support for ezquake's colour codes. Mutually exclusive with background colours.
path command output slightly more readable.
added support for digest_hex (MD4, SHA1, CRC16).
skingroups now colourmap correctly.
Fix terrain colour hints, and litdata from the wrong bsp.
fix ftp dual-homed issue. support epsv command, and enable ipv6 (eprt still not supported).
remove d3d11 compilation from the makefile. the required headers are not provided by mingw, and are not available to the build bot, so don't bother.
fix v *= v.x and similar opcodes.
fteqcc: fixed support for áéÃóú type chars in names. utf-8 files now properly supported (even with the utf-8 bom/identifier). utf-16 also supported.
fteqcc: fixed '#if 1 == 3 && 4' parsing.
fteqcc: -Werror acts on the warning, rather than as a separate error. Line numbers are thus more readable.
fteqcc: copyright message now includes compile date instead.
fteqccgui: the treeview control is now coloured depending on whether there were warnings/errors in the last compile.
fteqccgui: the output window is now focused and scrolls down as compilation progresses.
pr_dumpplatform command dumps out some pragmas to convert more serious warnings to errors. This is to avoid the infamous 'fteqcc sucks cos my code sucks' issue.
rewrote prespawn/modelist/soundlist code. server tracks progress now.
------------------------------------------------------------------------
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4167 fc73d0e0-1445-4013-8a0c-d673dee63da5
2013-03-12 22:29:40 +00:00
{
QCC_PR_ParseError ( ERR_EOF , " EOF inside definition of %s " , name ) ;
2005-02-28 07:16:19 +00:00
break ;
------------------------------------------------------------------------
r4169 | acceptthis | 2013-01-17 08:55:12 +0000 (Thu, 17 Jan 2013) | 31 lines
removed MAX_VISEDICTS limit.
PEXT2_REPLACEMENTDELTAS tweaked, now has 4 million entity limit. still not enabled by default.
TE_BEAM now maps to a separate TEQW_BEAM to avoid conflicts with QW.
added android multitouch emulation for windows/rawinput (in_simulatemultitouch).
split topcolor/bottomcolor from scoreboard, for dp's colormap|1024 feature.
now using utf-8 for windows consoles.
qcc warnings/errors now give clickable console links for quick+easy editing.
disabled menutint when the currently active item changes contrast or gamma (for OneManClan).
Added support for drawfont/drawfontscale.
tweaked the qcvm a little to reduce the number of pointers.
.doll file loading. still experimental and will likely crash. requires csqc active, even if its a dummy progs. this will be fixed in time. Still other things that need cleaning up.
windows: gl_font "?" shows the standard windows font-selection dialog, and can be used to select windows fonts. not all work. and you probably don't want to use windings.
fixed splitscreen support when playing mvds. added mini-scoreboards to splitscreen.
editor/debugger now shows asm if there's no linenumber info. also, pressing f1 for help shows the shortcuts.
Added support for .framegroups files for psk(psa) and iqm formats.
True support for ezquake's colour codes. Mutually exclusive with background colours.
path command output slightly more readable.
added support for digest_hex (MD4, SHA1, CRC16).
skingroups now colourmap correctly.
Fix terrain colour hints, and litdata from the wrong bsp.
fix ftp dual-homed issue. support epsv command, and enable ipv6 (eprt still not supported).
remove d3d11 compilation from the makefile. the required headers are not provided by mingw, and are not available to the build bot, so don't bother.
fix v *= v.x and similar opcodes.
fteqcc: fixed support for áéÃóú type chars in names. utf-8 files now properly supported (even with the utf-8 bom/identifier). utf-16 also supported.
fteqcc: fixed '#if 1 == 3 && 4' parsing.
fteqcc: -Werror acts on the warning, rather than as a separate error. Line numbers are thus more readable.
fteqcc: copyright message now includes compile date instead.
fteqccgui: the treeview control is now coloured depending on whether there were warnings/errors in the last compile.
fteqccgui: the output window is now focused and scrolls down as compilation progresses.
pr_dumpplatform command dumps out some pragmas to convert more serious warnings to errors. This is to avoid the infamous 'fteqcc sucks cos my code sucks' issue.
rewrote prespawn/modelist/soundlist code. server tracks progress now.
------------------------------------------------------------------------
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4167 fc73d0e0-1445-4013-8a0c-d673dee63da5
2013-03-12 22:29:40 +00:00
}
else if ( depth = = 1 & & QCC_PR_CheckToken ( " , " ) )
2005-02-28 07:16:19 +00:00
arraysize + + ;
------------------------------------------------------------------------
r4169 | acceptthis | 2013-01-17 08:55:12 +0000 (Thu, 17 Jan 2013) | 31 lines
removed MAX_VISEDICTS limit.
PEXT2_REPLACEMENTDELTAS tweaked, now has 4 million entity limit. still not enabled by default.
TE_BEAM now maps to a separate TEQW_BEAM to avoid conflicts with QW.
added android multitouch emulation for windows/rawinput (in_simulatemultitouch).
split topcolor/bottomcolor from scoreboard, for dp's colormap|1024 feature.
now using utf-8 for windows consoles.
qcc warnings/errors now give clickable console links for quick+easy editing.
disabled menutint when the currently active item changes contrast or gamma (for OneManClan).
Added support for drawfont/drawfontscale.
tweaked the qcvm a little to reduce the number of pointers.
.doll file loading. still experimental and will likely crash. requires csqc active, even if its a dummy progs. this will be fixed in time. Still other things that need cleaning up.
windows: gl_font "?" shows the standard windows font-selection dialog, and can be used to select windows fonts. not all work. and you probably don't want to use windings.
fixed splitscreen support when playing mvds. added mini-scoreboards to splitscreen.
editor/debugger now shows asm if there's no linenumber info. also, pressing f1 for help shows the shortcuts.
Added support for .framegroups files for psk(psa) and iqm formats.
True support for ezquake's colour codes. Mutually exclusive with background colours.
path command output slightly more readable.
added support for digest_hex (MD4, SHA1, CRC16).
skingroups now colourmap correctly.
Fix terrain colour hints, and litdata from the wrong bsp.
fix ftp dual-homed issue. support epsv command, and enable ipv6 (eprt still not supported).
remove d3d11 compilation from the makefile. the required headers are not provided by mingw, and are not available to the build bot, so don't bother.
fix v *= v.x and similar opcodes.
fteqcc: fixed support for áéÃóú type chars in names. utf-8 files now properly supported (even with the utf-8 bom/identifier). utf-16 also supported.
fteqcc: fixed '#if 1 == 3 && 4' parsing.
fteqcc: -Werror acts on the warning, rather than as a separate error. Line numbers are thus more readable.
fteqcc: copyright message now includes compile date instead.
fteqccgui: the treeview control is now coloured depending on whether there were warnings/errors in the last compile.
fteqccgui: the output window is now focused and scrolls down as compilation progresses.
pr_dumpplatform command dumps out some pragmas to convert more serious warnings to errors. This is to avoid the infamous 'fteqcc sucks cos my code sucks' issue.
rewrote prespawn/modelist/soundlist code. server tracks progress now.
------------------------------------------------------------------------
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4167 fc73d0e0-1445-4013-8a0c-d673dee63da5
2013-03-12 22:29:40 +00:00
else if ( QCC_PR_CheckToken ( " { " ) | | QCC_PR_CheckToken ( " [ " ) )
depth + + ;
else if ( QCC_PR_CheckToken ( " } " ) | | QCC_PR_CheckToken ( " ] " ) )
{
depth - - ;
if ( depth = = 0 )
break ;
}
else
QCC_PR_Lex ( ) ;
2005-02-28 07:16:19 +00:00
}
pr_file_p = oldprfile ;
QCC_PR_Lex ( ) ;
}
2004-08-23 01:38:21 +00:00
else
2005-02-28 07:16:19 +00:00
{
2011-11-08 06:00:35 +00:00
arraysize = QCC_PR_IntConstExpr ( ) ;
QCC_PR_Expect ( " ] " ) ;
2005-02-28 07:16:19 +00:00
}
if ( arraysize < 1 )
2004-10-13 07:24:59 +00:00
{
2004-08-23 01:38:21 +00:00
QCC_PR_ParseError ( ERR_BADARRAYSIZE , " Definition of array (%s) size is not of a numerical value " , name ) ;
2012-01-17 07:57:46 +00:00
arraysize = 1 ; //grrr...
2004-10-13 07:24:59 +00:00
}
2004-08-23 01:38:21 +00:00
}
else
2012-01-17 07:57:46 +00:00
arraysize = 0 ;
2004-08-23 01:38:21 +00:00
2005-03-20 02:57:11 +00:00
if ( QCC_PR_CheckToken ( " ( " ) )
2007-04-15 17:35:58 +00:00
{
if ( inlinefunction )
QCC_PR_ParseWarning ( WARN_UNSAFEFUNCTIONRETURNTYPE , " Function returning function. Is this what you meant? (suggestion: use typedefs) " ) ;
inlinefunction = false ;
2004-08-23 01:38:21 +00:00
type = QCC_PR_ParseFunctionType ( false , type ) ;
2007-04-15 17:35:58 +00:00
}
2004-08-23 01:38:21 +00:00
if ( classname )
{
char * membername = name ;
name = qccHunkAlloc ( strlen ( classname ) + strlen ( name ) + 3 ) ;
sprintf ( name , " %s:: " MEMBERFIELDNAME , classname , membername ) ;
2008-10-05 02:55:01 +00:00
if ( ! QCC_PR_GetDef ( NULL , name , NULL , false , 0 , false ) )
2004-08-23 01:38:21 +00:00
QCC_PR_ParseError ( ERR_NOTANAME , " %s %s is not a member of class %s \n " , TypeName ( type ) , membername , classname ) ;
sprintf ( name , " %s::%s " , classname , membername ) ;
pr_classtype = QCC_TypeForName ( classname ) ;
if ( ! pr_classtype | | ! pr_classtype - > parentclass )
QCC_PR_ParseError ( ERR_NOTANAME , " %s is not a class \n " , classname ) ;
}
else
pr_classtype = NULL ;
2013-03-12 22:32:25 +00:00
gd_flags = 0 ;
if ( isstatic )
gd_flags | = GDF_STATIC ;
if ( isconstant )
gd_flags | = GDF_CONST ;
if ( ! nosave )
gd_flags | = GDF_SAVED ;
2004-11-04 04:19:10 +00:00
2013-03-12 22:32:25 +00:00
def = QCC_PR_GetDef ( type , name , pr_scope , allocatenew , arraysize , gd_flags ) ;
2004-08-23 01:38:21 +00:00
if ( ! def )
QCC_PR_ParseError ( ERR_NOTANAME , " %s is not part of class %s " , name , classname ) ;
if ( noref )
2013-03-12 22:32:25 +00:00
{
if ( type - > type = = ev_function & & ! def - > initialized )
def - > initialized = 3 ;
2004-08-23 01:38:21 +00:00
def - > references + + ;
2013-03-12 22:32:25 +00:00
}
2004-08-23 01:38:21 +00:00
if ( ! def - > initialized & & shared ) //shared count as initiialised
2011-05-15 13:23:13 +00:00
{
2004-08-23 01:38:21 +00:00
def - > shared = shared ;
def - > initialized = true ;
}
if ( externfnc )
def - > initialized = 2 ;
2009-03-29 23:47:29 +00:00
if ( isstatic )
{
------------------------------------------------------------------------
r4169 | acceptthis | 2013-01-17 08:55:12 +0000 (Thu, 17 Jan 2013) | 31 lines
removed MAX_VISEDICTS limit.
PEXT2_REPLACEMENTDELTAS tweaked, now has 4 million entity limit. still not enabled by default.
TE_BEAM now maps to a separate TEQW_BEAM to avoid conflicts with QW.
added android multitouch emulation for windows/rawinput (in_simulatemultitouch).
split topcolor/bottomcolor from scoreboard, for dp's colormap|1024 feature.
now using utf-8 for windows consoles.
qcc warnings/errors now give clickable console links for quick+easy editing.
disabled menutint when the currently active item changes contrast or gamma (for OneManClan).
Added support for drawfont/drawfontscale.
tweaked the qcvm a little to reduce the number of pointers.
.doll file loading. still experimental and will likely crash. requires csqc active, even if its a dummy progs. this will be fixed in time. Still other things that need cleaning up.
windows: gl_font "?" shows the standard windows font-selection dialog, and can be used to select windows fonts. not all work. and you probably don't want to use windings.
fixed splitscreen support when playing mvds. added mini-scoreboards to splitscreen.
editor/debugger now shows asm if there's no linenumber info. also, pressing f1 for help shows the shortcuts.
Added support for .framegroups files for psk(psa) and iqm formats.
True support for ezquake's colour codes. Mutually exclusive with background colours.
path command output slightly more readable.
added support for digest_hex (MD4, SHA1, CRC16).
skingroups now colourmap correctly.
Fix terrain colour hints, and litdata from the wrong bsp.
fix ftp dual-homed issue. support epsv command, and enable ipv6 (eprt still not supported).
remove d3d11 compilation from the makefile. the required headers are not provided by mingw, and are not available to the build bot, so don't bother.
fix v *= v.x and similar opcodes.
fteqcc: fixed support for áéÃóú type chars in names. utf-8 files now properly supported (even with the utf-8 bom/identifier). utf-16 also supported.
fteqcc: fixed '#if 1 == 3 && 4' parsing.
fteqcc: -Werror acts on the warning, rather than as a separate error. Line numbers are thus more readable.
fteqcc: copyright message now includes compile date instead.
fteqccgui: the treeview control is now coloured depending on whether there were warnings/errors in the last compile.
fteqccgui: the output window is now focused and scrolls down as compilation progresses.
pr_dumpplatform command dumps out some pragmas to convert more serious warnings to errors. This is to avoid the infamous 'fteqcc sucks cos my code sucks' issue.
rewrote prespawn/modelist/soundlist code. server tracks progress now.
------------------------------------------------------------------------
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4167 fc73d0e0-1445-4013-8a0c-d673dee63da5
2013-03-12 22:29:40 +00:00
if ( ! strcmp ( strings + def - > s_file , strings + s_file ) )
2009-03-29 23:47:29 +00:00
def - > isstatic = isstatic ;
else //if (type->type != ev_function && defaultstatic) //functions don't quite consitiute a definition
QCC_PR_ParseErrorPrintDef ( ERR_REDECLARATION , def , " can't redefine non-static as static " ) ;
}
2004-08-23 01:38:21 +00:00
// check for an initialization
2005-04-02 18:00:45 +00:00
if ( type - > type = = ev_function & & ( pr_scope ) )
2004-08-23 01:38:21 +00:00
{
2005-03-20 02:57:11 +00:00
if ( QCC_PR_CheckToken ( " = " ) )
2004-11-08 11:44:05 +00:00
{
2005-04-02 18:00:45 +00:00
QCC_PR_ParseError ( ERR_INITIALISEDLOCALFUNCTION , " local functions may not be initialised " ) ;
2004-11-08 11:44:05 +00:00
}
2004-11-04 04:19:10 +00:00
2011-11-08 06:00:35 +00:00
d = def ;
while ( d ! = def - > deftail )
2004-11-04 04:19:10 +00:00
{
2011-11-08 06:00:35 +00:00
d = d - > next ;
2004-11-04 04:19:10 +00:00
d - > initialized = 1 ; //fake function
G_FUNCTION ( d - > ofs ) = 0 ;
}
2004-08-23 01:38:21 +00:00
continue ;
}
2008-10-16 23:04:36 +00:00
if ( type - > type = = ev_field & & QCC_PR_CheckName ( " alias " ) )
2005-02-09 19:32:30 +00:00
{
2005-07-28 15:52:31 +00:00
QCC_PR_ParseError ( ERR_INTERNAL , " FTEQCC does not support this variant of decompiled hexenc \n Please obtain the original version released by Raven Software instead. " ) ;
2005-02-09 19:32:30 +00:00
name = QCC_PR_ParseName ( ) ;
}
2005-03-20 02:57:11 +00:00
else if ( QCC_PR_CheckToken ( " = " ) | | ( ( type - > type = = ev_function ) & & ( pr_token [ 0 ] = = ' { ' | | pr_token [ 0 ] = = ' [ ' | | pr_token [ 0 ] = = ' : ' ) ) ) //this is an initialisation (or a function)
2004-08-23 01:38:21 +00:00
{
if ( def - > shared )
QCC_PR_ParseError ( ERR_SHAREDINITIALISED , " shared values may not be assigned an initial value " , name ) ;
if ( def - > initialized = = 1 )
{
2011-11-08 06:00:35 +00:00
// if (def->type->type == ev_function)
// {
// i = G_FUNCTION(def->ofs);
// df = &functions[i];
// QCC_PR_ParseErrorPrintDef (ERR_REDECLARATION, def, "%s redeclared, prev instance is in %s", name, strings+df->s_file);
// }
// else
// QCC_PR_ParseErrorPrintDef(ERR_REDECLARATION, def, "%s redeclared", name);
2004-08-23 01:38:21 +00:00
}
if ( autoprototype )
{ //ignore the code and stuff
2005-03-20 02:57:11 +00:00
if ( QCC_PR_CheckToken ( " [ " ) )
2004-08-23 01:38:21 +00:00
{
2005-03-20 02:57:11 +00:00
while ( ! QCC_PR_CheckToken ( " ] " ) )
2004-08-23 01:38:21 +00:00
{
if ( pr_token_type = = tt_eof )
break ;
QCC_PR_Lex ( ) ;
}
}
2005-03-20 02:57:11 +00:00
if ( QCC_PR_CheckToken ( " { " ) )
2004-08-23 01:38:21 +00:00
{
int blev = 1 ;
//balance out the { and }
while ( blev )
{
if ( pr_token_type = = tt_eof )
break ;
2005-03-20 02:57:11 +00:00
if ( QCC_PR_CheckToken ( " { " ) )
2004-08-23 01:38:21 +00:00
blev + + ;
2005-03-20 02:57:11 +00:00
else if ( QCC_PR_CheckToken ( " } " ) )
2004-08-23 01:38:21 +00:00
blev - - ;
else
QCC_PR_Lex ( ) ; //ignore it.
}
}
else
{
2005-03-20 02:57:11 +00:00
QCC_PR_CheckToken ( " # " ) ;
2004-08-23 01:38:21 +00:00
QCC_PR_Lex ( ) ;
}
continue ;
}
2004-09-21 03:22:55 +00:00
2013-03-12 22:32:25 +00:00
def - > constant = ( isconstant | | ( ! isvar & & ! pr_scope ) ) ;
QCC_PR_ParseInitializerDef ( def ) ;
2004-08-23 01:38:21 +00:00
}
2005-04-23 19:55:49 +00:00
else
{
2005-08-27 05:47:08 +00:00
if ( type - > type = = ev_function & & isvar )
{
isconstant = ! isvar ;
def - > initialized = 1 ;
}
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
if ( type - > type = = ev_field )
{
2013-03-12 22:32:25 +00:00
//fields are const by default, even when not initialised (as they are initialised behind the scenes)
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
if ( isconstant )
def - > constant = 2 ; //special flag on fields, 2, makes the pointer obtained from them also constant.
2013-03-12 22:32:25 +00:00
else if ( isvar | | ( pr_scope & & ! isstatic ) )
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
def - > constant = 0 ;
else
def - > constant = 1 ;
2013-03-12 22:32:25 +00:00
if ( def - > constant )
{
unsigned int i ;
for ( i = 0 ; i < type - > size * ( arraysize ? arraysize : 1 ) ; i + + ) //make arrays of fields work.
* ( int * ) & qcc_pr_globals [ def - > ofs + i ] = pr . size_fields + i ;
pr . size_fields + = i ;
}
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
}
2005-04-23 19:55:49 +00:00
else
def - > constant = isconstant ;
}
2011-11-08 06:00:35 +00:00
d = def ;
while ( d ! = def - > deftail )
{
d = d - > next ;
d - > constant = def - > constant ;
d - > initialized = def - > initialized ;
}
2005-03-20 02:57:11 +00:00
} while ( QCC_PR_CheckToken ( " , " ) ) ;
2004-08-23 01:38:21 +00:00
if ( type - > type = = ev_function )
2005-03-20 02:57:11 +00:00
QCC_PR_CheckToken ( " ; " ) ;
2004-08-23 01:38:21 +00:00
else
2005-03-20 02:57:11 +00:00
{
if ( ! QCC_PR_CheckToken ( " ; " ) )
QCC_PR_ParseWarning ( WARN_UNDESIRABLECONVENTION , " Missing semicolon at end of definition " ) ;
}
2004-08-23 01:38:21 +00:00
}
/*
= = = = = = = = = = = =
PR_CompileFile
compiles the 0 terminated text , adding defintions to the pr structure
= = = = = = = = = = = =
*/
pbool QCC_PR_CompileFile ( char * string , char * filename )
2011-05-15 13:23:13 +00:00
{
2006-02-23 23:03:12 +00:00
jmp_buf oldjb ;
2004-08-23 01:38:21 +00:00
if ( ! pr . memory )
QCC_Error ( ERR_INTERNAL , " PR_CompileFile: Didn't clear " ) ;
------------------------------------------------------------------------
r4169 | acceptthis | 2013-01-17 08:55:12 +0000 (Thu, 17 Jan 2013) | 31 lines
removed MAX_VISEDICTS limit.
PEXT2_REPLACEMENTDELTAS tweaked, now has 4 million entity limit. still not enabled by default.
TE_BEAM now maps to a separate TEQW_BEAM to avoid conflicts with QW.
added android multitouch emulation for windows/rawinput (in_simulatemultitouch).
split topcolor/bottomcolor from scoreboard, for dp's colormap|1024 feature.
now using utf-8 for windows consoles.
qcc warnings/errors now give clickable console links for quick+easy editing.
disabled menutint when the currently active item changes contrast or gamma (for OneManClan).
Added support for drawfont/drawfontscale.
tweaked the qcvm a little to reduce the number of pointers.
.doll file loading. still experimental and will likely crash. requires csqc active, even if its a dummy progs. this will be fixed in time. Still other things that need cleaning up.
windows: gl_font "?" shows the standard windows font-selection dialog, and can be used to select windows fonts. not all work. and you probably don't want to use windings.
fixed splitscreen support when playing mvds. added mini-scoreboards to splitscreen.
editor/debugger now shows asm if there's no linenumber info. also, pressing f1 for help shows the shortcuts.
Added support for .framegroups files for psk(psa) and iqm formats.
True support for ezquake's colour codes. Mutually exclusive with background colours.
path command output slightly more readable.
added support for digest_hex (MD4, SHA1, CRC16).
skingroups now colourmap correctly.
Fix terrain colour hints, and litdata from the wrong bsp.
fix ftp dual-homed issue. support epsv command, and enable ipv6 (eprt still not supported).
remove d3d11 compilation from the makefile. the required headers are not provided by mingw, and are not available to the build bot, so don't bother.
fix v *= v.x and similar opcodes.
fteqcc: fixed support for áéÃóú type chars in names. utf-8 files now properly supported (even with the utf-8 bom/identifier). utf-16 also supported.
fteqcc: fixed '#if 1 == 3 && 4' parsing.
fteqcc: -Werror acts on the warning, rather than as a separate error. Line numbers are thus more readable.
fteqcc: copyright message now includes compile date instead.
fteqccgui: the treeview control is now coloured depending on whether there were warnings/errors in the last compile.
fteqccgui: the output window is now focused and scrolls down as compilation progresses.
pr_dumpplatform command dumps out some pragmas to convert more serious warnings to errors. This is to avoid the infamous 'fteqcc sucks cos my code sucks' issue.
rewrote prespawn/modelist/soundlist code. server tracks progress now.
------------------------------------------------------------------------
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4167 fc73d0e0-1445-4013-8a0c-d673dee63da5
2013-03-12 22:29:40 +00:00
QCC_PR_ClearGrabMacros ( true ) ; // clear the frame macros
2004-08-23 01:38:21 +00:00
compilingfile = filename ;
2011-05-15 13:23:13 +00:00
2004-08-23 01:38:21 +00:00
if ( opt_filenames )
{
optres_filenames + = strlen ( filename ) ;
pr_file_p = qccHunkAlloc ( strlen ( filename ) + 1 ) ;
strcpy ( pr_file_p , filename ) ;
s_file = pr_file_p - strings ;
s_file2 = 0 ;
}
else
{
s_file = s_file2 = QCC_CopyString ( filename ) ;
}
pr_file_p = string ;
pr_source_line = 0 ;
2008-11-09 22:29:28 +00:00
memcpy ( & oldjb , & pr_parse_abort , sizeof ( oldjb ) ) ;
2008-01-26 18:32:41 +00:00
if ( setjmp ( pr_parse_abort ) ) {
// dont count it as error
} else {
2008-11-09 22:29:28 +00:00
//clock up the first line
2008-01-26 18:32:41 +00:00
QCC_PR_NewLine ( false ) ;
QCC_PR_Lex ( ) ; // read first token
}
2004-08-23 01:38:21 +00:00
while ( pr_token_type ! = tt_eof )
{
if ( setjmp ( pr_parse_abort ) )
{
if ( + + pr_error_count > MAX_ERRORS )
2006-02-23 23:03:12 +00:00
{
memcpy ( & pr_parse_abort , & oldjb , sizeof ( oldjb ) ) ;
2004-08-23 01:38:21 +00:00
return false ;
2006-02-23 23:03:12 +00:00
}
2008-11-09 22:29:28 +00:00
num_continues = 0 ;
num_breaks = 0 ;
num_cases = 0 ;
2004-08-23 01:38:21 +00:00
QCC_PR_SkipToSemicolon ( ) ;
if ( pr_token_type = = tt_eof )
2006-02-23 23:03:12 +00:00
{
memcpy ( & pr_parse_abort , & oldjb , sizeof ( oldjb ) ) ;
return false ;
}
2004-08-23 01:38:21 +00:00
}
pr_scope = NULL ; // outside all functions
2011-05-15 13:23:13 +00:00
2004-08-23 01:38:21 +00:00
QCC_PR_ParseDefs ( NULL ) ;
}
2006-02-23 23:03:12 +00:00
memcpy ( & pr_parse_abort , & oldjb , sizeof ( oldjb ) ) ;
2011-05-15 13:23:13 +00:00
2004-08-23 01:38:21 +00:00
return ( pr_error_count = = 0 ) ;
}
pbool QCC_Include ( char * filename )
{
char * newfile ;
char fname [ 512 ] ;
char * opr_file_p ;
QCC_string_t os_file , os_file2 ;
int opr_source_line ;
char * ocompilingfile ;
struct qcc_includechunk_s * oldcurrentchunk ;
ocompilingfile = compilingfile ;
os_file = s_file ;
os_file2 = s_file2 ;
opr_source_line = pr_source_line ;
opr_file_p = pr_file_p ;
oldcurrentchunk = currentchunk ;
2005-08-27 05:47:08 +00:00
strcpy ( fname , filename ) ;
2004-10-13 07:24:59 +00:00
QCC_LoadFile ( fname , ( void * ) & newfile ) ;
2004-08-23 01:38:21 +00:00
currentchunk = NULL ;
pr_file_p = newfile ;
QCC_PR_CompileFile ( newfile , fname ) ;
currentchunk = oldcurrentchunk ;
compilingfile = ocompilingfile ;
s_file = os_file ;
s_file2 = os_file2 ;
pr_source_line = opr_source_line ;
pr_file_p = opr_file_p ;
// QCC_PR_IncludeChunk(newfile, false, fname);
return true ;
}
# endif