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