2004-08-23 01:38:21 +00:00
# define COMPILER
# define PROGSUSED
//#define COMMONINLINES
//#define inline _inline
# include "cmdlib.h"
# include <setjmp.h>
/*
# include <stdio.h>
# include <conio.h>
# include "pr_comp.h"
*/
//this is for testing
# define WRITEASM
2019-01-15 14:12:49 +00:00
# ifndef MAX_QPATH
# define MAX_QPATH 128
# endif
# ifndef MAX_OSPATH
# define MAX_OSPATH 1024
# endif
2004-08-23 01:38:21 +00:00
# ifdef __MINGW32_VERSION
# define MINGW
# endif
# define progfuncs qccprogfuncs
extern progfuncs_t * qccprogfuncs ;
2004-09-07 18:26:31 +00:00
# ifndef _WIN32
# define stricmp strcasecmp
# define strnicmp strncasecmp
# endif
2017-10-31 22:52:58 +00:00
# ifdef _MSC_VER //ffs
# define strtoull _strtoui64
# ifndef PRIxPTR
# define PRIxPTR "Ix"
# endif
# else
# ifndef PRIxPTR
# define PRIxPTR "Ix"
# endif
# endif
2004-08-23 01:38:21 +00:00
void * qccHunkAlloc ( size_t mem ) ;
2004-10-13 07:24:59 +00:00
void qccClearHunk ( void ) ;
2004-08-23 01:38:21 +00:00
2005-05-22 13:47:54 +00:00
extern short ( * PRBigShort ) ( short l ) ;
extern short ( * PRLittleShort ) ( short l ) ;
2006-11-10 15:48:18 +00:00
extern int ( * PRBigLong ) ( int l ) ;
extern int ( * PRLittleLong ) ( int l ) ;
2005-05-22 13:47:54 +00:00
extern float ( * PRBigFloat ) ( float l ) ;
extern float ( * PRLittleFloat ) ( float l ) ;
2004-08-23 01:38:21 +00:00
# define MAX_ERRORS 10
2011-10-29 23:16:51 +00:00
# define MAX_NAME 256 // chars long
2004-08-23 01:38:21 +00:00
extern unsigned int MAX_REGS ;
2013-03-12 22:32:25 +00:00
extern unsigned int MAX_LOCALS ;
extern unsigned int MAX_TEMPS ;
2004-08-23 01:38:21 +00:00
extern int MAX_STRINGS ;
extern int MAX_GLOBALS ;
extern int MAX_FIELDS ;
extern int MAX_STATEMENTS ;
extern int MAX_FUNCTIONS ;
------------------------------------------------------------------------
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 QCC_MAX_SOUNDS 1024 //convert to int?
# define QCC_MAX_TEXTURES 1024 //convert to int?
# define QCC_MAX_MODELS 1024 //convert to int?
# define QCC_MAX_FILES 1024 //convert to int?
2004-08-23 01:38:21 +00:00
# define MAX_DATA_PATH 64
extern int MAX_CONSTANTS ;
2011-11-08 06:00:35 +00:00
# define MAXCONSTANTNAMELENGTH 64
2004-08-23 01:38:21 +00:00
# define MAXCONSTANTPARAMLENGTH 32
2008-11-09 22:29:28 +00:00
# define MAXCONSTANTPARAMS 32
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
typedef enum { QCF_STANDARD , QCF_HEXEN2 , QCF_DARKPLACES , QCF_FTE , QCF_FTEDEBUG , QCF_FTEH2 , QCF_KK7 , QCF_QTEST } qcc_targetformat_t ;
2004-08-23 01:38:21 +00:00
extern qcc_targetformat_t qcc_targetformat ;
/*
TODO :
" stopped at 10 errors "
other pointer types for models and clients ?
compact string heap ?
2005-07-28 15:33:27 +00:00
always initialize all variables to something safe
2004-08-23 01:38:21 +00:00
the def - > type - > type arrangement is really silly .
return type checking
parm count type checking
immediate overflow checking
pass the first two parms in call - > b and call - > c
*/
/*
comments
- - - - - - - -
// comments discard text until the end of line
/ * * / comments discard all enclosed text ( spaced out on this line because this documentation is in a regular C comment block , and typing them in normally causes a parse error )
code structure
- - - - - - - - - - - - - -
A definition is :
< type > < name > [ = < immediate > ] { , < name > [ = < immediate > ] } ;
types
- - - - -
simple types : void , float , vector , string , or entity
float width , height ;
string name ;
entity self , other ;
vector types :
vector org ; // also creates org_x, org_y, and org_z float defs
A function type is specified as : simpletype ( type name { , type name } )
The names are ignored except when the function is initialized .
void ( ) think ;
entity ( ) FindTarget ;
void ( vector destination , float speed , void ( ) callback ) SUB_CalcMove ;
void ( . . . ) dprint ; // variable argument builtin
A field type is specified as : . type
. vector origin ;
. string netname ;
. void ( ) think , touch , use ;
names
- - - - -
Names are a maximum of 64 characters , must begin with A - Z , a - z , or _ , and can continue with those characters or 0 - 9.
There are two levels of scoping : global , and function . The parameter list of a function and any vars declared inside a function with the " local " statement are only visible within that function ,
immediates
- - - - - - - - - -
Float immediates must begin with 0 - 9 or minus sign . .5 is illegal .
A parsing ambiguity is present with negative constants . " a-5 " will be parsed as " a " , then " -5 " , causing an error . Seperate the - from the digits with a space " a - 5 " to get the proper behavior .
12
1.6
0.5
- 100
Vector immediates are three float immediates enclosed in single quotes .
' 0 0 0 '
' 20.5 - 10 0.00001 '
String immediates are characters enclosed in double quotes . The string cannot contain explicit newlines , but the escape character \ n can embed one . The \ " escape can be used to include a quote in the string.
" maps/jrwiz1.bsp "
" sound/nin/pain.wav "
" ouch! \n "
Code immediates are statements enclosed in { } braces .
statement :
{ < multiple statements > }
< expression > ;
local < type > < name > [ = < immediate > ] { , < name > [ = < immediate > ] } ;
return < expression > ;
if ( < expression > ) < statement > [ else < statement > ] ;
while ( < expression > ) < statement > ;
do < statement > while ( < expression > ) ;
< function name > ( < function parms > ) ;
expression :
combiations of names and these operators with standard C precedence :
" && " , " || " , " <= " , " >= " , " == " , " != " , " ! " , " * " , " / " , " - " , " + " , " = " , " . " , " < " , " > " , " & " , " | "
Parenthesis can be used to alter order of operation .
The & and | operations perform integral bit ops on floats
A built in function immediate is a number sign followed by an integer .
# 1
# 12
compilation
- - - - - - - - - - -
Source files are processed sequentially without dumping any state , so if a defs file is the first one processed , the definitions will be available to all other files .
The language is strongly typed and there are no casts .
Anything that is initialized is assumed to be constant , and will have immediates folded into it . If you change the value , your program will malfunction . All uninitialized globals will be saved to savegame files .
Functions cannot have more than eight parameters .
Error recovery during compilation is minimal . It will skip to the next global definition , so you will never see more than one error at a time in a given function . All compilation aborts after ten error messages .
Names can be defined multiple times until they are defined with an initialization , allowing functions to be prototyped before their definition .
void ( ) MyFunction ; // the prototype
void ( ) MyFunction = // the initialization
{
dprint ( " we're here \n " ) ;
} ;
entities and fields
- - - - - - - - - - - - - - - - - - -
execution
- - - - - - - - -
Code execution is initiated by C code in quake from two main places : the timed think routines for periodic control , and the touch function when two objects impact each other .
There are three global variables that are set before beginning code execution :
entity world ; // the server's world object, which holds all global
// state for the server, like the deathmatch flags
// and the body ques.
entity self ; // the entity the function is executing for
entity other ; // the other object in an impact, not used for thinks
float time ; // the current game time. Note that because the
// entities in the world are simulated sequentially,
// time is NOT strictly increasing. An impact late
// in one entity's time slice may set time higher
// than the think function of the next entity.
// The difference is limited to 0.1 seconds.
Execution is also caused by a few uncommon events , like the addition of a new client to an existing server .
There is a runnaway counter that stops a program if 100000 statements are executed , assuming it is in an infinite loop .
It is acceptable to change the system set global variables . This is usually done to pose as another entity by changing self and calling a function .
The interpretation is fairly efficient , but it is still over an order of magnitude slower than compiled C code . All time consuming operations should be made into built in functions .
A profile counter is kept for each function , and incremented for each interpreted instruction inside that function . The " profile " console command in Quake will dump out the top 10 functions , then clear all the counters . The " profile all " command will dump sorted stats for every function that has been executed .
afunc ( 4 , bfunc ( 1 , 2 , 3 ) ) ;
2005-07-28 15:22:15 +00:00
will fail because there is a shared parameter marshaling area , which will cause the 1 from bfunc to overwrite the 4 already placed in parm0 . When a function is called , it copies the parms from the globals into it ' s privately scoped variables , so there is no collision when calling another function .
2004-08-23 01:38:21 +00:00
total = factorial ( 3 ) + factorial ( 4 ) ;
Will fail because the return value from functions is held in a single global area . If this really gets on your nerves , tell me and I can work around it at a slight performance and space penalty by allocating a new register for the function call and copying it out .
built in functions
- - - - - - - - - - - - - - - - - -
void ( string text ) dprint ;
Prints the string to the server console .
void ( entity client , string text ) cprint ;
Prints a message to a specific client .
void ( string text ) bprint ;
Broadcast prints a message to all clients on the current server .
entity ( ) spawn ;
Returns a totally empty entity . You can manually set everything up , or just set the origin and call one of the existing entity setup functions .
entity ( entity start , . string field , string match ) find ;
Searches the server entity list beginning at start , looking for an entity that has entity . field = match . To start at the beginning of the list , pass world . World is returned when the end of the list is reached .
< FIXME : define all the other functions . . . >
gotchas
- - - - - - -
The & & and | | operators DO NOT EARLY OUT like C !
Don ' t confuse single quoted vectors with double quoted strings
The function declaration syntax takes a little getting used to .
Don ' t forget the ; after the trailing brace of a function initialization .
Don ' t forget the " local " before defining local variables .
There are no + + / - - operators , or operate / assign operators .
*/
# if 1
# include "hash.h"
extern hashtable_t compconstantstable ;
2017-10-31 22:52:58 +00:00
extern hashtable_t globalstable , localstable , typedeftable ;
2004-08-23 01:38:21 +00:00
# endif
# ifdef WRITEASM
2012-01-01 17:34:32 +00:00
extern FILE * asmfile ;
2013-06-02 06:03:54 +00:00
extern pbool asmfilebegun ;
2004-08-23 01:38:21 +00:00
# endif
//=============================================================================
2005-07-28 15:33:27 +00:00
// offsets are always multiplied by 4 before using
2004-08-23 01:38:21 +00:00
typedef unsigned int gofs_t ; // offset in global data block
typedef struct QCC_function_s QCC_function_t ;
# define MAX_PARMS 8
2015-04-14 12:24:05 +00:00
//keep this sizeof(float)
typedef union QCC_eval_s
{
QCC_string_t string ;
float _float ;
2018-06-18 16:44:29 +00:00
# ifdef __GNUC__
float vector [ 0 ] ; //gnuc extension. I'm using it to mute clang warnings.
# else
float vector [ 1 ] ; //should be 3, except that then eval_t would be too big.
# endif
2015-04-14 12:24:05 +00:00
func_t function ;
int _int ;
// union QCC_eval_s *ptr;
} QCC_eval_t ;
//must be the maximum size possible for a single basic type.
typedef union QCC_evalstorage_s
{
QCC_string_t string ;
float _float ;
float vector [ 3 ] ;
func_t function ;
int _int ;
// union QCC_eval_s *ptr;
} QCC_evalstorage_t ;
2013-06-23 03:59:48 +00:00
struct QCC_typeparam_s
2013-06-02 06:03:54 +00:00
{
struct QCC_type_s * type ;
2016-07-12 00:40:13 +00:00
QCC_sref_t defltvalue ;
2018-10-11 10:31:23 +00:00
pbool optional : 1 ; //argument may safely be omitted, for builtin functions. for qc functions use the defltvalue instead.
pbool isvirtual : 1 ; //const, with implicit initialisation only. valid for structs
2016-07-12 00:40:13 +00:00
unsigned char out ; //0=in,1==inout,2=out
2013-06-02 06:03:54 +00:00
unsigned int ofs ;
unsigned int arraysize ;
char * paramname ;
} ;
2014-09-08 23:35:32 +00:00
struct accessor_s
{
struct accessor_s * next ;
struct QCC_type_s * type ;
struct QCC_type_s * indexertype ; //null if not indexer
2015-04-14 12:24:05 +00:00
QCC_sref_t getset_func [ 2 ] ;
2018-07-14 18:50:20 +00:00
QCC_sref_t staticval ;
2015-01-21 18:18:37 +00:00
pbool getset_isref [ 2 ] ;
2014-09-08 23:35:32 +00:00
char * fieldname ;
} ;
2013-06-02 06:03:54 +00:00
2004-08-23 01:38:21 +00:00
typedef struct QCC_type_s
{
etype_t type ;
struct QCC_type_s * parentclass ; //type_entity...
// function types are more complex
struct QCC_type_s * aux_type ; // return type or field type
2013-06-02 06:03:54 +00:00
struct QCC_typeparam_s * params ; //[num_parms]
unsigned int num_parms ;
2004-08-23 01:38:21 +00:00
unsigned int size ;
2013-06-02 06:03:54 +00:00
pbool typedefed : 1 ;
added r_meshpitch cvar that allows for fixing the unfixable mesh pitch bug from vanilla... needs a better name... do note that this will break pretty much any mod, so this is really only for TCs designed to use it. Its likely that I missed places.
nqsv: added support for spectators with nq clients. the angles are a bit rough, but hey. need to do something about frags so nq clients know who's a spectator. use 'cmd observe' to get an nq client to spectate on an fte server (then attack/jump behave the same as in qw clients).
nqsv: rewrote EF_MUZZLEFLASH handling, so svc_muzzleflash is now translated properly to EF_MUZZLEFLASH, and vice versa. No more missing muzzleflashes!
added screenshot_cubemap, so you can actually pre-generate cubemaps with fte (which can be used for reflections or whatever).
misc fixes (server crash, a couple of other less important ones).
external files based on a model's name will now obey r_replacemodels properly, instead of needing to use foo.mdl_0.skin for foo.md3.
identify <playernum> should now use the correct masked ip, instead of abrubtly failing (reported by kt)
vid_toggle console command should now obey vid_width and vid_height when switching to fullscreen, but only if vid_fullscreen is actually set, which should make it seem better behaved (reported by kt).
qcc: cleaned up sym->symboldata[sym->ofs] to be more consistent at all stages.
qcc: typedef float vec4[4]; now works to define a float array with 4 elements (however, it will be passed by-value rather than by-reference).
qcc: cleaned up optional vs __out ordering issues.
qccgui: shift+f3 searches backwards
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5064 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-02-27 09:34:35 +00:00
pbool vargs : 1 ; //function has vargs
pbool vargcount : 1 ; //function has special varg count param
2018-07-14 18:50:20 +00:00
const char * name ;
const char * aname ;
2014-09-05 19:17:57 +00:00
2014-09-08 23:35:32 +00:00
struct accessor_s * accessors ;
2015-06-16 23:53:58 +00:00
added r_meshpitch cvar that allows for fixing the unfixable mesh pitch bug from vanilla... needs a better name... do note that this will break pretty much any mod, so this is really only for TCs designed to use it. Its likely that I missed places.
nqsv: added support for spectators with nq clients. the angles are a bit rough, but hey. need to do something about frags so nq clients know who's a spectator. use 'cmd observe' to get an nq client to spectate on an fte server (then attack/jump behave the same as in qw clients).
nqsv: rewrote EF_MUZZLEFLASH handling, so svc_muzzleflash is now translated properly to EF_MUZZLEFLASH, and vice versa. No more missing muzzleflashes!
added screenshot_cubemap, so you can actually pre-generate cubemaps with fte (which can be used for reflections or whatever).
misc fixes (server crash, a couple of other less important ones).
external files based on a model's name will now obey r_replacemodels properly, instead of needing to use foo.mdl_0.skin for foo.md3.
identify <playernum> should now use the correct masked ip, instead of abrubtly failing (reported by kt)
vid_toggle console command should now obey vid_width and vid_height when switching to fullscreen, but only if vid_fullscreen is actually set, which should make it seem better behaved (reported by kt).
qcc: cleaned up sym->symboldata[sym->ofs] to be more consistent at all stages.
qcc: typedef float vec4[4]; now works to define a float array with 4 elements (however, it will be passed by-value rather than by-reference).
qcc: cleaned up optional vs __out ordering issues.
qccgui: shift+f3 searches backwards
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5064 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-02-27 09:34:35 +00:00
struct QCC_type_s * ptrto ; //(cache) this points to a type that is a pointer back to this type. yeah, weird.
2004-08-23 01:38:21 +00:00
} QCC_type_t ;
int typecmp ( QCC_type_t * a , QCC_type_t * b ) ;
------------------------------------------------------------------------
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 typecmp_lax ( QCC_type_t * a , QCC_type_t * b ) ;
2017-02-27 09:53:59 +00:00
QCC_type_t * QCC_PR_DuplicateType ( QCC_type_t * in , pbool recurse ) ;
2004-08-23 01:38:21 +00:00
2015-04-14 12:24:05 +00:00
typedef struct temp_s temp_t ;
2011-03-12 13:51:40 +00:00
void QCC_PurgeTemps ( void ) ;
2015-04-14 12:24:05 +00:00
void QCC_FinaliseTemps ( void ) ;
2004-08-23 01:38:21 +00:00
//not written
typedef struct QCC_def_s
{
QCC_type_t * type ;
char * name ;
2013-03-12 23:15:32 +00:00
char * comment ; //ui info
2004-08-23 01:38:21 +00:00
struct QCC_def_s * next ;
struct QCC_def_s * nextlocal ; //provides a chain of local variables for the opt_locals_marshalling optimisation.
gofs_t ofs ;
2015-04-14 12:24:05 +00:00
struct QCC_function_s * scope ; // function the var was defined in, or NULL
2011-11-08 06:00:35 +00:00
struct QCC_def_s * deftail ; // arrays and structs create multiple globaldef objects providing different types at the different parts of the single object (struct), or alternative names (vectors). this allows us to correctly set the const type based upon how its initialised.
2013-12-29 22:48:28 +00:00
struct QCC_def_s * generatedfor ;
2017-10-12 12:02:25 +00:00
int constant ; // 1 says we can use the value over and over again. 2 is used on fields, for some reason.
2004-08-23 01:38:21 +00:00
2015-04-14 12:24:05 +00:00
struct QCC_def_s * symbolheader ; //this is the original symbol within which the def is stored.
2016-09-08 19:04:35 +00:00
union QCC_eval_s * symboldata ; //null if uninitialised. use sym->symboldata[sym->ofs] to index.
2015-04-14 12:24:05 +00:00
unsigned int symbolsize ; //total byte size of symbol
int refcount ; //if 0, temp can be reused. tracked on globals too in order to catch bugs that would otherwise be a little too obscure.
2004-08-23 01:38:21 +00:00
int timescalled ; //part of the opt_stripfunctions optimisation.
2016-09-08 19:04:35 +00:00
const char * filen ;
int s_filed ;
2004-08-23 01:38:21 +00:00
int s_line ;
int arraysize ;
2015-04-14 12:24:05 +00:00
//should really use proper flags
pbool funccalled : 1 ; //was called somewhere.
2016-07-12 00:40:13 +00:00
pbool read : 1 ; //variable was read
pbool written : 1 ; //variable was written
pbool referenced : 1 ; //was used somewhere in the code (even if it can still be stripped). this controls warnings only.
pbool shared : 1 ; //weird multiprogs flag thing.
pbool saved : 1 ; //def may be saved to saved games.
pbool isstatic : 1 ; //global, even if scoped. also specific to the file it was seen in.
pbool subscoped_away : 1 ; //this local is no longer linked into the locals hash table. don't do remove it twice.
2017-10-12 12:02:25 +00:00
// pbool followptr:1; //float &foo;
2016-07-12 00:40:13 +00:00
pbool strip : 1 ; //info about this def should be stripped. it may still consume globals space however, and its storage can still be used, its just not visible.
pbool allowinline : 1 ; //calls to this function will attempt to inline the specified function. requires const, supposedly.
pbool used : 1 ; //if it remains 0, it may be stripped. this is forced for functions and fields. commonly 0 on fields.
2017-10-12 12:02:25 +00:00
pbool unused : 1 ; //silently strip it if it wasn't referenced.
2016-07-12 00:40:13 +00:00
pbool localscope : 1 ; //is a local, as opposed to a static (which is only visible within its scope)
pbool arraylengthprefix : 1 ; //hexen2 style arrays have a length prefixed to them for auto bounds checks. this can only work reliably for simple non-struct arrays.
2016-09-08 19:04:35 +00:00
pbool assumedtype : 1 ; //#merged. the type is not reliable.
pbool weak : 1 ; //ignore any initialiser value (only permitted on functions)
2017-10-12 12:02:25 +00:00
pbool accumulate : 1 ; //don't finalise the function's statements.
pbool nofold : 1 ;
2018-10-11 10:31:23 +00:00
pbool initialized : 1 ; //true when a declaration included "= immediate".
pbool isextern : 1 ; //fteqw-specific lump entry
2015-04-14 12:24:05 +00:00
int fromstatement ; //statement that it is valid from.
2004-08-23 01:38:21 +00:00
temp_t * temp ;
} QCC_def_t ;
2015-04-14 12:24:05 +00:00
struct temp_s {
QCC_def_t * def ;
unsigned char locked ;
unsigned int size ;
struct QCC_function_s * lastfunc ;
unsigned int laststatement ;
} ;
extern size_t tempsused ;
2013-09-26 14:36:52 +00:00
typedef struct
{
enum {
REF_GLOBAL , //(global.ofs) - use vector[2] is an array ref or vector_z
REF_ARRAY , //(global.ofs+wordoffset) - constant offsets should be direct references, variable offsets will generally result in function calls
2015-06-17 13:05:20 +00:00
REF_ARRAYHEAD , //(global) - like REF_ARRAY, but otherwise convert to a pointer.
2013-09-26 14:36:52 +00:00
REF_POINTER , //*(pointerdef+wordindex) - maths...
REF_FIELD , //(entity.field) - reading is a single load, writing requires address+storep
REF_STRING , //"hello"[1]=='e' - special opcodes, or str2chr builtin, or something
2014-09-05 19:17:57 +00:00
REF_NONVIRTUAL , //(global.ofs) - identical to global except for function calls, where index can be used to provide the 'newself' for the call.
2018-10-11 10:31:23 +00:00
REF_THISCALL , //(global.ofs) - identical to global except for function calls, where index is used as the first argument.
2014-09-05 19:17:57 +00:00
REF_ACCESSOR //buf_create()[5]
2013-09-26 14:36:52 +00:00
} type ;
2015-04-14 12:24:05 +00:00
QCC_sref_t base ;
QCC_sref_t index ;
2013-09-26 14:36:52 +00:00
QCC_type_t * cast ; //entity.float is float, not pointer.
2014-09-08 23:35:32 +00:00
struct accessor_s * accessor ; //the accessor field of base that we're trying to use
2013-09-26 14:36:52 +00:00
int postinc ; //+1 or -1
pbool readonly ; //for whatever reason, like base being a const
} QCC_ref_t ;
2004-08-23 01:38:21 +00:00
//============================================================================
// pr_loc.h -- program local defs
//=============================================================================
extern char QCC_copyright [ 1024 ] ;
extern char QCC_Packname [ 5 ] [ 128 ] ;
extern int QCC_packid ;
2018-09-18 02:05:35 +00:00
extern const unsigned int type_size [ ] ;
2004-08-23 01:38:21 +00:00
//extern QCC_def_t *def_for_type[9];
2014-04-03 02:39:51 +00:00
extern QCC_type_t * type_void , * type_string , * type_float , * type_vector , * type_entity , * type_field , * type_function , * type_floatfunction , * type_pointer , * type_floatpointer , * type_intpointer , * type_integer , * type_variant , * type_floatfield ;
2015-08-02 11:36:46 +00:00
extern char * basictypenames [ ] ;
2004-08-23 01:38:21 +00:00
struct QCC_function_s
{
2015-04-14 12:24:05 +00:00
int builtin ; // the builtin number. >= 0
int code ; // first statement. if -1, is a builtin.
2016-09-08 19:04:35 +00:00
dfunction_t * merged ; // this function was merged. this is the index to use to ensure that the parms are sized correctly..
string_t s_filed ; // source file with definition
const char * filen ;
2015-04-14 12:24:05 +00:00
int line ;
2017-10-12 12:02:25 +00:00
int line_end ;
2015-04-14 12:24:05 +00:00
char * name ; //internal name of function
2015-12-28 17:41:39 +00:00
struct QCC_function_s * parentscope ; //for nested functions
2015-04-14 12:24:05 +00:00
struct QCC_type_s * type ; //same as the def's type
struct QCC_def_s * def ;
struct QCC_def_s * firstlocal ;
2017-08-14 16:38:44 +00:00
QCC_sref_t returndef ; //default return value
2015-04-14 12:24:05 +00:00
pbool privatelocals ; //false means locals may overlap with other functions, true is needed for compat if stuff is uninitialised.
2013-09-26 14:36:52 +00:00
// unsigned int parm_ofs[MAX_PARMS]; // always contiguous, right?
2017-10-12 12:02:25 +00:00
QCC_statement_t * statements ; //if set, then this function isn't finialised yet.
size_t numstatements ;
2004-08-23 01:38:21 +00:00
} ;
//
// output generated by prog parsing
//
typedef struct
{
char * memory ;
int max_memory ;
int current_memory ;
QCC_type_t * types ;
QCC_def_t def_head ; // unused head of linked list
QCC_def_t * def_tail ; // add new defs after this and move it
2015-04-14 12:24:05 +00:00
QCC_def_t local_head ; // chain of variables which need to be pushed and stuff (head unused).
QCC_def_t * local_tail ; // add new defs after this and move it
2004-08-23 01:38:21 +00:00
2015-04-14 12:24:05 +00:00
unsigned int size_fields ;
2004-08-23 01:38:21 +00:00
} QCC_pr_info_t ;
extern QCC_pr_info_t pr ;
typedef struct
{
2011-11-08 06:00:35 +00:00
char name [ MAXCONSTANTNAMELENGTH ] ;
2010-07-03 21:49:48 +00:00
char * value ;
2004-08-23 01:38:21 +00:00
char params [ MAXCONSTANTPARAMS ] [ MAXCONSTANTPARAMLENGTH ] ;
int numparams ;
2017-08-14 16:38:44 +00:00
int inside : 10 ; //cuts off at some point
2013-12-29 22:48:28 +00:00
pbool used : 1 ;
pbool evil : 1 ;
pbool varg : 1 ;
2017-09-20 11:27:13 +00:00
const char * fromfile ;
2017-08-14 16:38:44 +00:00
int fromline ;
2004-08-23 01:38:21 +00:00
int namelen ;
} CompilerConstant_t ;
2016-07-12 00:40:13 +00:00
char * QCC_PR_GetDefinesList ( void ) ;
2004-08-23 01:38:21 +00:00
//============================================================================
extern pbool pr_dumpasm ;
2018-10-11 10:31:23 +00:00
extern pbool preprocessonly ;
2004-08-23 01:38:21 +00:00
//extern QCC_def_t **pr_global_defs; // to find def for a global variable
typedef enum {
tt_eof , // end of file reached
tt_name , // an alphanumeric name token
tt_punct , // code punctuation
tt_immediate , // string, float, vector
} token_type_t ;
extern char pr_token [ 8192 ] ;
extern token_type_t pr_token_type ;
2012-11-27 03:23:19 +00:00
extern int pr_token_line ;
extern int pr_token_line_last ;
2004-08-23 01:38:21 +00:00
extern QCC_type_t * pr_immediate_type ;
2015-04-14 12:24:05 +00:00
extern QCC_evalstorage_t pr_immediate ;
2004-08-23 01:38:21 +00:00
2005-03-20 02:57:11 +00:00
extern pbool keyword_asm ;
extern pbool keyword_break ;
2004-08-23 01:38:21 +00:00
extern pbool keyword_case ;
2005-03-20 02:57:11 +00:00
extern pbool keyword_class ;
extern pbool keyword_const ;
Reworked client support for DPP5+. less code now, its much more graceful.
added waterfog command. waterfog overrides regular fog only when the view is in water.
fixed 64bit printf format specifiers. should work better on winxp64.
fixed some spec angle weirdness.
fixed viewsize 99.99 weirdness with ezhud.
fixed extra offset on the console (exhibited in 64bit builds, but not limited to).
fixed .avi playback, can now actually display frames again.
reimplemented line sparks.
fixed r_editlights_save flipping the light's pitch.
fixed issue with oggs failing to load.
fixed condump to cope with unicode properly.
made sv_bigcoords default except in quake. hexen2 kinda needs it for bsp angle precision.
fixed nq server to not stall weirdly on map changes.
fixed qwprogs svc_cdtrack not bugging out with nq clients on the server.
fixed restart command to load the last map run by the server, instead of start.bsp (when idle)
optimised d3d9 renderer a little. now uses less draw calls, especially with complex scenes. seems to get higher framerates than opengl now.
fixed d3d9 renderer to not bug out quite so much when run fullscreen (shader subsystem is now correctly initialised).
fixed a couple of bugs from font change. also now supports utf-8 in a few more places.
r_editlights_reload no longer generates rtlights inside the void. this resolves a few glitches (but should also help framerates a little).
fixed so corona-only lights won't generate shadowmaps and waste lots of time.
removed lots of #defines from qclib. I should never have made them in the first place, but I was lazy. obviously there's more left that I cba to remove yet.
fixed nested calls with variant-vectors. this fixes csaddon's light editor.
fixed qcc hc calling conventions using redundant stores.
disabled keywords can still be used by using __keyword instead.
fixed ftegccgui grep feature.
fixed motionless-dog qcc bug.
tweaked qcc warnings a little. -Wall is now a viable setting. you should be able to fix all those warnings.
fixed qw svc_intermission + dpp5+ clients bug.
fixed annoying spam about disconnecting in hexen2.
rewrote status command a little to cope with ipv6 addresses more gracefully
fixed significant stall when hibernating/debugging a server with a player sitting on it.
fixed truelightning.
fixed rocketlight overriding pflags.
fixed torches vanishing on vid_restart.
fixed issue with decal scaling.
fixed findentityfield builtin.
fixed fteqcc issue with ptr+1
fixed use of arrays inside class functions.
fixed/implemented fteqcc emulation of pointer opcodes.
added __inout keyword to fteqcc, so that it doesn't feel so horrendous.
fixed sizeof(*foo)
fixed *struct = struct;
fixed recursive structs.
fixed fteqcc warning report.
fixed sdl2 controller support, hopefully.
attempted to implement xinput, including per-player audio playback.
slightly fixed relaxed attitude to mouse focus when running fullscreen.
fixed weird warnings/errors with 'ent.arrayhead' terms. now generates sane errors.
implemented bindmaps (for csqc).
fixed crashing bug with eprint builtin.
implemented subset of music_playlist_* functionality. significant changes to music playback.
fixed some more dpcsqc compat.
fixed binds menu. now displays and accepts modifiers.
fixed issues with huge lightmaps.
fixed protocol determinism with dp clients connecting to fte servers. the initial getchallenge request now inhibits vanilla nq connection requests.
implemented support for 'dupe' userinfo key, allowing clients to request client->server packet duplication. should probably queue them tbh.
implemented sv_saveentfile command.
fixed resume after breaking inside a stepped-over function.
fixed erroneous footer after debugging.
(I wonder just how many things I broke with these fixes)
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4946 fc73d0e0-1445-4013-8a0c-d673dee63da5
2015-07-26 10:56:18 +00:00
extern pbool keyword_inout ;
2011-11-08 06:00:35 +00:00
extern pbool keyword_optional ;
2005-03-20 02:57:11 +00:00
extern pbool keyword_continue ;
2004-08-23 01:38:21 +00:00
extern pbool keyword_default ;
extern pbool keyword_do ;
2005-03-20 02:57:11 +00:00
extern pbool keyword_entity ;
extern pbool keyword_float ;
extern pbool keyword_for ;
2004-08-23 01:38:21 +00:00
extern pbool keyword_goto ;
2005-03-20 02:57:11 +00:00
extern pbool keyword_int ;
extern pbool keyword_integer ;
2004-08-23 01:38:21 +00:00
extern pbool keyword_state ;
extern pbool keyword_string ;
2005-03-20 02:57:11 +00:00
extern pbool keyword_struct ;
extern pbool keyword_switch ;
extern pbool keyword_thinktime ;
2013-07-31 01:59:16 +00:00
extern pbool keyword_loop ;
extern pbool keyword_until ;
2005-03-20 02:57:11 +00:00
extern pbool keyword_var ;
2004-08-23 01:38:21 +00:00
extern pbool keyword_vector ;
2005-03-20 02:57:11 +00:00
extern pbool keyword_union ;
extern pbool keyword_enum ; //kinda like in c, but typedef not supported.
extern pbool keyword_enumflags ; //like enum, but doubles instead of adds 1.
extern pbool keyword_typedef ; //fixme
extern pbool keyword_extern ; //function is external, don't error or warn if the body was not found
extern pbool keyword_shared ; //mark global to be copied over when progs changes (part of FTE_MULTIPROGS)
extern pbool keyword_noref ; //nowhere else references this, don't strip it.
extern pbool keyword_nosave ; //don't write the def to the output.
2015-04-14 12:24:05 +00:00
extern pbool keyword_inline ; //don't write the def to the output.
extern pbool keyword_strip ; //don't write the def to the output.
2005-03-20 02:57:11 +00:00
extern pbool keyword_union ; //you surly know what a union is!
2016-09-08 19:04:35 +00:00
extern pbool keyword_wrap ;
extern pbool keyword_weak ;
2017-10-12 12:02:25 +00:00
extern pbool keyword_accumulate ;
2005-03-20 02:57:11 +00:00
2015-06-04 06:15:14 +00:00
extern pbool keyword_unused ;
extern pbool keyword_used ;
extern pbool keyword_static ;
extern pbool keyword_nonstatic ;
extern pbool keyword_ignore ;
2004-08-23 01:38:21 +00:00
extern pbool keywords_coexist ;
extern pbool output_parms ;
2015-01-12 12:28:13 +00:00
extern pbool autoprototype , autoprototyped , parseonly ;
2010-12-22 01:05:33 +00:00
extern pbool pr_subscopedlocals ;
2015-08-02 11:36:46 +00:00
extern pbool flag_nullemptystr , flag_ifstring , flag_brokenifstring , flag_iffloat , flag_ifvector , flag_vectorlogic ;
2005-02-09 19:32:30 +00:00
extern pbool flag_acc ;
2014-03-30 08:55:06 +00:00
extern pbool flag_caseinsensitive ;
2005-02-09 19:32:30 +00:00
extern pbool flag_laxcasts ;
2005-09-05 23:50:46 +00:00
extern pbool flag_hashonly ;
2005-09-14 04:36:07 +00:00
extern pbool flag_fasttrackarrays ;
2009-08-29 14:56:42 +00:00
extern pbool flag_assume_integer ;
2009-11-04 21:16:50 +00:00
extern pbool flag_msvcstyle ;
2013-09-26 14:36:52 +00:00
extern pbool flag_debugmacros ;
2010-07-18 10:01:57 +00:00
extern pbool flag_filetimes ;
2012-01-17 07:57:46 +00:00
extern pbool flag_typeexplicit ;
2017-11-04 04:01:33 +00:00
extern pbool flag_boundchecks ;
2015-07-28 03:13:00 +00:00
extern pbool flag_brokenarrays ;
2015-09-10 10:16:26 +00:00
extern pbool flag_rootconstructor ;
2015-02-02 08:01:53 +00:00
extern pbool flag_guiannotate ;
2016-07-12 00:40:13 +00:00
extern pbool flag_qccx ;
2017-08-14 16:38:44 +00:00
extern pbool flag_attributes ;
extern pbool flag_assumevar ;
extern pbool flag_dblstarexp ;
2017-10-31 22:52:58 +00:00
extern pbool flag_allowuninit ;
extern pbool flag_cpriority ;
2016-09-01 14:31:24 +00:00
extern pbool flag_embedsrc ;
2017-10-31 22:52:58 +00:00
extern pbool flag_nopragmafileline ;
2018-09-29 03:40:50 +00:00
extern pbool flag_utf8strings ;
2004-08-23 01:38:21 +00:00
extern pbool opt_overlaptemps ;
extern pbool opt_shortenifnots ;
extern pbool opt_noduplicatestrings ;
extern pbool opt_constantarithmatic ;
extern pbool opt_nonvec_parms ;
extern pbool opt_constant_names ;
extern pbool opt_precache_file ;
extern pbool opt_filenames ;
extern pbool opt_assignments ;
extern pbool opt_unreferenced ;
extern pbool opt_function_names ;
extern pbool opt_locals ;
extern pbool opt_dupconstdefs ;
extern pbool opt_constant_names_strings ;
extern pbool opt_return_only ;
extern pbool opt_compound_jumps ;
//extern pbool opt_comexprremoval;
extern pbool opt_stripfunctions ;
2013-03-12 22:32:25 +00:00
extern pbool opt_locals_overlapping ;
2004-08-23 01:38:21 +00:00
extern pbool opt_logicops ;
2005-02-28 07:16:19 +00:00
extern pbool opt_vectorcalls ;
2014-05-30 03:57:30 +00:00
extern pbool opt_classfields ;
2004-08-23 01:38:21 +00:00
extern int optres_shortenifnots ;
extern int optres_overlaptemps ;
extern int optres_noduplicatestrings ;
extern int optres_constantarithmatic ;
extern int optres_nonvec_parms ;
extern int optres_constant_names ;
extern int optres_precache_file ;
extern int optres_filenames ;
extern int optres_assignments ;
extern int optres_unreferenced ;
extern int optres_function_names ;
extern int optres_locals ;
extern int optres_dupconstdefs ;
extern int optres_constant_names_strings ;
extern int optres_return_only ;
extern int optres_compound_jumps ;
//extern int optres_comexprremoval;
extern int optres_stripfunctions ;
2013-03-12 22:32:25 +00:00
extern int optres_locals_overlapping ;
2004-08-23 01:38:21 +00:00
extern int optres_logicops ;
2015-01-21 18:18:37 +00:00
extern int optres_inlines ;
2004-08-23 01:38:21 +00:00
2019-01-20 01:00:18 +00:00
pbool CompileParams ( progfuncs_t * progfuncs , void ( * cb ) ( void ) , int nump , const char * * parms ) ;
2004-08-23 01:38:21 +00:00
2014-04-12 03:31:59 +00:00
void QCC_PR_PrintStatement ( QCC_statement_t * s ) ;
2004-08-23 01:38:21 +00:00
void QCC_PR_Lex ( void ) ;
// reads the next token into pr_token and classifies its type
2018-07-14 18:50:20 +00:00
QCC_type_t * QCC_PR_NewType ( const char * name , int basictype , pbool typedefed ) ; //note: name must be hunk/immediate
2011-11-08 06:00:35 +00:00
QCC_type_t * QCC_PointerTypeTo ( QCC_type_t * type ) ;
2011-09-03 03:49:43 +00:00
QCC_type_t * QCC_PR_ParseType ( int newtype , pbool silentfail ) ;
2017-02-19 00:15:42 +00:00
QCC_sref_t QCC_PR_ParseDefaultInitialiser ( QCC_type_t * type ) ;
2011-09-03 03:49:43 +00:00
extern pbool type_inlinefunction ;
2018-07-14 18:50:20 +00:00
QCC_type_t * QCC_TypeForName ( const char * name ) ;
2004-08-23 01:38:21 +00:00
QCC_type_t * QCC_PR_ParseFunctionType ( int newtype , QCC_type_t * returntype ) ;
2005-02-09 19:32:30 +00:00
QCC_type_t * QCC_PR_ParseFunctionTypeReacc ( int newtype , QCC_type_t * returntype ) ;
2017-10-12 12:02:25 +00:00
QCC_type_t * QCC_PR_GenFunctionType ( QCC_type_t * rettype , struct QCC_typeparam_s * args , int numargs ) ;
2004-08-23 01:38:21 +00:00
char * QCC_PR_ParseName ( void ) ;
2018-10-11 10:31:23 +00:00
struct QCC_typeparam_s * QCC_PR_FindStructMember ( QCC_type_t * t , const char * membername , unsigned int * out_ofs ) ;
2018-10-23 07:09:06 +00:00
QCC_type_t * QCC_PR_PointerType ( QCC_type_t * pointsto ) ;
2004-08-23 01:38:21 +00:00
2017-02-19 00:15:42 +00:00
const char * QCC_VarAtOffset ( QCC_sref_t ref ) ;
2017-10-31 22:52:58 +00:00
void QCC_PrioritiseOpcodes ( void ) ;
2011-09-03 03:49:43 +00:00
int QCC_PR_IntConstExpr ( void ) ;
2004-08-23 01:38:21 +00:00
# ifndef COMMONINLINES
2015-04-14 12:24:05 +00:00
pbool QCC_PR_CheckImmediate ( const char * string ) ;
pbool QCC_PR_CheckToken ( const char * string ) ;
2017-01-13 00:39:50 +00:00
pbool QCC_PR_PeekToken ( const char * string ) ;
2015-04-14 12:24:05 +00:00
pbool QCC_PR_CheckName ( const char * string ) ;
void QCC_PR_Expect ( const char * string ) ;
pbool QCC_PR_CheckKeyword ( int keywordenabled , const char * string ) ;
2004-08-23 01:38:21 +00:00
# endif
2015-04-14 12:24:05 +00:00
pbool QCC_PR_CheckTokenComment ( const char * string , char * * comment ) ;
void VARGS QCC_PR_ParseError ( int errortype , const char * error , . . . ) ;
pbool VARGS QCC_PR_ParseWarning ( int warningtype , const char * error , . . . ) ;
pbool VARGS QCC_PR_Warning ( int type , const char * file , int line , const char * error , . . . ) ;
void VARGS QCC_PR_Note ( int type , const char * file , int line , const char * error , . . . ) ;
2004-08-23 01:38:21 +00:00
void QCC_PR_ParsePrintDef ( int warningtype , QCC_def_t * def ) ;
2015-04-14 12:24:05 +00:00
void QCC_PR_ParsePrintSRef ( int warningtype , QCC_sref_t sref ) ;
void VARGS QCC_PR_ParseErrorPrintDef ( int errortype , QCC_def_t * def , const char * error , . . . ) ;
void VARGS QCC_PR_ParseErrorPrintSRef ( int errortype , QCC_sref_t sref , const char * error , . . . ) ;
2004-08-23 01:38:21 +00:00
2018-10-23 07:09:06 +00:00
QCC_type_t * QCC_PR_MakeThiscall ( QCC_type_t * orig , QCC_type_t * thistype ) ;
2015-04-14 12:24:05 +00:00
int QCC_WarningForName ( const char * 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
char * QCC_NameForWarning ( int idx ) ;
2004-11-19 14:20:52 +00:00
2004-08-23 01:38:21 +00:00
//QccMain.c must be changed if this is changed.
enum {
WARN_DEBUGGING ,
WARN_ERROR ,
2017-10-31 22:52:58 +00:00
WARN_DEPRECATEDWARNING , //to silence warnings about old warnings.
2017-02-19 00:15:42 +00:00
WARN_WRITTENNOTREAD ,
WARN_READNOTWRITTEN ,
2004-08-23 01:38:21 +00:00
WARN_NOTREFERENCED ,
WARN_NOTREFERENCEDCONST ,
2017-11-14 14:37:04 +00:00
WARN_NOTREFERENCEDFIELD ,
2004-08-23 01:38:21 +00:00
WARN_CONFLICTINGRETURNS ,
WARN_TOOFEWPARAMS ,
WARN_TOOMANYPARAMS ,
WARN_UNEXPECTEDPUNCT ,
2013-03-12 22:32:25 +00:00
WARN_UNINITIALIZED ,
2016-07-12 00:40:13 +00:00
WARN_DENORMAL ,
2018-01-22 19:18:04 +00:00
WARN_STRINGOFFSET , //works for static/memalloc strings, but fundamentally unsafe on tempstrings/etc, and varies between engine
2016-07-12 00:40:13 +00:00
WARN_OVERFLOW , //compile time overflow or inprecision.
2004-08-23 01:38:21 +00:00
WARN_ASSIGNMENTTOCONSTANT ,
2005-09-28 16:57:10 +00:00
WARN_ASSIGNMENTTOCONSTANTFUNC ,
2004-08-23 01:38:21 +00:00
WARN_MISSINGRETURNVALUE ,
WARN_WRONGRETURNTYPE ,
2008-11-09 22:29:28 +00:00
WARN_CORRECTEDRETURNTYPE ,
2004-08-23 01:38:21 +00:00
WARN_POINTLESSSTATEMENT ,
WARN_MISSINGRETURN ,
WARN_DUPLICATEDEFINITION ,
2005-09-28 16:57:10 +00:00
WARN_UNDEFNOTDEFINED ,
2004-08-23 01:38:21 +00:00
WARN_PRECOMPILERMESSAGE ,
2004-09-21 03:22:55 +00:00
WARN_TOOMANYPARAMETERSFORFUNC ,
2013-12-29 22:48:28 +00:00
WARN_TOOMANYPARAMETERSVARARGS ,
2018-08-18 13:33:50 +00:00
WARN_NESTEDCOMMENT ,
2004-08-23 01:38:21 +00:00
WARN_STRINGTOOLONG ,
WARN_BADTARGET ,
WARN_BADPRAGMA ,
2013-03-12 22:32:25 +00:00
WARN_NOTUTF8 ,
2004-08-23 01:38:21 +00:00
WARN_HANGINGSLASHR ,
WARN_NOTDEFINED ,
2004-11-06 14:47:24 +00:00
WARN_NOTCONSTANT ,
2004-08-23 01:38:21 +00:00
WARN_SWITCHTYPEMISMATCH ,
WARN_CONFLICTINGUNIONMEMBER ,
WARN_KEYWORDDISABLED ,
WARN_ENUMFLAGS_NOTINTEGER ,
WARN_ENUMFLAGS_NOTBINARY ,
2014-03-30 08:55:06 +00:00
WARN_CASEINSENSITIVEFRAMEMACRO ,
2017-02-01 04:42:33 +00:00
WARN_STALEMACRO ,
2004-11-15 13:02:31 +00:00
WARN_DUPLICATEMACRO ,
2017-02-01 04:42:33 +00:00
WARN_DUPLICATELABEL ,
2004-08-23 01:38:21 +00:00
WARN_ASSIGNMENTINCONDITIONAL ,
WARN_MACROINSTRING ,
WARN_BADPARAMS ,
WARN_IMPLICITCONVERSION ,
WARN_EXTRAPRECACHE ,
WARN_NOTPRECACHED ,
2018-04-15 02:48:23 +00:00
WARN_NONPORTABLEFILENAME ,
2004-08-23 01:38:21 +00:00
WARN_DEADCODE ,
2004-10-26 16:31:03 +00:00
WARN_UNREACHABLECODE ,
2004-09-07 18:26:31 +00:00
WARN_NOTSTANDARDBEHAVIOUR ,
2004-09-13 03:13:52 +00:00
WARN_DUPLICATEPRECOMPILER ,
2005-09-28 16:57:10 +00:00
WARN_IDENTICALPRECOMPILER ,
2018-06-06 08:27:53 +00:00
WARN_FORMATSTRING , //sprintf
2018-07-14 18:50:20 +00:00
WARN_DEPRECACTEDSYNTAX , //triggered when syntax is used that I'm trying to kill
2017-10-12 12:02:25 +00:00
WARN_GMQCC_SPECIFIC , //extension created by gmqcc that conflicts or isn't properly implemented.
2004-09-07 18:26:31 +00:00
WARN_FTE_SPECIFIC , //extension that only FTEQCC will have a clue about.
WARN_EXTENSION_USED , //extension that frikqcc also understands
2004-11-13 17:18:34 +00:00
WARN_IFSTRING_USED ,
2017-03-04 19:36:06 +00:00
WARN_IFVECTOR_DISABLED , //if(vector) does if(vector_x) if ifvector is disabled
2005-02-09 19:32:30 +00:00
WARN_LAXCAST , //some errors become this with a compiler flag
2015-02-02 08:01:53 +00:00
WARN_TYPEMISMATCHREDECOPTIONAL ,
2005-03-20 02:57:11 +00:00
WARN_UNDESIRABLECONVENTION ,
2005-09-28 16:57:10 +00:00
WARN_SAMENAMEASGLOBAL ,
WARN_CONSTANTCOMPARISON ,
2007-04-15 17:35:58 +00:00
WARN_UNSAFEFUNCTIONRETURNTYPE ,
2011-11-08 06:00:35 +00:00
WARN_MISSINGOPTIONAL ,
2017-05-22 05:12:01 +00:00
WARN_SYSTEMCRC , //unknown system crc
WARN_SYSTEMCRC2 , //legacy/dp system crc
2013-03-12 22:35:33 +00:00
WARN_CONDITIONALTYPEMISMATCH ,
2013-08-21 06:55:54 +00:00
WARN_MISSINGMEMBERQUALIFIER , //virtual/static/nonvirtual qualifier is missing
2013-07-29 17:34:19 +00:00
WARN_SELFNOTTHIS , //warned for because 'self' does not have the right type. we convert such references to 'this' instead, which is more usable.
WARN_EVILPREPROCESSOR , //exploited by nexuiz, and generally unsafe.
WARN_UNARYNOTSCOPE , //!foo & bar the ! applies to the result of &. This is unlike C.
WARN_STRICTTYPEMISMATCH , //self.think = T_Damage; both are functions, but the arguments/return types/etc differ.
2014-09-05 19:17:57 +00:00
WARN_MISUSEDAUTOCVAR , //various issues with autocvar definitions.
2015-04-14 12:24:05 +00:00
WARN_IGNORECOMMANDLINE ,
2016-07-12 00:40:13 +00:00
WARN_POINTERASSIGNMENT , //&somefloat = 5; disabled for qccx compat sanity.
2015-07-03 22:00:45 +00:00
WARN_COMPATIBILITYHACK , //work around old defs.qc or invalid dpextensions.qc
2016-07-12 00:40:13 +00:00
WARN_REDECLARATIONMISMATCH ,
2017-08-14 16:38:44 +00:00
WARN_PARAMWITHNONAME ,
2018-11-19 06:37:25 +00:00
WARN_ARGUMENTCHECK ,
2004-08-23 01:38:21 +00:00
2004-09-07 18:26:31 +00:00
ERR_PARSEERRORS , //caused by qcc_pr_parseerror being called.
2004-08-23 01:38:21 +00:00
//these are definatly my fault...
ERR_INTERNAL ,
ERR_TOOCOMPLEX ,
ERR_BADOPCODE ,
ERR_TOOMANYSTATEMENTS ,
ERR_TOOMANYSTRINGS ,
ERR_BADTARGETSWITCH ,
ERR_TOOMANYTYPES ,
ERR_TOOMANYPAKFILES ,
ERR_PRECOMPILERCONSTANTTOOLONG ,
ERR_MACROTOOMANYPARMS ,
ERR_TOOMANYFRAMEMACROS ,
//limitations, some are imposed by compiler, some arn't.
ERR_TOOMANYGLOBALS ,
ERR_TOOMANYGOTOS ,
ERR_TOOMANYBREAKS ,
ERR_TOOMANYCONTINUES ,
ERR_TOOMANYCASES ,
ERR_TOOMANYLABELS ,
ERR_TOOMANYOPENFILES ,
ERR_TOOMANYTOTALPARAMETERS ,
//these are probably yours, or qcc being fussy.
ERR_BADEXTENSION ,
ERR_BADIMMEDIATETYPE ,
ERR_NOOUTPUT ,
ERR_NOTAFUNCTION ,
2004-11-04 04:19:10 +00:00
ERR_FUNCTIONWITHVARGS ,
2004-08-23 01:38:21 +00:00
ERR_BADHEX ,
ERR_UNKNOWNPUCTUATION ,
ERR_EXPECTED ,
ERR_NOTANAME ,
ERR_NAMETOOLONG ,
ERR_NOFUNC ,
ERR_COULDNTOPENFILE ,
ERR_NOTFUNCTIONTYPE ,
ERR_TOOFEWPARAMS ,
ERR_TOOMANYPARAMS ,
ERR_CONSTANTNOTDEFINED ,
ERR_BADFRAMEMACRO ,
ERR_TYPEMISMATCH ,
ERR_TYPEMISMATCHREDEC ,
ERR_TYPEMISMATCHPARM ,
ERR_TYPEMISMATCHARRAYSIZE ,
ERR_UNEXPECTEDPUNCTUATION ,
ERR_NOTACONSTANT ,
ERR_REDECLARATION ,
ERR_INITIALISEDLOCALFUNCTION ,
ERR_NOTDEFINED ,
ERR_ARRAYNEEDSSIZE ,
ERR_ARRAYNEEDSBRACES ,
ERR_TOOMANYINITIALISERS ,
ERR_TYPEINVALIDINSTRUCT ,
ERR_NOSHAREDLOCALS ,
ERR_TYPEWITHNONAME ,
ERR_BADARRAYSIZE ,
ERR_NONAME ,
ERR_SHAREDINITIALISED ,
ERR_UNKNOWNVALUE ,
ERR_BADARRAYINDEXTYPE ,
ERR_NOVALIDOPCODES ,
ERR_MEMBERNOTVALID ,
ERR_BADPLUSPLUSOPERATOR ,
ERR_BADNOTTYPE ,
ERR_BADTYPECAST ,
ERR_MULTIPLEDEFAULTS ,
ERR_CASENOTIMMEDIATE ,
ERR_BADSWITCHTYPE ,
ERR_BADLABELNAME ,
ERR_NOLABEL ,
ERR_THINKTIMETYPEMISMATCH ,
ERR_STATETYPEMISMATCH ,
ERR_BADBUILTINIMMEDIATE ,
ERR_BADPARAMORDER ,
ERR_ILLEGALCONTINUES ,
ERR_ILLEGALBREAKS ,
ERR_ILLEGALCASES ,
ERR_NOTANUMBER ,
ERR_WRONGSUBTYPE ,
ERR_EOF ,
ERR_NOPRECOMPILERIF ,
2004-11-04 04:19:10 +00:00
ERR_NOENDIF ,
2004-08-23 01:38:21 +00:00
ERR_HASHERROR ,
ERR_NOTATYPE ,
ERR_TOOMANYPACKFILES ,
ERR_INVALIDVECTORIMMEDIATE ,
ERR_INVALIDSTRINGIMMEDIATE ,
2008-01-28 13:28:35 +00:00
ERR_BADCHARACTERCODE ,
2004-08-23 01:38:21 +00:00
ERR_BADPARMS ,
2009-08-29 13:39:57 +00:00
ERR_WERROR ,
2004-08-23 01:38:21 +00:00
WARN_MAX
} ;
2018-09-29 03:40:50 +00:00
//ansi colour codes, for debugging stuff.
enum
{
COL_NONE , //white/regular text.
COL_ERROR , //to highlight errors
COL_WARNING , //to highlight warnings
COL_LOCATION , //to highlight file:line locations
COL_NAME , //unknown symbols.
COL_SYMBOL , //known symbols
COL_MAX
} ;
extern const char * qcccol [ COL_MAX ] ;
# define col_none qcccol[COL_NONE]
# define col_location qcccol[COL_LOCATION]
# define col_error qcccol[COL_ERROR]
# define col_name qcccol[COL_NAME]
# define col_warning qcccol[COL_WARNING]
# define col_symbol qcccol[COL_SYMBOL]
2005-02-28 07:16:19 +00:00
# define FLAG_KILLSDEBUGGERS 1
# define FLAG_ASDEFAULT 2
# define FLAG_SETINGUI 4
# define FLAG_HIDDENINGUI 8
2005-04-16 16:21:27 +00:00
# define FLAG_MIDCOMPILE 16 //option can be changed mid-compile with the special pragma
2004-08-23 01:38:21 +00:00
typedef struct {
pbool * enabled ;
char * abbrev ;
int optimisationlevel ;
int flags ; //1: kills debuggers. 2: applied as default.
char * fullname ;
2005-02-28 07:16:19 +00:00
char * description ;
2004-08-23 01:38:21 +00:00
void * guiinfo ;
} optimisations_t ;
extern optimisations_t optimisations [ ] ;
2005-02-28 07:16:19 +00:00
typedef struct {
pbool * enabled ;
int flags ; //2 applied as default
char * abbrev ;
char * fullname ;
char * description ;
void * guiinfo ;
} compiler_flag_t ;
extern compiler_flag_t compiler_flag [ ] ;
------------------------------------------------------------------------
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 WA_IGNORE 0
# define WA_WARN 1
# define WA_ERROR 2
extern unsigned char qccwarningaction [ WARN_MAX ] ;
2004-08-23 01:38:21 +00:00
extern jmp_buf pr_parse_abort ; // longjump with this on parse error
2016-09-08 19:04:35 +00:00
extern const char * s_filen ; //name of the file we're currently compiling.
extern QCC_string_t s_filed ; //name of the file we're currently compiling, as seen by whoever reads the .dat
2004-08-23 01:38:21 +00:00
extern int pr_source_line ;
extern char * pr_file_p ;
void * QCC_PR_Malloc ( int size ) ;
# define OFS_NULL 0
# define OFS_RETURN 1
# define OFS_PARM0 4 // leave 3 ofs for each parm to hold vectors
# define OFS_PARM1 7
# define OFS_PARM2 10
# define OFS_PARM3 13
# define OFS_PARM4 16
# define RESERVED_OFS 28
2015-04-14 12:24:05 +00:00
extern struct QCC_function_s * pr_scope ;
2005-12-16 17:15:43 +00:00
extern int pr_error_count , pr_warning_count ;
2004-08-23 01:38:21 +00:00
void QCC_PR_NewLine ( pbool incomment ) ;
2013-03-12 22:32:25 +00:00
# define GDF_NONE 0
2016-09-08 19:04:35 +00:00
# define GDF_SAVED 1
# define GDF_STATIC 2
# define GDF_CONST 4
# define GDF_STRIP 8 //always stripped, regardless of optimisations. used for class member fields
# define GDF_SILENT 16 //used by the gui, to suppress ALL warnings associated with querying the def.
# define GDF_INLINE 32 //attempt to inline calls to this function
# define GDF_USED 64 //don't strip this, ever.
# define GDF_BASICTYPE 128 //don't care about #merge types not being known correctly.
2017-10-12 12:02:25 +00:00
# define GDF_SCANLOCAL 256 //don't use the locals hash table
2018-07-18 13:02:03 +00:00
# define GDF_POSTINIT 512 //field must be initialised at the end of the compile (allows arrays to be extended later)
2017-10-12 12:02:25 +00:00
QCC_def_t * QCC_PR_GetDef ( QCC_type_t * type , const char * name , struct QCC_function_s * scope , pbool allocate , int arraysize , unsigned int flags ) ;
QCC_sref_t QCC_PR_GetSRef ( QCC_type_t * type , const char * name , struct QCC_function_s * scope , pbool allocate , int arraysize , unsigned int flags ) ;
2015-04-14 12:24:05 +00:00
void QCC_FreeTemp ( QCC_sref_t t ) ;
2016-09-08 19:04:35 +00:00
void QCC_FreeDef ( QCC_def_t * def ) ;
2013-09-26 14:36:52 +00:00
char * QCC_PR_CheckCompConstTooltip ( char * word , char * outstart , char * outend ) ;
2004-08-23 01:38:21 +00:00
void QCC_PR_PrintDefs ( void ) ;
void QCC_PR_SkipToSemicolon ( void ) ;
2013-12-29 22:48:28 +00:00
extern char * pr_parm_argcount_name ;
2004-08-23 01:38:21 +00:00
# define MAX_EXTRA_PARMS 128
# ifdef MAX_EXTRA_PARMS
extern char pr_parm_names [ MAX_PARMS + MAX_EXTRA_PARMS ] [ MAX_NAME ] ;
2015-04-14 12:24:05 +00:00
extern QCC_sref_t extra_parms [ MAX_EXTRA_PARMS ] ;
2004-08-23 01:38:21 +00:00
# else
extern char pr_parm_names [ MAX_PARMS ] [ MAX_NAME ] ;
# endif
char * QCC_PR_ValueString ( etype_t type , void * val ) ;
------------------------------------------------------------------------
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
void QCC_PR_ClearGrabMacros ( pbool newfile ) ;
2004-08-23 01:38:21 +00:00
2016-09-08 19:14:29 +00:00
void QCC_ImportProgs ( const char * filename ) ;
2004-08-23 01:38:21 +00:00
pbool QCC_PR_CompileFile ( char * string , char * filename ) ;
2006-01-28 02:35:40 +00:00
void QCC_PR_ResetErrorScope ( void ) ;
2004-08-23 01:38:21 +00:00
extern pbool pr_dumpasm ;
extern QCC_def_t def_ret , def_parms [ MAX_PARMS ] ;
2015-04-14 12:24:05 +00:00
void QCC_PR_EmitArrayGetFunction ( QCC_def_t * defscope , QCC_def_t * thearray , char * arrayname ) ;
void QCC_PR_EmitArraySetFunction ( QCC_def_t * defscope , QCC_def_t * thearray , char * arrayname ) ;
void QCC_PR_EmitClassFromFunction ( QCC_def_t * defscope , QCC_type_t * basetype ) ;
2004-08-23 01:38:21 +00:00
2017-11-16 22:20:40 +00:00
void QCC_PR_ParseDefs ( char * classname , pbool fatal ) ;
2017-10-12 12:02:25 +00:00
QCC_def_t * QCC_PR_DummyDef ( QCC_type_t * type , const char * name , QCC_function_t * scope , int arraysize , QCC_def_t * rootsymbol , unsigned int ofs , int referable , unsigned int flags ) ;
2016-10-22 07:06:51 +00:00
void QCC_PR_ParseInitializerDef ( QCC_def_t * def , unsigned int flags ) ;
2017-10-12 12:02:25 +00:00
void QCC_PR_FinaliseFunctions ( void ) ;
2016-10-22 07:06:51 +00:00
2019-01-20 01:00:18 +00:00
pbool QCC_main ( int argc , const char * * argv ) ; //as part of the quake engine
2018-10-11 10:31:23 +00:00
void QCC_ContinueCompile ( void ) ;
2010-08-15 15:02:30 +00:00
void PostCompile ( void ) ;
pbool PreCompile ( void ) ;
2013-08-27 13:18:09 +00:00
void QCC_Cleanup ( void ) ;
2010-08-15 15:02:30 +00:00
2013-03-12 22:32:25 +00:00
2015-04-14 12:24:05 +00:00
# define FIRST_LOCAL 0 //(MAX_REGS)
2004-08-23 01:38:21 +00:00
//=============================================================================
extern char pr_immediate_string [ 8192 ] ;
2016-07-12 00:40:13 +00:00
extern size_t pr_immediate_strlen ;
2004-08-23 01:38:21 +00:00
2015-04-14 12:24:05 +00:00
extern QCC_eval_t * qcc_pr_globals ;
2004-08-23 01:38:21 +00:00
extern unsigned int numpr_globals ;
extern char * strings ;
extern int strofs ;
2014-04-12 03:31:59 +00:00
extern QCC_statement_t * statements ;
2004-08-23 01:38:21 +00:00
extern int numstatements ;
2015-04-14 12:24:05 +00:00
extern QCC_function_t * functions ;
extern dfunction_t * dfunctions ;
2004-08-23 01:38:21 +00:00
extern int numfunctions ;
extern QCC_ddef_t * qcc_globals ;
extern int numglobaldefs ;
extern QCC_def_t * activetemps ;
extern QCC_ddef_t * fields ;
extern int numfielddefs ;
extern QCC_type_t * qcc_typeinfo ;
extern int numtypeinfos ;
extern int maxtypeinfos ;
2009-03-29 23:47:29 +00:00
extern int ForcedCRC ;
2010-05-01 22:47:47 +00:00
extern pbool defaultnoref ;
2016-01-18 05:22:07 +00:00
extern pbool defaultnosave ;
2009-03-29 23:47:29 +00:00
extern pbool defaultstatic ;
2004-08-23 01:38:21 +00:00
extern int * qcc_tempofs ;
extern int max_temps ;
//extern int qcc_functioncalled; //unuse temps if this is true - don't want to reuse the same space.
extern int tempsstart ;
extern int numtemps ;
2015-02-07 18:07:30 +00:00
extern char compilingrootfile [ ] ; //.src file currently being compiled
2004-08-23 01:38:21 +00:00
typedef char PATHSTRING [ MAX_DATA_PATH ] ;
2013-03-12 22:35:33 +00:00
typedef struct
{
PATHSTRING name ;
int block ;
int used ;
int fileline ;
2016-09-08 19:04:35 +00:00
const char * filename ;
2013-03-12 22:35:33 +00:00
} precache_t ;
extern precache_t * precache_sound ;
2012-01-01 17:34:32 +00:00
extern int numsounds ;
2013-03-12 22:35:33 +00:00
extern precache_t * precache_texture ;
2012-01-01 17:34:32 +00:00
extern int numtextures ;
2013-03-12 22:35:33 +00:00
extern precache_t * precache_model ;
2012-01-01 17:34:32 +00:00
extern int nummodels ;
2013-03-12 22:35:33 +00:00
extern precache_t * precache_file ;
2012-01-01 17:34:32 +00:00
extern int numfiles ;
typedef struct qcc_includechunk_s {
2017-08-14 16:38:44 +00:00
struct qcc_includechunk_s * prev ; //chunk it was expanded/included from
const char * currentfilename ; //filename it was expended from
int currentlinenumber ; //line it was expanded from
2012-01-01 17:34:32 +00:00
char * currentdatapoint ;
2017-08-14 16:38:44 +00:00
CompilerConstant_t * cnst ; //define we're expanding from
char * datastart ; //the start of the expanded data
2012-01-01 17:34:32 +00:00
} qcc_includechunk_t ;
extern qcc_includechunk_t * currentchunk ;
2004-08-23 01:38:21 +00:00
2018-05-28 10:12:10 +00:00
int QCC_CopyString ( const char * str ) ;
int QCC_CopyStringLength ( const char * str , size_t length ) ;
2004-08-23 01:38:21 +00:00
typedef struct qcc_cachedsourcefile_s {
2016-09-01 14:31:24 +00:00
size_t size ;
2018-07-05 16:21:44 +00:00
size_t bufsize ;
2016-09-01 14:31:24 +00:00
size_t zhdrofs ;
int zcrc ;
2004-08-23 01:38:21 +00:00
char * file ;
enum { FT_CODE , FT_DATA } type ; //quakec source file or not.
struct qcc_cachedsourcefile_s * next ;
2018-07-05 16:21:44 +00:00
char filename [ 1 ] ;
2004-08-23 01:38:21 +00:00
} qcc_cachedsourcefile_t ;
extern qcc_cachedsourcefile_t * qcc_sourcefile ;
2016-11-20 20:52:41 +00:00
int WriteSourceFiles ( qcc_cachedsourcefile_t * filelist , int h , pbool sourceaswell , pbool legacyembed ) ;
2004-08-23 01:38:21 +00:00
2018-01-22 19:18:04 +00:00
struct pkgctx_s ;
2018-11-19 06:37:25 +00:00
struct pkgctx_s * Packager_Create ( void ( * messagecallback ) ( void * userctx , const char * message , . . . ) , void * userctx ) ;
2018-03-04 14:41:16 +00:00
void Packager_ParseFile ( struct pkgctx_s * ctx , char * scriptfilename ) ;
void Packager_ParseText ( struct pkgctx_s * ctx , char * scripttext ) ;
2018-01-22 19:18:04 +00:00
void Packager_WriteDataset ( struct pkgctx_s * ctx , char * setname ) ;
void Packager_Destroy ( struct pkgctx_s * ctx ) ;
2004-08-23 01:38:21 +00:00
# ifdef COMMONINLINES
2009-06-13 12:25:39 +00:00
static bool inline QCC_PR_CheckToken ( char * string )
2004-08-23 01:38:21 +00:00
{
2008-10-16 23:04:36 +00:00
if ( pr_token_type ! = tt_punct )
return false ;
2005-03-20 02:57:11 +00:00
if ( STRCMP ( string , pr_token ) )
2004-08-23 01:38:21 +00:00
return false ;
2005-02-09 19:32:30 +00:00
2004-08-23 01:38:21 +00:00
QCC_PR_Lex ( ) ;
return true ;
}
2017-01-13 00:39:50 +00:00
static bool inline QCC_PR_PeekToken ( char * string )
{
if ( pr_token_type ! = tt_punct )
return false ;
if ( STRCMP ( string , pr_token ) )
return false ;
return true ;
}
2004-08-23 01:38:21 +00:00
2016-09-08 19:04:35 +00:00
static void inline QCC_PR_Expect ( const char * string )
2004-08-23 01:38:21 +00:00
{
if ( strcmp ( string , pr_token ) )
QCC_PR_ParseError ( " expected %s, found %s " , string , pr_token ) ;
QCC_PR_Lex ( ) ;
}
# endif
2019-01-20 01:00:18 +00:00
CompilerConstant_t * QCC_PR_DefineName ( const char * name ) ;
2016-09-08 19:04:35 +00:00
void editbadfile ( const char * fname , int line ) ;
2013-03-12 23:22:05 +00:00
char * TypeName ( QCC_type_t * type , char * buffer , int buffersize ) ;
2016-02-15 06:01:17 +00:00
void QCC_PR_AddIncludePath ( const char * newinc ) ;
2004-08-23 01:38:21 +00:00
void QCC_PR_IncludeChunk ( char * data , pbool duplicate , char * filename ) ;
------------------------------------------------------------------------
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
void QCC_PR_CloseProcessor ( void ) ;
2016-09-08 19:04:35 +00:00
void QCC_FindBestInclude ( char * newfile , char * currentfile , pbool verbose ) ;
2005-03-10 03:55:18 +00:00
pbool QCC_PR_UnInclude ( void ) ;
2010-07-11 10:53:13 +00:00
extern void * ( * pHash_Get ) ( hashtable_t * table , const char * name ) ;
extern void * ( * pHash_GetNext ) ( hashtable_t * table , const char * name , void * old ) ;
extern void * ( * pHash_Add ) ( hashtable_t * table , const char * name , void * data , bucket_t * ) ;
2014-03-01 11:38:53 +00:00
extern void ( * pHash_RemoveData ) ( hashtable_t * table , const char * name , void * data ) ;
2017-06-21 01:24:25 +00:00
2018-07-05 16:21:44 +00:00
//when originally running from a .dat, we load up all the functions and work from those rather than actual files.
//(these get re-written into the resulting .dat)
typedef struct qcc_cachedsourcefile_s vfile_t ;
2019-01-20 01:00:18 +00:00
void QCC_CloseAllVFiles ( void ) ;
2017-06-21 01:24:25 +00:00
vfile_t * QCC_FindVFile ( const char * name ) ;
vfile_t * QCC_AddVFile ( const char * name , void * data , size_t size ) ;
void QCC_CatVFile ( vfile_t * , const char * fmt , . . . ) ;
void QCC_InsertVFile ( vfile_t * , size_t pos , const char * fmt , . . . ) ;
2019-01-20 01:00:18 +00:00
char * ReadProgsCopyright ( char * buf , size_t bufsize ) ;
2018-01-24 12:13:32 +00:00
2018-05-28 21:09:15 +00:00
//void *QCC_ReadFile(const char *fname, unsigned char *(*buf_get)(void *ctx, size_t len), void *buf_ctx, size_t *out_size, pbool issourcefile);
2018-07-05 16:21:44 +00:00
typedef struct
{
char name [ 56 ] ;
int filepos , filelen ;
} packfile_t ;
typedef struct
{
char id [ 4 ] ;
int dirofs ;
int dirlen ;
} packheader_t ;