2004-08-23 01:38:21 +00:00
|
|
|
// cmdlib.c
|
|
|
|
|
|
|
|
#include "qcc.h"
|
2004-09-20 23:25:38 +00:00
|
|
|
#include <ctype.h>
|
2004-08-23 01:38:21 +00:00
|
|
|
//#include <sys/time.h>
|
|
|
|
|
|
|
|
#define PATHSEPERATOR '/'
|
|
|
|
|
|
|
|
#ifndef QCC
|
|
|
|
extern jmp_buf qcccompileerror;
|
|
|
|
#endif
|
|
|
|
|
2012-01-04 16:51:50 +00:00
|
|
|
#ifdef _WIN64
|
|
|
|
#ifdef _SDL
|
|
|
|
#define snprintf linuxlike_snprintf
|
|
|
|
int VARGS linuxlike_snprintf(char *buffer, int size, const char *format, ...) LIKEPRINTF(3);
|
|
|
|
#define vsnprintf linuxlike_vsnprintf
|
|
|
|
int VARGS linuxlike_vsnprintf(char *buffer, int size, const char *format, va_list argptr);
|
|
|
|
void *__imp__vsnprintf = vsnprintf;
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
2004-08-23 01:38:21 +00:00
|
|
|
// set these before calling CheckParm
|
|
|
|
int myargc;
|
|
|
|
char **myargv;
|
|
|
|
|
|
|
|
char qcc_token[1024];
|
|
|
|
int qcc_eof;
|
|
|
|
|
2009-06-13 11:57:52 +00:00
|
|
|
const unsigned int type_size[12] = {1, //void
|
|
|
|
sizeof(string_t)/4, //string
|
|
|
|
1, //float
|
|
|
|
3, //vector
|
|
|
|
1, //entity
|
|
|
|
1, //field
|
|
|
|
sizeof(func_t)/4,//function
|
2009-08-29 14:56:42 +00:00
|
|
|
1, //pointer (its an int index)
|
2009-06-13 11:57:52 +00:00
|
|
|
1, //integer
|
2011-12-23 03:12:29 +00:00
|
|
|
3, //fixme: how big should a variant be?
|
2009-06-13 11:57:52 +00:00
|
|
|
0, //ev_struct. variable sized.
|
|
|
|
0 //ev_union. variable sized.
|
|
|
|
};
|
|
|
|
|
2005-05-22 13:42:10 +00:00
|
|
|
/*
|
|
|
|
============================================================================
|
|
|
|
|
|
|
|
BYTE ORDER FUNCTIONS
|
|
|
|
|
|
|
|
============================================================================
|
|
|
|
*/
|
|
|
|
short (*PRBigShort) (short l);
|
|
|
|
short (*PRLittleShort) (short l);
|
2006-11-10 15:48:18 +00:00
|
|
|
int (*PRBigLong) (int l);
|
|
|
|
int (*PRLittleLong) (int l);
|
2005-05-22 13:42:10 +00:00
|
|
|
float (*PRBigFloat) (float l);
|
|
|
|
float (*PRLittleFloat) (float l);
|
|
|
|
|
|
|
|
|
|
|
|
short QCC_SwapShort (short l)
|
|
|
|
{
|
|
|
|
qbyte b1,b2;
|
|
|
|
|
|
|
|
b1 = l&255;
|
|
|
|
b2 = (l>>8)&255;
|
|
|
|
|
|
|
|
return (b1<<8) + b2;
|
|
|
|
}
|
|
|
|
|
|
|
|
short QCC_Short (short l)
|
|
|
|
{
|
|
|
|
return l;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-11-10 15:48:18 +00:00
|
|
|
int QCC_SwapLong (int l)
|
2005-05-22 13:42:10 +00:00
|
|
|
{
|
|
|
|
qbyte b1,b2,b3,b4;
|
|
|
|
|
2006-04-16 03:55:55 +00:00
|
|
|
b1 = (qbyte)l;
|
|
|
|
b2 = (qbyte)(l>>8);
|
|
|
|
b3 = (qbyte)(l>>16);
|
|
|
|
b4 = (qbyte)(l>>24);
|
2005-05-22 13:42:10 +00:00
|
|
|
|
2006-11-10 15:48:18 +00:00
|
|
|
return ((int)b1<<24) + ((int)b2<<16) + ((int)b3<<8) + b4;
|
2005-05-22 13:42:10 +00:00
|
|
|
}
|
|
|
|
|
2006-11-10 15:48:18 +00:00
|
|
|
int QCC_Long (int l)
|
2005-05-22 13:42:10 +00:00
|
|
|
{
|
|
|
|
return l;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
float QCC_SwapFloat (float l)
|
|
|
|
{
|
|
|
|
union {qbyte b[4]; float f;} in, out;
|
2010-12-08 14:42:05 +00:00
|
|
|
|
2005-05-22 13:42:10 +00:00
|
|
|
in.f = l;
|
|
|
|
out.b[0] = in.b[3];
|
|
|
|
out.b[1] = in.b[2];
|
|
|
|
out.b[2] = in.b[1];
|
|
|
|
out.b[3] = in.b[0];
|
2010-12-08 14:42:05 +00:00
|
|
|
|
2005-05-22 13:42:10 +00:00
|
|
|
return out.f;
|
|
|
|
}
|
|
|
|
|
|
|
|
float QCC_Float (float l)
|
|
|
|
{
|
|
|
|
return l;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SetEndian(void)
|
|
|
|
{
|
|
|
|
union {qbyte b[2]; unsigned short s;} ed;
|
|
|
|
ed.s = 255;
|
|
|
|
if (ed.b[0] == 255)
|
|
|
|
{
|
|
|
|
PRBigShort = QCC_SwapShort;
|
|
|
|
PRLittleShort = QCC_Short;
|
|
|
|
PRBigLong = QCC_SwapLong;
|
|
|
|
PRLittleLong = QCC_Long;
|
|
|
|
PRBigFloat = QCC_SwapFloat;
|
|
|
|
PRLittleFloat = QCC_Float;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
PRBigShort = QCC_Short;
|
|
|
|
PRLittleShort = QCC_SwapShort;
|
|
|
|
PRBigLong = QCC_Long;
|
|
|
|
PRLittleLong = QCC_SwapLong;
|
|
|
|
PRBigFloat = QCC_Float;
|
|
|
|
PRLittleFloat = QCC_SwapFloat;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-04-02 05:18:17 +00:00
|
|
|
#if !defined(MINIMAL) && !defined(OMIT_QCC)
|
2004-08-23 01:38:21 +00:00
|
|
|
/*
|
|
|
|
================
|
|
|
|
I_FloatTime
|
|
|
|
================
|
|
|
|
*/
|
|
|
|
/*
|
|
|
|
double I_FloatTime (void)
|
|
|
|
{
|
|
|
|
struct timeval tp;
|
|
|
|
struct timezone tzp;
|
|
|
|
static int secbase;
|
|
|
|
|
|
|
|
gettimeofday(&tp, &tzp);
|
2010-12-08 14:42:05 +00:00
|
|
|
|
2004-08-23 01:38:21 +00:00
|
|
|
if (!secbase)
|
|
|
|
{
|
|
|
|
secbase = tp.tv_sec;
|
|
|
|
return tp.tv_usec/1000000.0;
|
|
|
|
}
|
2010-12-08 14:42:05 +00:00
|
|
|
|
2004-08-23 01:38:21 +00:00
|
|
|
return (tp.tv_sec - secbase) + tp.tv_usec/1000000.0;
|
|
|
|
}
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef QCC
|
|
|
|
int QC_strncasecmp (const char *s1, const char *s2, int n)
|
|
|
|
{
|
|
|
|
int c1, c2;
|
2010-12-08 14:42:05 +00:00
|
|
|
|
2004-08-23 01:38:21 +00:00
|
|
|
while (1)
|
|
|
|
{
|
|
|
|
c1 = *s1++;
|
|
|
|
c2 = *s2++;
|
|
|
|
|
|
|
|
if (!n--)
|
|
|
|
return 0; // strings are equal until end point
|
2010-12-08 14:42:05 +00:00
|
|
|
|
2004-08-23 01:38:21 +00:00
|
|
|
if (c1 != c2)
|
|
|
|
{
|
|
|
|
if (c1 >= 'a' && c1 <= 'z')
|
|
|
|
c1 -= ('a' - 'A');
|
|
|
|
if (c2 >= 'a' && c2 <= 'z')
|
|
|
|
c2 -= ('a' - 'A');
|
|
|
|
if (c1 != c2)
|
|
|
|
return -1; // strings not equal
|
|
|
|
}
|
|
|
|
if (!c1)
|
|
|
|
return 0; // strings are equal
|
|
|
|
// s1++;
|
|
|
|
// s2++;
|
|
|
|
}
|
2010-12-08 14:42:05 +00:00
|
|
|
|
2004-08-23 01:38:21 +00:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
int QC_strcasecmp (const char *s1, const char *s2)
|
|
|
|
{
|
|
|
|
return QC_strncasecmp(s1, s2, 0x7fffffff);
|
|
|
|
}
|
|
|
|
|
|
|
|
#else
|
|
|
|
int QC_strncasecmp(const char *s1, const char *s2, int n);
|
|
|
|
int QC_strcasecmp (const char *s1, const char *s2)
|
|
|
|
{
|
|
|
|
return QC_strncasecmp(s1, s2, 0x7fffffff);
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif //minimal
|
|
|
|
/*
|
|
|
|
==============
|
|
|
|
COM_Parse
|
|
|
|
|
|
|
|
Parse a token out of a string
|
|
|
|
==============
|
|
|
|
*/
|
|
|
|
char *QCC_COM_Parse (char *data)
|
|
|
|
{
|
|
|
|
int c;
|
|
|
|
int len;
|
2010-12-08 14:42:05 +00:00
|
|
|
|
2004-08-23 01:38:21 +00:00
|
|
|
len = 0;
|
|
|
|
qcc_token[0] = 0;
|
2010-12-08 14:42:05 +00:00
|
|
|
|
2004-08-23 01:38:21 +00:00
|
|
|
if (!data)
|
|
|
|
return NULL;
|
2010-12-08 14:42:05 +00:00
|
|
|
|
2004-08-23 01:38:21 +00:00
|
|
|
// skip whitespace
|
|
|
|
skipwhite:
|
------------------------------------------------------------------------
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
|
|
|
while ((c = *data) && qcc_iswhite(c))
|
2004-08-23 01:38:21 +00:00
|
|
|
data++;
|
------------------------------------------------------------------------
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 (!c)
|
|
|
|
{
|
|
|
|
qcc_eof = true;
|
|
|
|
return NULL;
|
2004-08-23 01:38:21 +00:00
|
|
|
}
|
2010-12-08 14:42:05 +00:00
|
|
|
|
2004-08-23 01:38:21 +00:00
|
|
|
// skip // comments
|
|
|
|
if (c=='/' && data[1] == '/')
|
|
|
|
{
|
|
|
|
while (*data && *data != '\n')
|
|
|
|
data++;
|
|
|
|
goto skipwhite;
|
|
|
|
}
|
2004-11-23 00:29:10 +00:00
|
|
|
|
|
|
|
// skip /* comments
|
|
|
|
if (c=='/' && data[1] == '*')
|
|
|
|
{
|
|
|
|
while (data[1] && (data[0] != '*' || data[1] != '/'))
|
|
|
|
data++;
|
|
|
|
data+=2;
|
|
|
|
goto skipwhite;
|
|
|
|
}
|
2010-12-08 14:42:05 +00:00
|
|
|
|
2004-08-23 01:38:21 +00:00
|
|
|
|
|
|
|
// handle quoted strings specially
|
|
|
|
if (c == '\"')
|
|
|
|
{
|
|
|
|
data++;
|
|
|
|
do
|
|
|
|
{
|
|
|
|
c = *data++;
|
2008-11-09 22:29:28 +00:00
|
|
|
if (c=='\\' && *data == '\"')
|
|
|
|
c = *data++; //allow C-style string escapes
|
|
|
|
else if (c=='\\' && *data == '\\')
|
|
|
|
c = *data++; // \ is now a special character so it needs to be marked up using itself
|
|
|
|
else if (c=='\\' && *data == 'n')
|
|
|
|
{ // and do new lines while we're at it.
|
|
|
|
c = '\n';
|
|
|
|
data++;
|
|
|
|
}
|
2009-10-06 00:17:04 +00:00
|
|
|
else if (c=='\"')
|
|
|
|
{
|
|
|
|
qcc_token[len] = 0;
|
|
|
|
return data;
|
|
|
|
}
|
|
|
|
else if (c=='\0'||c=='\n')
|
2004-08-23 01:38:21 +00:00
|
|
|
{
|
|
|
|
qcc_token[len] = 0;
|
|
|
|
return data;
|
|
|
|
}
|
------------------------------------------------------------------------
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 (len >= sizeof(qcc_token)-1)
|
|
|
|
;
|
|
|
|
else
|
|
|
|
qcc_token[len] = c;
|
2004-08-23 01:38:21 +00:00
|
|
|
len++;
|
|
|
|
} while (1);
|
|
|
|
}
|
|
|
|
|
|
|
|
// parse single characters
|
2004-10-26 14:38:19 +00:00
|
|
|
if (c=='{' || c=='}'|| c==')'|| c=='(' || c=='\'' || c==':' || c==',')
|
2004-08-23 01:38:21 +00:00
|
|
|
{
|
|
|
|
qcc_token[len] = c;
|
|
|
|
len++;
|
|
|
|
qcc_token[len] = 0;
|
|
|
|
return data+1;
|
|
|
|
}
|
|
|
|
|
|
|
|
// parse a regular word
|
|
|
|
do
|
|
|
|
{
|
------------------------------------------------------------------------
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 (len >= sizeof(qcc_token)-1)
|
|
|
|
;
|
|
|
|
else
|
2013-03-12 22:32:25 +00:00
|
|
|
qcc_token[len++] = c;
|
2004-08-23 01:38:21 +00:00
|
|
|
data++;
|
|
|
|
c = *data;
|
2008-11-09 22:29:28 +00:00
|
|
|
if (c=='{' || c=='}'|| c==')'|| c=='(' || c=='\'' || c==':' || c=='\"' || c==',')
|
2004-08-23 01:38:21 +00:00
|
|
|
break;
|
2013-03-12 22:32:25 +00:00
|
|
|
} while (c && !qcc_iswhite(c));
|
2010-12-08 14:42:05 +00:00
|
|
|
|
2004-08-23 01:38:21 +00:00
|
|
|
qcc_token[len] = 0;
|
|
|
|
return data;
|
|
|
|
}
|
|
|
|
|
2004-11-13 17:18:34 +00:00
|
|
|
//more C tokens...
|
|
|
|
char *QCC_COM_Parse2 (char *data)
|
|
|
|
{
|
|
|
|
int c;
|
|
|
|
int len;
|
2010-12-08 14:42:05 +00:00
|
|
|
|
2004-11-13 17:18:34 +00:00
|
|
|
len = 0;
|
|
|
|
qcc_token[0] = 0;
|
2010-12-08 14:42:05 +00:00
|
|
|
|
2004-11-13 17:18:34 +00:00
|
|
|
if (!data)
|
|
|
|
return NULL;
|
2010-12-08 14:42:05 +00:00
|
|
|
|
2004-11-13 17:18:34 +00:00
|
|
|
// skip whitespace
|
|
|
|
skipwhite:
|
------------------------------------------------------------------------
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
|
|
|
while ((c = *data) && qcc_iswhite(c))
|
2004-11-13 17:18:34 +00:00
|
|
|
data++;
|
------------------------------------------------------------------------
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 (!c)
|
|
|
|
{
|
|
|
|
qcc_eof = true;
|
|
|
|
return NULL;
|
2004-11-13 17:18:34 +00:00
|
|
|
}
|
2010-12-08 14:42:05 +00:00
|
|
|
|
2004-11-13 17:18:34 +00:00
|
|
|
// skip // comments
|
|
|
|
if (c=='/' && data[1] == '/')
|
|
|
|
{
|
|
|
|
while (*data && *data != '\n')
|
|
|
|
data++;
|
|
|
|
goto skipwhite;
|
|
|
|
}
|
2010-12-08 14:42:05 +00:00
|
|
|
|
2004-11-13 17:18:34 +00:00
|
|
|
|
|
|
|
// handle quoted strings specially
|
|
|
|
if (c == '\"')
|
|
|
|
{
|
|
|
|
data++;
|
|
|
|
do
|
|
|
|
{
|
|
|
|
c = *data++;
|
2008-11-09 22:29:28 +00:00
|
|
|
if (c=='\\' && *data == '\"')
|
|
|
|
c = *data++; //allow C-style string escapes
|
|
|
|
else if (c=='\\' && *data == '\\')
|
|
|
|
c = *data++; // \ is now a special character so it needs to be marked up using itself
|
|
|
|
else if (c=='\\' && *data == 'n')
|
|
|
|
{ // and do new lines while we're at it.
|
|
|
|
c = '\n';
|
|
|
|
data++;
|
2004-11-13 17:18:34 +00:00
|
|
|
}
|
2008-11-09 22:29:28 +00:00
|
|
|
else if (c=='\"'||c=='\0')
|
2013-03-12 22:47:42 +00:00
|
|
|
{
|
|
|
|
if (len < sizeof(qcc_token)-1)
|
|
|
|
qcc_token[len++] = 0;
|
|
|
|
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
|
|
|
if (len >= sizeof(qcc_token)-1)
|
|
|
|
;
|
|
|
|
else
|
2013-03-12 22:32:25 +00:00
|
|
|
qcc_token[len++] = c;
|
2004-11-13 17:18:34 +00:00
|
|
|
} while (1);
|
|
|
|
}
|
|
|
|
|
|
|
|
// parse numbers
|
|
|
|
if (c >= '0' && c <= '9')
|
|
|
|
{
|
|
|
|
if (c == '0' && data[1] == 'x')
|
|
|
|
{ //parse hex
|
|
|
|
qcc_token[0] = '0';
|
|
|
|
c='x';
|
|
|
|
len=1;
|
|
|
|
data++;
|
|
|
|
for(;;)
|
|
|
|
{ //parse regular number
|
2013-03-12 22:32:25 +00:00
|
|
|
if (len >= sizeof(qcc_token)-1)
|
|
|
|
;
|
|
|
|
else
|
|
|
|
qcc_token[len++] = c;
|
2004-11-13 17:18:34 +00:00
|
|
|
data++;
|
|
|
|
c = *data;
|
|
|
|
if ((c<'0'|| c>'9') && (c<'a'||c>'f') && (c<'A'||c>'F') && c != '.')
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
for(;;)
|
|
|
|
{ //parse regular number
|
------------------------------------------------------------------------
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 (len >= sizeof(qcc_token)-1)
|
|
|
|
;
|
|
|
|
else
|
2013-03-12 22:32:25 +00:00
|
|
|
qcc_token[len++] = c;
|
2004-11-13 17:18:34 +00:00
|
|
|
data++;
|
|
|
|
c = *data;
|
|
|
|
if ((c<'0'|| c>'9') && c != '.')
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2010-12-08 14:42:05 +00:00
|
|
|
|
2004-11-13 17:18:34 +00:00
|
|
|
qcc_token[len] = 0;
|
|
|
|
return data;
|
|
|
|
}
|
|
|
|
// parse words
|
|
|
|
else if ((c>= 'a' && c <= 'z') || (c>= 'A' && c <= 'Z') || c == '_')
|
|
|
|
{
|
|
|
|
do
|
|
|
|
{
|
------------------------------------------------------------------------
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 (len >= sizeof(qcc_token)-1)
|
|
|
|
;
|
|
|
|
else
|
2013-03-12 22:32:25 +00:00
|
|
|
qcc_token[len++] = c;
|
2004-11-13 17:18:34 +00:00
|
|
|
data++;
|
|
|
|
c = *data;
|
|
|
|
} while ((c>= 'a' && c <= 'z') || (c>= 'A' && c <= 'Z') || c == '_');
|
2010-12-08 14:42:05 +00:00
|
|
|
|
2004-11-13 17:18:34 +00:00
|
|
|
qcc_token[len] = 0;
|
|
|
|
return data;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
qcc_token[len] = c;
|
|
|
|
len++;
|
|
|
|
qcc_token[len] = 0;
|
|
|
|
return data+1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-08-23 01:38:21 +00:00
|
|
|
char *VARGS qcva (char *text, ...)
|
|
|
|
{
|
|
|
|
va_list argptr;
|
2010-12-08 14:42:05 +00:00
|
|
|
static char msg[2048];
|
2004-08-23 01:38:21 +00:00
|
|
|
|
|
|
|
va_start (argptr,text);
|
|
|
|
QC_vsnprintf (msg,sizeof(msg)-1, text,argptr);
|
|
|
|
va_end (argptr);
|
|
|
|
|
|
|
|
return msg;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-04-02 05:18:17 +00:00
|
|
|
#if !defined(MINIMAL) && !defined(OMIT_QCC)
|
2004-08-23 01:38:21 +00:00
|
|
|
|
|
|
|
char *QC_strupr (char *start)
|
|
|
|
{
|
|
|
|
char *in;
|
|
|
|
in = start;
|
|
|
|
while (*in)
|
|
|
|
{
|
|
|
|
*in = toupper(*in);
|
|
|
|
in++;
|
|
|
|
}
|
|
|
|
return start;
|
|
|
|
}
|
|
|
|
|
|
|
|
char *QC_strlower (char *start)
|
|
|
|
{
|
|
|
|
char *in;
|
|
|
|
in = start;
|
|
|
|
while (*in)
|
|
|
|
{
|
|
|
|
*in = tolower(*in);
|
|
|
|
in++;
|
|
|
|
}
|
|
|
|
return start;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
=============================================================================
|
|
|
|
|
|
|
|
MISC FUNCTIONS
|
|
|
|
|
|
|
|
=============================================================================
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
=================
|
|
|
|
Error
|
|
|
|
|
|
|
|
For abnormal program terminations
|
|
|
|
=================
|
|
|
|
*/
|
|
|
|
void VARGS QCC_Error (int errortype, const char *error, ...)
|
|
|
|
{
|
2008-11-09 22:29:28 +00:00
|
|
|
extern int numsourcefiles;
|
2004-08-23 01:38:21 +00:00
|
|
|
va_list argptr;
|
2010-12-08 14:42:05 +00:00
|
|
|
char msg[2048];
|
2004-08-23 01:38:21 +00:00
|
|
|
|
|
|
|
va_start (argptr,error);
|
|
|
|
QC_vsnprintf (msg,sizeof(msg)-1, error,argptr);
|
|
|
|
va_end (argptr);
|
|
|
|
|
|
|
|
printf ("\n************ ERROR ************\n%s\n", msg);
|
|
|
|
|
|
|
|
|
|
|
|
editbadfile(strings+s_file, pr_source_line);
|
|
|
|
|
2008-11-09 22:29:28 +00:00
|
|
|
numsourcefiles = 0;
|
|
|
|
|
2004-08-23 01:38:21 +00:00
|
|
|
#ifndef QCC
|
2010-12-08 14:42:05 +00:00
|
|
|
longjmp(qcccompileerror, 1);
|
2004-08-23 01:38:21 +00:00
|
|
|
#else
|
|
|
|
print ("Press any key\n");
|
|
|
|
getch();
|
|
|
|
#endif
|
|
|
|
exit (1);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
=================
|
|
|
|
CheckParm
|
|
|
|
|
|
|
|
Checks for the given parameter in the program's command line arguments
|
|
|
|
Returns the argument number (1 to argc-1) or 0 if not present
|
|
|
|
=================
|
|
|
|
*/
|
|
|
|
int QCC_CheckParm (char *check)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 1;i<myargc;i++)
|
|
|
|
{
|
|
|
|
if ( !QC_strcasecmp(check, myargv[i]) )
|
|
|
|
return i;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef O_BINARY
|
|
|
|
#define O_BINARY 0
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef QCC
|
|
|
|
int SafeOpenWrite (char *filename)
|
|
|
|
{
|
|
|
|
int handle;
|
|
|
|
|
|
|
|
umask (0);
|
2010-12-08 14:42:05 +00:00
|
|
|
|
2004-08-23 01:38:21 +00:00
|
|
|
handle = open(filename,O_WRONLY | O_CREAT | O_TRUNC | O_BINARY
|
|
|
|
, 0666);
|
|
|
|
|
|
|
|
if (handle == -1)
|
|
|
|
QCC_Error ("Error opening %s: %s",filename,strerror(errno));
|
|
|
|
|
|
|
|
return handle;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
int SafeOpenRead (char *filename)
|
|
|
|
{
|
|
|
|
int handle;
|
|
|
|
|
|
|
|
handle = open(filename,O_RDONLY | O_BINARY);
|
|
|
|
|
|
|
|
if (handle == -1)
|
|
|
|
QCC_Error ("Error opening %s: %s",filename,strerror(errno));
|
|
|
|
|
|
|
|
return handle;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void SafeRead (int handle, void *buffer, long count)
|
|
|
|
{
|
|
|
|
if (read (handle,buffer,count) != count)
|
|
|
|
QCC_Error ("File read failure");
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef QCC
|
|
|
|
void SafeWrite (int handle, void *buffer, long count)
|
|
|
|
{
|
|
|
|
if (write (handle,buffer,count) != count)
|
|
|
|
QCC_Error ("File write failure");
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
void *SafeMalloc (long size)
|
|
|
|
{
|
|
|
|
void *ptr;
|
|
|
|
|
|
|
|
ptr = (void *)Hunk_Alloc (size);
|
|
|
|
|
|
|
|
if (!ptr)
|
|
|
|
QCC_Error ("Malloc failure for %lu bytes",size);
|
|
|
|
|
|
|
|
return ptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void DefaultExtension (char *path, char *extension)
|
|
|
|
{
|
|
|
|
char *src;
|
|
|
|
//
|
|
|
|
// if path doesn't have a .EXT, append extension
|
|
|
|
// (extension should include the .)
|
|
|
|
//
|
|
|
|
src = path + strlen(path) - 1;
|
|
|
|
|
|
|
|
while (*src != PATHSEPERATOR && src != path)
|
|
|
|
{
|
|
|
|
if (*src == '.')
|
|
|
|
return; // it has an extension
|
|
|
|
src--;
|
|
|
|
}
|
|
|
|
|
|
|
|
strcat (path, extension);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void DefaultPath (char *path, char *basepath)
|
|
|
|
{
|
|
|
|
char temp[128];
|
|
|
|
|
|
|
|
if (path[0] == PATHSEPERATOR)
|
|
|
|
return; // absolute path location
|
|
|
|
strcpy (temp,path);
|
|
|
|
strcpy (path,basepath);
|
|
|
|
strcat (path,temp);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void StripFilename (char *path)
|
|
|
|
{
|
|
|
|
int length;
|
|
|
|
|
|
|
|
length = strlen(path)-1;
|
|
|
|
while (length > 0 && path[length] != PATHSEPERATOR)
|
|
|
|
length--;
|
|
|
|
path[length] = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
====================
|
|
|
|
Extract file parts
|
|
|
|
====================
|
|
|
|
*/
|
|
|
|
void ExtractFilePath (char *path, char *dest)
|
|
|
|
{
|
|
|
|
char *src;
|
|
|
|
|
|
|
|
src = path + strlen(path) - 1;
|
|
|
|
|
|
|
|
//
|
|
|
|
// back up until a \ or the start
|
|
|
|
//
|
|
|
|
while (src != path && *(src-1) != PATHSEPERATOR)
|
|
|
|
src--;
|
|
|
|
|
|
|
|
memcpy (dest, path, src-path);
|
|
|
|
dest[src-path] = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void ExtractFileBase (char *path, char *dest)
|
|
|
|
{
|
|
|
|
char *src;
|
|
|
|
|
|
|
|
src = path + strlen(path) - 1;
|
|
|
|
|
|
|
|
//
|
|
|
|
// back up until a \ or the start
|
|
|
|
//
|
|
|
|
while (src != path && *(src-1) != PATHSEPERATOR)
|
|
|
|
src--;
|
|
|
|
|
|
|
|
while (*src && *src != '.')
|
|
|
|
{
|
|
|
|
*dest++ = *src++;
|
|
|
|
}
|
|
|
|
*dest = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void ExtractFileExtension (char *path, char *dest)
|
|
|
|
{
|
|
|
|
char *src;
|
|
|
|
|
|
|
|
src = path + strlen(path) - 1;
|
|
|
|
|
|
|
|
//
|
|
|
|
// back up until a . or the start
|
|
|
|
//
|
|
|
|
while (src != path && *(src-1) != '.')
|
|
|
|
src--;
|
|
|
|
if (src == path)
|
|
|
|
{
|
|
|
|
*dest = 0; // no extension
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
strcpy (dest,src);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
==============
|
|
|
|
ParseNum / ParseHex
|
|
|
|
==============
|
|
|
|
*/
|
|
|
|
long ParseHex (char *hex)
|
|
|
|
{
|
|
|
|
char *str;
|
|
|
|
long num;
|
|
|
|
|
|
|
|
num = 0;
|
|
|
|
str = hex;
|
|
|
|
|
|
|
|
while (*str)
|
|
|
|
{
|
|
|
|
num <<= 4;
|
|
|
|
if (*str >= '0' && *str <= '9')
|
|
|
|
num += *str-'0';
|
|
|
|
else if (*str >= 'a' && *str <= 'f')
|
|
|
|
num += 10 + *str-'a';
|
|
|
|
else if (*str >= 'A' && *str <= 'F')
|
|
|
|
num += 10 + *str-'A';
|
|
|
|
else
|
|
|
|
QCC_Error (ERR_BADHEX, "Bad hex number: %s",hex);
|
|
|
|
str++;
|
|
|
|
}
|
|
|
|
|
|
|
|
return num;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
long ParseNum (char *str)
|
|
|
|
{
|
|
|
|
if (str[0] == '$')
|
|
|
|
return ParseHex (str+1);
|
|
|
|
if (str[0] == '0' && str[1] == 'x')
|
|
|
|
return ParseHex (str+2);
|
|
|
|
return atol (str);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//buffer size and max size are different. buffer is bigger.
|
|
|
|
|
|
|
|
#define MAXQCCFILES 3
|
|
|
|
struct {
|
|
|
|
char name[64];
|
|
|
|
char *buff;
|
|
|
|
// int buffismalloc;
|
|
|
|
int buffsize;
|
|
|
|
int ofs;
|
|
|
|
int maxofs;
|
|
|
|
} qccfile[MAXQCCFILES];
|
|
|
|
int SafeOpenWrite (char *filename, int maxsize)
|
|
|
|
{
|
|
|
|
int i;
|
2013-09-26 14:36:52 +00:00
|
|
|
if (strlen(filename) >= sizeof(qccfile[0].name))
|
|
|
|
{
|
|
|
|
QCC_Error(ERR_TOOMANYOPENFILES, "Filename %s too long", filename);
|
|
|
|
return -1;
|
|
|
|
}
|
2004-08-23 01:38:21 +00:00
|
|
|
for (i = 0; i < MAXQCCFILES; i++)
|
|
|
|
{
|
|
|
|
if (!qccfile[i].buff)
|
|
|
|
{
|
|
|
|
strcpy(qccfile[i].name, filename);
|
|
|
|
qccfile[i].buffsize = maxsize;
|
|
|
|
qccfile[i].maxofs = 0;
|
|
|
|
qccfile[i].ofs = 0;
|
|
|
|
// if (maxsize > 8192)
|
|
|
|
// qccfile[i].buffismalloc = 1;
|
|
|
|
// else
|
|
|
|
// qccfile[i].buffismalloc = 0;
|
|
|
|
// if (qccfile[i].buffismalloc)
|
|
|
|
qccfile[i].buff = malloc(qccfile[i].buffsize);
|
|
|
|
// else
|
|
|
|
// qccfile[i].buff = memalloc(qccfile[i].buffsize);
|
|
|
|
return i;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
QCC_Error(ERR_TOOMANYOPENFILES, "Too many open files on file %s", filename);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
void ResizeBuf(int hand, int newsize)
|
|
|
|
{
|
2010-12-08 14:42:05 +00:00
|
|
|
// int wasmal = qccfile[hand].buffismalloc;
|
2004-08-23 01:38:21 +00:00
|
|
|
char *nb;
|
|
|
|
|
|
|
|
if (qccfile[hand].buffsize >= newsize)
|
|
|
|
return; //already big enough
|
|
|
|
|
|
|
|
// if (newsize > 8192)
|
|
|
|
// {
|
|
|
|
// qccfile[hand].buffismalloc = true;
|
|
|
|
nb = malloc(newsize);
|
|
|
|
// }
|
|
|
|
// else
|
|
|
|
// {
|
|
|
|
// qccfile[hand].buffismalloc = false;
|
|
|
|
// nb = memalloc(newsize);
|
|
|
|
// }
|
2010-12-08 14:42:05 +00:00
|
|
|
|
2004-08-23 01:38:21 +00:00
|
|
|
memcpy(nb, qccfile[hand].buff, qccfile[hand].maxofs);
|
|
|
|
// if (wasmal)
|
|
|
|
free(qccfile[hand].buff);
|
|
|
|
// 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
|
|
|
// externs->memfree(qccfile[hand].buff);
|
2004-08-23 01:38:21 +00:00
|
|
|
qccfile[hand].buff = nb;
|
|
|
|
qccfile[hand].buffsize = newsize;
|
|
|
|
}
|
|
|
|
void SafeWrite(int hand, void *buf, long count)
|
|
|
|
{
|
|
|
|
if (qccfile[hand].ofs +count >= qccfile[hand].buffsize)
|
|
|
|
ResizeBuf(hand, qccfile[hand].ofs + count+(64*1024));
|
|
|
|
|
|
|
|
memcpy(&qccfile[hand].buff[qccfile[hand].ofs], buf, count);
|
|
|
|
qccfile[hand].ofs+=count;
|
|
|
|
if (qccfile[hand].ofs > qccfile[hand].maxofs)
|
|
|
|
qccfile[hand].maxofs = qccfile[hand].ofs;
|
|
|
|
}
|
|
|
|
int SafeSeek(int hand, int ofs, int mode)
|
|
|
|
{
|
|
|
|
if (mode == SEEK_CUR)
|
|
|
|
return qccfile[hand].ofs;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ResizeBuf(hand, ofs+1024);
|
|
|
|
qccfile[hand].ofs = ofs;
|
|
|
|
if (qccfile[hand].ofs > qccfile[hand].maxofs)
|
|
|
|
qccfile[hand].maxofs = qccfile[hand].ofs;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
2013-09-26 14:36:52 +00:00
|
|
|
pbool SafeClose(int hand)
|
2004-08-23 01:38:21 +00:00
|
|
|
{
|
2013-09-26 14:36:52 +00:00
|
|
|
pbool ret;
|
|
|
|
ret = externs->WriteFile(qccfile[hand].name, qccfile[hand].buff, qccfile[hand].maxofs);
|
2004-08-23 01:38:21 +00:00
|
|
|
// if (qccfile[hand].buffismalloc)
|
|
|
|
free(qccfile[hand].buff);
|
|
|
|
// 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
|
|
|
// externs->memfree(qccfile[hand].buff);
|
2004-08-23 01:38:21 +00:00
|
|
|
qccfile[hand].buff = NULL;
|
2013-09-26 14:36:52 +00:00
|
|
|
return ret;
|
2004-08-23 01:38:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
qcc_cachedsourcefile_t *qcc_sourcefile;
|
------------------------------------------------------------------------
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
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
UTF16LE,
|
|
|
|
UTF16BE,
|
|
|
|
UTF32LE,
|
|
|
|
UTF32BE,
|
|
|
|
};
|
|
|
|
//read utf-16 chars and output the 'native' utf-8.
|
|
|
|
//we don't expect essays written in code, so we don't need much actual support for utf-8.
|
|
|
|
static char *decodeUTF(int type, unsigned char *inputf, unsigned int inbytes, int *outlen)
|
|
|
|
{
|
|
|
|
char *utf8, *start;
|
|
|
|
unsigned int inc;
|
|
|
|
unsigned int chars, i;
|
|
|
|
int w, maxperchar;
|
|
|
|
switch(type)
|
|
|
|
{
|
|
|
|
case UTF16LE:
|
|
|
|
w = 2;
|
2013-12-29 22:48:28 +00:00
|
|
|
maxperchar = 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
|
|
|
break;
|
|
|
|
case UTF16BE:
|
|
|
|
w = 2;
|
2013-12-29 22:48:28 +00:00
|
|
|
maxperchar = 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
|
|
|
break;
|
|
|
|
case UTF32LE:
|
|
|
|
w = 4;
|
|
|
|
maxperchar = 4; //we adhere to RFC3629 and clamp to U+10FFFF, which is only 4 bytes.
|
|
|
|
break;
|
|
|
|
case UTF32BE:
|
|
|
|
w = 4;
|
|
|
|
maxperchar = 4;
|
|
|
|
break;
|
2013-03-12 22:47:42 +00:00
|
|
|
default:
|
|
|
|
*outlen = inbytes;
|
|
|
|
return inputf;
|
------------------------------------------------------------------------
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
|
|
|
}
|
|
|
|
chars = inbytes / w;
|
|
|
|
utf8 = start = qccHunkAlloc(chars * maxperchar + 2);
|
|
|
|
for (i = 0; i < chars; i++)
|
|
|
|
{
|
|
|
|
switch(type)
|
|
|
|
{
|
|
|
|
case UTF16LE:
|
|
|
|
case UTF16BE:
|
2013-12-29 22:48:28 +00:00
|
|
|
inc = inputf[type==UTF16BE];
|
|
|
|
inc|= inputf[type==UTF16LE]<<8;
|
|
|
|
inputf += 2;
|
|
|
|
//handle surrogates
|
|
|
|
if (inc >= 0xd800u && inc < 0xdc00u && i+1 < chars)
|
|
|
|
{
|
|
|
|
unsigned int l;
|
|
|
|
|
|
|
|
l = inputf[type==UTF16BE];
|
|
|
|
l|= inputf[type==UTF16LE]<<8;
|
|
|
|
if (l >= 0xdc00u && l < 0xe000u)
|
|
|
|
{
|
|
|
|
inputf+=2;
|
|
|
|
inc = ((inc & 0x3ffu)<<10) | (l & 0x3ffu) + 0x10000;
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
}
|
------------------------------------------------------------------------
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
|
|
|
break;
|
|
|
|
case UTF32LE:
|
|
|
|
inc = *inputf++;
|
|
|
|
inc|= (*inputf++)<<8;
|
|
|
|
inc|= (*inputf++)<<16;
|
|
|
|
inc|= (*inputf++)<<24;
|
|
|
|
break;
|
|
|
|
case UTF32BE:
|
|
|
|
inc = (*inputf++)<<24;
|
|
|
|
inc|= (*inputf++)<<16;
|
|
|
|
inc|= (*inputf++)<<8;
|
|
|
|
inc|= *inputf++;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (inc > 0x10FFFF)
|
|
|
|
inc = 0xFFFD;
|
|
|
|
|
|
|
|
if (inc <= 127)
|
|
|
|
*utf8++ = inc;
|
|
|
|
else if (inc <= 0x7ff)
|
|
|
|
{
|
|
|
|
*utf8++ = ((inc>>6) & 0x1f) | 0xc0;
|
|
|
|
*utf8++ = ((inc>>0) & 0x3f) | 0x80;
|
|
|
|
}
|
|
|
|
else if (inc <= 0xffff)
|
|
|
|
{
|
|
|
|
*utf8++ = ((inc>>12) & 0xf) | 0xe0;
|
|
|
|
*utf8++ = ((inc>>6) & 0x3f) | 0x80;
|
|
|
|
*utf8++ = ((inc>>0) & 0x3f) | 0x80;
|
|
|
|
}
|
|
|
|
else if (inc <= 0x1fffff)
|
|
|
|
{
|
|
|
|
*utf8++ = ((inc>>18) & 0x07) | 0xf0;
|
|
|
|
*utf8++ = ((inc>>12) & 0x3f) | 0x80;
|
|
|
|
*utf8++ = ((inc>> 6) & 0x3f) | 0x80;
|
|
|
|
*utf8++ = ((inc>> 0) & 0x3f) | 0x80;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
inc = 0xFFFD;
|
|
|
|
*utf8++ = ((inc>>12) & 0xf) | 0xe0;
|
|
|
|
*utf8++ = ((inc>>6) & 0x3f) | 0x80;
|
|
|
|
*utf8++ = ((inc>>0) & 0x3f) | 0x80;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
*outlen = utf8 - start;
|
|
|
|
return start;
|
|
|
|
}
|
|
|
|
|
2004-08-23 01:38:21 +00:00
|
|
|
long QCC_LoadFile (char *filename, void **bufferptr)
|
|
|
|
{
|
|
|
|
char *mem;
|
|
|
|
int len;
|
|
|
|
len = externs->FileSize(filename);
|
|
|
|
if (len < 0)
|
|
|
|
{
|
|
|
|
QCC_Error(ERR_COULDNTOPENFILE, "Couldn't open file %s", 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
|
|
|
// if (!externs->Abort)
|
2004-08-23 01:38:21 +00:00
|
|
|
return -1;
|
------------------------------------------------------------------------
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
|
|
|
// externs->Abort("failed to find file %s", filename);
|
2004-08-23 01:38:21 +00:00
|
|
|
}
|
2010-12-08 14:42:05 +00:00
|
|
|
mem = qccHunkAlloc(sizeof(qcc_cachedsourcefile_t) + len+2);
|
2004-08-23 01:38:21 +00:00
|
|
|
|
|
|
|
((qcc_cachedsourcefile_t*)mem)->next = qcc_sourcefile;
|
|
|
|
qcc_sourcefile = (qcc_cachedsourcefile_t*)mem;
|
2010-12-08 14:42:05 +00:00
|
|
|
mem += sizeof(qcc_cachedsourcefile_t);
|
|
|
|
|
2004-08-23 01:38:21 +00:00
|
|
|
externs->ReadFile(filename, mem, len+2);
|
------------------------------------------------------------------------
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 (len >= 4 && mem[0] == '\xff' && mem[1] == '\xfe' && mem[2] == '\x00' && mem[3] == '\x00')
|
|
|
|
mem = decodeUTF(UTF32LE, (unsigned char*)mem+4, len-4, &len);
|
|
|
|
else if (len >= 4 && mem[0] == '\x00' && mem[1] == '\x00' && mem[2] == '\xfe' && mem[3] == '\xff')
|
|
|
|
mem = decodeUTF(UTF32BE, (unsigned char*)mem+4, len-4, &len);
|
|
|
|
else if (len >= 2 && mem[0] == '\xff' && mem[1] == '\xfe')
|
|
|
|
mem = decodeUTF(UTF16LE, (unsigned char*)mem+2, len-2, &len);
|
|
|
|
else if (len >= 2 && mem[0] == '\xfe' && mem[1] == '\xff')
|
|
|
|
mem = decodeUTF(UTF16BE, (unsigned char*)mem+2, len-2, &len);
|
|
|
|
//utf-8 BOM, for compat with broken text editors (like windows notepad).
|
|
|
|
else if (len >= 3 && mem[0] == '\xef' && mem[1] == '\xbb' && mem[2] == '\xbf')
|
|
|
|
{
|
|
|
|
mem += 3;
|
|
|
|
len -= 3;
|
|
|
|
}
|
|
|
|
//actual utf-8 handling is somewhat up to the engine. the qcc can only ensure that utf8 works in symbol names etc.
|
|
|
|
//its only in strings where it actually makes a difference, and the interpretation of those is basically entirely up to the engine.
|
|
|
|
//that said, we could insert a utf-8 BOM into ones with utf-8 chars, but that would mess up a lot of builtins+mods, so we won't.
|
|
|
|
|
2004-08-23 01:38:21 +00:00
|
|
|
mem[len] = '\n';
|
|
|
|
mem[len+1] = '\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
|
|
|
|
|
|
|
strcpy(qcc_sourcefile->filename, filename);
|
|
|
|
qcc_sourcefile->size = len;
|
|
|
|
qcc_sourcefile->file = mem;
|
|
|
|
qcc_sourcefile->type = FT_CODE;
|
|
|
|
|
2004-08-23 01:38:21 +00:00
|
|
|
*bufferptr=mem;
|
2010-12-08 14:42:05 +00:00
|
|
|
|
2004-08-23 01:38:21 +00:00
|
|
|
return len;
|
|
|
|
}
|
|
|
|
void QCC_AddFile (char *filename)
|
|
|
|
{
|
|
|
|
char *mem;
|
|
|
|
int len;
|
|
|
|
len = externs->FileSize(filename);
|
|
|
|
if (len < 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
|
|
|
externs->Abort("failed to find file %s", filename);
|
2010-12-08 14:42:05 +00:00
|
|
|
mem = qccHunkAlloc(sizeof(qcc_cachedsourcefile_t) + len+1);
|
2004-08-23 01:38:21 +00:00
|
|
|
|
|
|
|
((qcc_cachedsourcefile_t*)mem)->next = qcc_sourcefile;
|
|
|
|
qcc_sourcefile = (qcc_cachedsourcefile_t*)mem;
|
2010-12-08 14:42:05 +00:00
|
|
|
qcc_sourcefile->size = len;
|
|
|
|
mem += sizeof(qcc_cachedsourcefile_t);
|
2004-08-23 01:38:21 +00:00
|
|
|
strcpy(qcc_sourcefile->filename, filename);
|
|
|
|
qcc_sourcefile->file = mem;
|
|
|
|
qcc_sourcefile->type = FT_DATA;
|
|
|
|
|
|
|
|
externs->ReadFile(filename, mem, len+1);
|
|
|
|
mem[len] = '\0';
|
|
|
|
}
|
|
|
|
void *FS_ReadToMem(char *filename, void *mem, int *len)
|
|
|
|
{
|
|
|
|
if (!mem)
|
|
|
|
{
|
|
|
|
*len = externs->FileSize(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
|
|
|
mem = externs->memalloc(*len);
|
2004-08-23 01:38:21 +00:00
|
|
|
}
|
|
|
|
return externs->ReadFile(filename, mem, *len);
|
|
|
|
}
|
|
|
|
|
|
|
|
void FS_CloseFromMem(void *mem)
|
|
|
|
{
|
------------------------------------------------------------------------
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
|
|
|
externs->memfree(mem);
|
2004-08-23 01:38:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|
2004-11-23 00:29:10 +00:00
|
|
|
|
|
|
|
void StripExtension (char *path)
|
|
|
|
{
|
|
|
|
int length;
|
|
|
|
|
|
|
|
length = strlen(path)-1;
|
|
|
|
while (length > 0 && path[length] != '.')
|
|
|
|
{
|
|
|
|
length--;
|
|
|
|
if (path[length] == '/')
|
|
|
|
return; // no extension
|
|
|
|
}
|
|
|
|
if (length)
|
|
|
|
path[length] = 0;
|
|
|
|
}
|