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
36 #ifdef NDEBUG // Don't show in a Release build
\r
37 #pragma warning(disable : 4305) // truncate from double to float
\r
38 #pragma warning(disable : 4244) // conversion from double to float
\r
39 #pragma warning(disable : 4018) // signed/unsigned mismatch
\r
44 #pragma intrinsic( memset, memcpy )
\r
47 #ifndef __BYTEBOOL__
\r
48 #define __BYTEBOOL__
\r
49 typedef enum {false, true} qboolean;
\r
50 typedef unsigned char byte;
\r
53 #define MAX_OS_PATH 1024
\r
54 #define MEM_BLOCKSIZE 4096
\r
57 extern qboolean verbose;
\r
58 #define SYS_VRB 0 // verbose support (on/off)
\r
59 #define SYS_STD 1 // standard print level
\r
60 #define SYS_WRN 2 // warnings
\r
61 #define SYS_ERR 3 // error
\r
64 // the dec offsetof macro doesnt work very well...
\r
65 #define myoffsetof(type,identifier) ((size_t)&((type *)0)->identifier)
\r
69 void *safe_malloc( size_t size );
\r
70 void *safe_malloc_info( size_t size, char* info );
\r
72 #define safe_malloc(a) malloc(a)
\r
73 #endif /* SAFE_MALLOC */
\r
75 // set these before calling CheckParm
\r
77 extern char **myargv;
\r
79 char *strlower (char *in);
\r
80 int Q_strncasecmp( const char *s1, const char *s2, int n );
\r
81 int Q_strcasecmp( const char *s1, const char *s2 );
\r
82 int Q_stricmp( const char *s1, const char *s2 );
\r
83 void Q_getwd( char *out );
\r
85 int Q_filelength (FILE *f);
\r
86 int FileTime( const char *path );
\r
88 void Q_mkdir( const char *path );
\r
90 extern char qdir[1024];
\r
91 extern char gamedir[1024];
\r
92 extern char writedir[1024];
\r
93 extern char *moddirparam;
\r
94 void SetQdirFromPath( const char *path);
\r
95 char *ExpandArg( const char *path ); // from cmd line
\r
96 char *ExpandPath( const char *path ); // from scripts
\r
97 char *ExpandGamePath (const char *path);
\r
98 char *ExpandPathAndArchive( const char *path );
\r
99 void ExpandWildcards( int *argc, char ***argv );
\r
102 double I_FloatTime( void );
\r
104 int CheckParm( const char *check );
\r
106 FILE *SafeOpenWrite( const char *filename );
\r
107 FILE *SafeOpenRead( const char *filename );
\r
108 void SafeRead (FILE *f, void *buffer, int count);
\r
109 void SafeWrite (FILE *f, const void *buffer, int count);
\r
111 int LoadFile( const char *filename, void **bufferptr );
\r
112 int LoadFileBlock( const char *filename, void **bufferptr );
\r
113 int TryLoadFile( const char *filename, void **bufferptr );
\r
114 void SaveFile( const char *filename, const void *buffer, int count );
\r
115 qboolean FileExists( const char *filename );
\r
117 void DefaultExtension( char *path, const char *extension );
\r
118 void DefaultPath( char *path, const char *basepath );
\r
119 void StripFilename( char *path );
\r
120 void StripExtension( char *path );
\r
122 void ExtractFilePath( const char *path, char *dest );
\r
123 void ExtractFileBase( const char *path, char *dest );
\r
124 void ExtractFileExtension( const char *path, char *dest );
\r
126 int ParseNum (const char *str);
\r
128 //void Sys_Printf (const char *text, ...);
\r
129 //void Sys_FPrintf (int flag, const char *text, ...);
\r
130 //void Error( const char *error, ... );
\r
132 short BigShort (short l);
\r
133 short LittleShort (short l);
\r
134 int BigLong (int l);
\r
135 int LittleLong (int l);
\r
136 float BigFloat (float l);
\r
137 float LittleFloat (float l);
\r
140 char *COM_Parse (char *data);
\r
142 extern char com_token[1024];
\r
143 extern qboolean com_eof;
\r
145 char *copystring(const char *s);
\r
148 void CRC_Init(unsigned short *crcvalue);
\r
149 void CRC_ProcessByte(unsigned short *crcvalue, byte data);
\r
150 unsigned short CRC_Value(unsigned short crcvalue);
\r
152 void CreatePath( const char *path );
\r
153 void QCopyFile( const char *from, const char *to );
\r
155 extern qboolean archive;
\r
156 extern char archivedir[1024];
\r
158 // sleep for the given amount of milliseconds
\r
159 void Sys_Sleep(int n);
\r
161 // for compression routines
\r
168 extern char game[64];
\r