2 Copyright (C) 1999-2007 id Software, Inc. and contributors.
3 For a list of contributors, see the accompanying CONTRIBUTORS file.
5 This file is part of GtkRadiant.
7 GtkRadiant is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 GtkRadiant is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with GtkRadiant; if not, write to the Free Software
19 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
28 #include "globaldefs.h"
30 #if GDEF_COMPILER_MSVC
31 #pragma warning(disable : 4244) // MIPS
32 #pragma warning(disable : 4136) // X86
33 #pragma warning(disable : 4051) // ALPHA
35 #pragma warning(disable : 4018) // signed/unsigned mismatch
36 #pragma warning(disable : 4305) // truncate from double to float
38 #pragma check_stack(off)
50 #if GDEF_COMPILER_MSVC
52 #pragma intrinsic( memset, memcpy )
58 #define MAX_OS_PATH PATH_MAX
60 #define MAX_OS_PATH 4096
62 #define MEM_BLOCKSIZE 4096
64 // the dec offsetof macro doesnt work very well...
65 #define myoffsetof( type,identifier ) ( (size_t)& ( (type *)0 )->identifier )
67 void *safe_malloc( size_t size );
68 void *safe_malloc_info( size_t size, char* info );
70 // set these before calling CheckParm
74 char *strlower( char *in );
75 int Q_strncasecmp( const char *s1, const char *s2, int n );
76 int Q_stricmp( const char *s1, const char *s2 );
77 void Q_getwd( char *out );
79 int Q_filelength( FILE *f );
80 int FileTime( const char *path );
82 void Q_mkdir( const char *path );
84 extern char qdir[1024];
85 extern char gamedir[1024];
86 extern char writedir[1024];
87 extern char *moddirparam;
88 void SetQdirFromPath( const char *path );
89 char *ExpandArg( const char *path ); // from cmd line
90 char *ExpandPath( const char *path ); // from scripts
91 void ExpandWildcards( int *argc, char ***argv );
94 double I_FloatTime( void );
96 void Error( const char *error, ... ) GDEF_ATTRIBUTE_NORETURN;
97 int CheckParm( const char *check );
99 FILE *SafeOpenWrite( const char *filename );
100 FILE *SafeOpenRead( const char *filename );
101 void SafeRead( FILE *f, void *buffer, int count );
102 void SafeWrite( FILE *f, const void *buffer, int count );
104 int LoadFile( const char *filename, void **bufferptr );
105 int LoadFileBlock( const char *filename, void **bufferptr );
106 int TryLoadFile( const char *filename, void **bufferptr );
107 void SaveFile( const char *filename, const void *buffer, int count );
108 qboolean FileExists( const char *filename );
110 void DefaultExtension( char *path, const char *extension );
111 void DefaultPath( char *path, const char *basepath );
112 void StripFilename( char *path );
113 void StripExtension( char *path );
115 void ExtractFilePath( const char *path, char *dest );
116 void ExtractFileBase( const char *path, char *dest );
117 void ExtractFileExtension( const char *path, char *dest );
119 int ParseNum( const char *str );
121 short BigShort( short l );
122 short LittleShort( short l );
123 int BigLong( int l );
124 int LittleLong( int l );
125 float BigFloat( float l );
126 float LittleFloat( float l );
129 char *COM_Parse( char *data );
131 extern char com_token[1024];
132 extern qboolean com_eof;
134 char *copystring( const char *s );
137 void CRC_Init( unsigned short *crcvalue );
138 void CRC_ProcessByte( unsigned short *crcvalue, byte data );
139 unsigned short CRC_Value( unsigned short crcvalue );
141 void CreatePath( const char *path );
142 void QCopyFile( const char *from, const char *to );
144 extern qboolean archive;
145 extern char archivedir[1024];
147 // sleep for the given amount of milliseconds
148 void Sys_Sleep( int n );
150 // for compression routines
154 int count, width, height;