2 Copyright (C) 1999-2007 id Software, Inc. and contributors.
\r
3 For a list of contributors, see the accompanying CONTRIBUTORS file.
\r
5 This file is part of GtkRadiant.
\r
7 GtkRadiant is free software; you can redistribute it and/or modify
\r
8 it under the terms of the GNU General Public License as published by
\r
9 the Free Software Foundation; either version 2 of the License, or
\r
10 (at your option) any later version.
\r
12 GtkRadiant is distributed in the hope that it will be useful,
\r
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
15 GNU General Public License for more details.
\r
17 You should have received a copy of the GNU General Public License
\r
18 along with GtkRadiant; if not, write to the Free Software
\r
19 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\r
28 #pragma warning(disable : 4244) // MIPS
\r
29 #pragma warning(disable : 4136) // X86
\r
30 #pragma warning(disable : 4051) // ALPHA
\r
32 #pragma warning(disable : 4018) // signed/unsigned mismatch
\r
33 #pragma warning(disable : 4305) // truncate from double to float
\r
35 #pragma check_stack(off)
\r
49 #pragma intrinsic( memset, memcpy )
\r
53 #ifndef __BYTEBOOL__
\r
54 #define __BYTEBOOL__
\r
55 //typedef enum {false, true} qboolean;
\r
56 //typedef unsigned char byte;
\r
57 #include "q_typedef.h"
\r
60 #define MAX_OS_PATH 1024
\r
61 #define MEM_BLOCKSIZE 4096
\r
63 extern qboolean verbose;
\r
64 #define SYS_VRB 0 // verbose support (on/off)
\r
65 #define SYS_STD 1 // standard print level
\r
66 #define SYS_WRN 2 // warnings
\r
67 #define SYS_ERR 3 // error
\r
69 // the dec offsetof macro doesnt work very well...
\r
70 #define myoffsetof(type,identifier) ((size_t)&((type *)0)->identifier)
\r
74 void *safe_malloc( size_t size );
\r
75 void *safe_malloc_info( size_t size, char* info );
\r
77 #define safe_malloc(a) malloc(a)
\r
78 #endif /* SAFE_MALLOC */
\r
80 // set these before calling CheckParm
\r
82 extern char **myargv;
\r
84 char *strlower (char *in);
\r
85 int Q_strncasecmp( const char *s1, const char *s2, int n );
\r
86 int Q_stricmp( const char *s1, const char *s2 );
\r
87 int Q_strcasecmp( const char *s1, const char *s2 );
\r
88 void Q_getwd( char *out );
\r
90 int Q_filelength (FILE *f);
\r
91 int FileTime( const char *path );
\r
93 void Q_mkdir( const char *path );
\r
95 extern char qdir[1024];
\r
96 extern char gamedir[1024];
\r
97 extern char writedir[1024];
\r
98 extern char *moddirparam;
\r
99 void SetQdirFromPath( const char *path);
\r
100 char *ExpandArg( const char *path ); // from cmd line
\r
101 char *ExpandPath( const char *path ); // from scripts
\r
102 char *ExpandGamePath (const char *path);
\r
103 char *ExpandPathAndArchive( const char *path );
\r
104 void ExpandWildcards( int *argc, char ***argv );
\r
107 double I_FloatTime( void );
\r
109 int CheckParm( const char *check );
\r
111 void *SafeMalloc(size_t n, char *desc);
\r
112 FILE *SafeOpenWrite( const char *filename );
\r
113 FILE *SafeOpenRead( const char *filename );
\r
114 void SafeRead (FILE *f, void *buffer, int count);
\r
115 void SafeWrite (FILE *f, const void *buffer, int count);
\r
117 int LoadFile( const char *filename, void **bufferptr );
\r
118 int LoadFileBlock( const char *filename, void **bufferptr );
\r
119 int TryLoadFile( const char *filename, void **bufferptr );
\r
120 void SaveFile( const char *filename, const void *buffer, int count );
\r
121 qboolean FileExists( const char *filename );
\r
123 void DefaultExtension( char *path, const char *extension );
\r
124 void DefaultPath( char *path, const char *basepath );
\r
125 void StripFilename( char *path );
\r
126 void StripExtension( char *path );
\r
128 void ExtractFilePath( const char *path, char *dest );
\r
129 void ExtractFileBase( const char *path, char *dest );
\r
130 void ExtractFileExtension( const char *path, char *dest );
\r
132 int ParseNum (const char *str);
\r
134 void Sys_Printf (const char *text, ...);
\r
135 void Sys_FPrintf (int flag, const char *text, ...);
\r
136 void Error( const char *error, ... );
\r
138 short BigShort (short l);
\r
139 short LittleShort (short l);
\r
140 int BigLong (int l);
\r
141 int LittleLong (int l);
\r
142 float BigFloat (float l);
\r
143 float LittleFloat (float l);
\r
146 char *COM_Parse (char *data);
\r
148 extern char com_token[1024];
\r
149 extern qboolean com_eof;
\r
151 char *copystring(const char *s);
\r
154 void CRC_Init(unsigned short *crcvalue);
\r
155 void CRC_ProcessByte(unsigned short *crcvalue, byte data);
\r
156 unsigned short CRC_Value(unsigned short crcvalue);
\r
158 void CreatePath( const char *path );
\r
159 void QCopyFile( const char *from, const char *to );
\r
161 extern qboolean archive;
\r
162 extern char archivedir[1024];
\r
164 extern qboolean g_dokeypress;
\r
166 // sleep for the given amount of milliseconds
\r
167 void Sys_Sleep(int n);
\r
169 // for compression routines
\r