2 Copyright (C) 1999-2006 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
30 #pragma warning(disable : 4244) // MIPS
31 #pragma warning(disable : 4136) // X86
32 #pragma warning(disable : 4051) // ALPHA
34 #pragma warning(disable : 4018) // signed/unsigned mismatch
35 #pragma warning(disable : 4305) // truncate from double to float
37 #pragma check_stack(off)
51 #pragma intrinsic( memset, memcpy )
57 #define MAX_OS_PATH PATH_MAX
59 #define MAX_OS_PATH 1024
61 #define MEM_BLOCKSIZE 4096
63 // the dec offsetof macro doesnt work very well...
64 #define myoffsetof(type,identifier) ((size_t)&((type *)0)->identifier)
68 void *safe_malloc( size_t size );
69 void *safe_malloc_info( size_t size, char* info );
71 #define safe_malloc(a) malloc(a)
72 #endif /* SAFE_MALLOC */
74 // set these before calling CheckParm
78 char *strlower (char *in);
79 int Q_strncasecmp( const char *s1, const char *s2, int n );
80 int Q_stricmp( const char *s1, const char *s2 );
81 void Q_getwd( char *out );
83 int Q_filelength (FILE *f);
84 int FileTime( const char *path );
86 void Q_mkdir( const char *path );
88 extern char qdir[1024];
89 extern char gamedir[1024];
90 extern char writedir[1024];
91 extern char *moddirparam;
92 void SetQdirFromPath( const char *path);
93 char *ExpandArg( const char *path ); // from cmd line
94 char *ExpandPath( const char *path ); // from scripts
95 char *ExpandGamePath (const char *path);
96 char *ExpandPathAndArchive( const char *path );
97 void ExpandWildcards( int *argc, char ***argv );
100 double I_FloatTime( void );
102 void Error( const char *error, ... );
103 int CheckParm( const char *check );
105 FILE *SafeOpenWrite( const char *filename );
106 FILE *SafeOpenRead( const char *filename );
107 void SafeRead (FILE *f, void *buffer, int count);
108 void SafeWrite (FILE *f, const void *buffer, int count);
110 int LoadFile( const char *filename, void **bufferptr );
111 int LoadFileBlock( const char *filename, void **bufferptr );
112 int TryLoadFile( const char *filename, void **bufferptr );
113 void SaveFile( const char *filename, const void *buffer, int count );
114 qboolean FileExists( const char *filename );
116 void DefaultExtension( char *path, const char *extension );
117 void DefaultPath( char *path, const char *basepath );
118 void StripFilename( char *path );
119 void StripExtension( char *path );
121 void ExtractFilePath( const char *path, char *dest );
122 void ExtractFileBase( const char *path, char *dest );
123 void ExtractFileExtension( const char *path, char *dest );
125 int ParseNum (const char *str);
127 short BigShort (short l);
128 short LittleShort (short l);
130 int LittleLong (int l);
131 float BigFloat (float l);
132 float LittleFloat (float l);
135 char *COM_Parse (char *data);
137 extern char com_token[1024];
138 extern qboolean com_eof;
140 char *copystring(const char *s);
143 void CRC_Init(unsigned short *crcvalue);
144 void CRC_ProcessByte(unsigned short *crcvalue, byte data);
145 unsigned short CRC_Value(unsigned short crcvalue);
147 void CreatePath( const char *path );
148 void QCopyFile( const char *from, const char *to );
150 extern qboolean archive;
151 extern char archivedir[1024];
153 // sleep for the given amount of milliseconds
154 void Sys_Sleep(int n);
156 // for compression routines
160 int count, width, height;