2004-08-23 01:38:21 +00:00
// cmdlib.h
# ifndef __CMDLIB__
# define __CMDLIB__
# include "progsint.h"
/*#include <stdio.h>
# include <string.h>
# include <stdlib.h>
# include <errno.h>
# include <ctype.h>
# include <sys/types.h>
# include <sys/stat.h>
# include <fcntl.h>
# include <stdarg.h>
# include <setjmp.h>
# include <io.h>
# ifdef NeXT
# include <libc.h>
# endif
*/
// the dec offsetof macro doesn't work very well...
# define myoffsetof(type,identifier) ((size_t)&((type *)NULL)->identifier)
// set these before calling CheckParm
extern int myargc ;
extern char * * myargv ;
//char *strupr (char *in);
//char *strlower (char *in);
int QCC_filelength ( int handle ) ;
int QCC_tell ( int handle ) ;
int QC_strcasecmp ( const char * s1 , const char * s2 ) ;
2017-06-21 02:57:41 +00:00
int QC_strncasecmp ( const char * s1 , const char * s2 , int n ) ;
2004-08-23 01:38:21 +00:00
2015-02-02 08:01:53 +00:00
void QC_strlcat ( char * dest , const char * src , size_t destsize ) ;
void QC_strlcpy ( char * dest , const char * src , size_t destsize ) ;
void QC_strnlcpy ( char * dest , const char * src , size_t srclen , size_t destsize ) ;
2016-07-12 00:40:13 +00:00
char * QC_strcasestr ( const char * haystack , const char * needle ) ;
2015-02-02 08:01:53 +00:00
2004-08-23 01:38:21 +00:00
# ifdef _MSC_VER
# define QC_vsnprintf _vsnprintf
2013-09-26 14:36:52 +00:00
static void VARGS QC_snprintfz ( char * dest , size_t size , const char * fmt , . . . )
{
va_list args ;
va_start ( args , fmt ) ;
2016-08-25 00:12:14 +00:00
_vsnprintf ( dest , size - 1 , fmt , args ) ;
2013-09-26 14:36:52 +00:00
va_end ( args ) ;
//make sure its terminated.
dest [ size - 1 ] = 0 ;
}
2004-08-23 01:38:21 +00:00
# else
# define QC_vsnprintf vsnprintf
2013-09-26 14:36:52 +00:00
# define QC_snprintfz snprintf
2004-08-23 01:38:21 +00:00
# endif
2010-03-26 03:44:22 +00:00
# if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1))
# ifndef LIKEPRINTF
# define LIKEPRINTF(x) __attribute__((format(printf,x,x+1)))
# endif
# endif
# ifndef LIKEPRINTF
# define LIKEPRINTF(x)
# endif
2004-08-23 01:38:21 +00:00
double I_FloatTime ( void ) ;
2010-03-26 03:44:22 +00:00
void VARGS QCC_Error ( int errortype , const char * error , . . . ) LIKEPRINTF ( 2 ) ;
2004-08-23 01:38:21 +00:00
int CheckParm ( char * check ) ;
int SafeOpenWrite ( char * filename , int maxsize ) ;
int SafeOpenRead ( char * filename ) ;
void SafeRead ( int handle , void * buffer , long count ) ;
2016-09-08 19:04:35 +00:00
void SafeWrite ( int handle , const void * buffer , long count ) ;
2013-09-26 14:36:52 +00:00
pbool SafeClose ( int hand ) ;
2004-08-23 01:38:21 +00:00
int SafeSeek ( int hand , int ofs , int mode ) ;
void * SafeMalloc ( long size ) ;
long QCC_LoadFile ( char * filename , void * * bufferptr ) ;
void QCC_SaveFile ( char * filename , void * buffer , long count ) ;
void DefaultExtension ( char * path , char * extension ) ;
void DefaultPath ( char * path , char * basepath ) ;
void StripFilename ( char * path ) ;
void StripExtension ( char * path ) ;
void ExtractFilePath ( char * path , char * dest ) ;
void ExtractFileBase ( char * path , char * dest ) ;
void ExtractFileExtension ( char * path , char * dest ) ;
long ParseNum ( char * str ) ;
2016-07-12 00:40:13 +00:00
unsigned short * QCC_makeutf16 ( char * mem , unsigned int len , int * outlen , pbool * errors ) ;
char * QCC_SanitizeCharSet ( char * mem , unsigned int * len , pbool * freeresult , int * origfmt ) ;
2004-08-23 01:38:21 +00:00
2014-03-30 08:55:06 +00:00
char * QCC_COM_Parse ( const char * data ) ;
2004-11-13 17:33:05 +00:00
char * QCC_COM_Parse2 ( char * data ) ;
2004-08-23 01:38:21 +00:00
2014-05-21 06:21:09 +00:00
unsigned int utf8_check ( const void * in , unsigned int * value ) ;
2004-08-23 01:38:21 +00:00
extern char qcc_token [ 1024 ] ;
extern int qcc_eof ;
------------------------------------------------------------------------
r4169 | acceptthis | 2013-01-17 08:55:12 +0000 (Thu, 17 Jan 2013) | 31 lines
removed MAX_VISEDICTS limit.
PEXT2_REPLACEMENTDELTAS tweaked, now has 4 million entity limit. still not enabled by default.
TE_BEAM now maps to a separate TEQW_BEAM to avoid conflicts with QW.
added android multitouch emulation for windows/rawinput (in_simulatemultitouch).
split topcolor/bottomcolor from scoreboard, for dp's colormap|1024 feature.
now using utf-8 for windows consoles.
qcc warnings/errors now give clickable console links for quick+easy editing.
disabled menutint when the currently active item changes contrast or gamma (for OneManClan).
Added support for drawfont/drawfontscale.
tweaked the qcvm a little to reduce the number of pointers.
.doll file loading. still experimental and will likely crash. requires csqc active, even if its a dummy progs. this will be fixed in time. Still other things that need cleaning up.
windows: gl_font "?" shows the standard windows font-selection dialog, and can be used to select windows fonts. not all work. and you probably don't want to use windings.
fixed splitscreen support when playing mvds. added mini-scoreboards to splitscreen.
editor/debugger now shows asm if there's no linenumber info. also, pressing f1 for help shows the shortcuts.
Added support for .framegroups files for psk(psa) and iqm formats.
True support for ezquake's colour codes. Mutually exclusive with background colours.
path command output slightly more readable.
added support for digest_hex (MD4, SHA1, CRC16).
skingroups now colourmap correctly.
Fix terrain colour hints, and litdata from the wrong bsp.
fix ftp dual-homed issue. support epsv command, and enable ipv6 (eprt still not supported).
remove d3d11 compilation from the makefile. the required headers are not provided by mingw, and are not available to the build bot, so don't bother.
fix v *= v.x and similar opcodes.
fteqcc: fixed support for áéíóú type chars in names. utf-8 files now properly supported (even with the utf-8 bom/identifier). utf-16 also supported.
fteqcc: fixed '#if 1 == 3 && 4' parsing.
fteqcc: -Werror acts on the warning, rather than as a separate error. Line numbers are thus more readable.
fteqcc: copyright message now includes compile date instead.
fteqccgui: the treeview control is now coloured depending on whether there were warnings/errors in the last compile.
fteqccgui: the output window is now focused and scrolls down as compilation progresses.
pr_dumpplatform command dumps out some pragmas to convert more serious warnings to errors. This is to avoid the infamous 'fteqcc sucks cos my code sucks' issue.
rewrote prespawn/modelist/soundlist code. server tracks progress now.
------------------------------------------------------------------------
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4167 fc73d0e0-1445-4013-8a0c-d673dee63da5
2013-03-12 22:29:40 +00:00
# define qcc_iswhite(c) ((c) == ' ' || (c) == '\r' || (c) == '\n' || (c) == '\t' || (c) == '\v')
# define qcc_iswhitesameline(c) ((c) == ' ' || (c) == '\t')
2017-03-04 19:36:06 +00:00
# define qcc_islineending(c,n) ((c) == '\n' || ((c) == '\r' && (n) != '\n')) //to try to handle mac line endings, especially if they're in the middle of a line
------------------------------------------------------------------------
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
2004-08-23 01:38:21 +00:00
2015-04-27 06:19:33 +00:00
enum
{
UTF8_RAW ,
UTF8_BOM ,
UTF_ANSI ,
UTF16LE ,
UTF16BE ,
UTF32LE ,
UTF32BE ,
} ;
2004-08-23 01:38:21 +00:00
# endif