2 ===========================================================================
3 Copyright (C) 1997-2006 Id Software, Inc.
5 This file is part of Quake 2 Tools source code.
7 Quake 2 Tools source code is free software; you can redistribute it
8 and/or modify it under the terms of the GNU General Public License as
9 published by the Free Software Foundation; either version 2 of the License,
10 or (at your option) any later version.
12 Quake 2 Tools source code is distributed in the hope that it will be
13 useful, 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 Quake 2 Tools source code; if not, write to the Free Software
19 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20 ===========================================================================
28 #if GDEF_COMPILER_MSVC
29 #pragma warning(disable : 4244) // MIPS
30 #pragma warning(disable : 4136) // X86
31 #pragma warning(disable : 4051) // ALPHA
33 #pragma warning(disable : 4018) // signed/unsigned mismatch
34 #pragma warning(disable : 4305) // truncate from double to float
47 typedef enum {false, true} qboolean;
48 typedef unsigned char byte;
51 // the dec offsetof macro doesnt work very well...
52 #define myoffsetof(type,identifier) ((size_t)&((type *)0)->identifier)
55 // set these before calling CheckParm
59 char *strupr (char *in);
60 char *strlower (char *in);
61 int Q_strncasecmp (char *s1, char *s2, int n);
62 int Q_strcasecmp (char *s1, char *s2);
63 void Q_getwd (char *out);
65 int Q_filelength (FILE *f);
66 int FileTime (char *path);
68 void Q_mkdir (char *path);
70 extern char qdir[1024];
71 extern char gamedir[1024];
72 void SetQdirFromPath (char *path);
73 char *ExpandArg (char *path); // from cmd line
74 char *ExpandPath (char *path); // from scripts
75 char *ExpandPathAndArchive (char *path);
78 double I_FloatTime (void);
80 void Error (char *error, ...);
81 int CheckParm (char *check);
83 FILE *SafeOpenWrite (char *filename);
84 FILE *SafeOpenRead (char *filename);
85 void SafeRead (FILE *f, void *buffer, int count);
86 void SafeWrite (FILE *f, void *buffer, int count);
88 int LoadFile (char *filename, void **bufferptr);
89 int TryLoadFile (char *filename, void **bufferptr);
90 void SaveFile (char *filename, void *buffer, int count);
91 qboolean FileExists (char *filename);
93 void DefaultExtension (char *path, char *extension);
94 void DefaultPath (char *path, char *basepath);
95 void StripFilename (char *path);
96 void StripExtension (char *path);
98 void ExtractFilePath (char *path, char *dest);
99 void ExtractFileBase (char *path, char *dest);
100 void ExtractFileExtension (char *path, char *dest);
102 int ParseNum (char *str);
104 short BigShort (short l);
105 short LittleShort (short l);
107 int LittleLong (int l);
108 float BigFloat (float l);
109 float LittleFloat (float l);
112 char *COM_Parse (char *data);
114 extern char com_token[1024];
115 extern qboolean com_eof;
117 char *copystring(char *s);
120 void CRC_Init(unsigned short *crcvalue);
121 void CRC_ProcessByte(unsigned short *crcvalue, byte data);
122 unsigned short CRC_Value(unsigned short crcvalue);
124 void CreatePath (char *path);
125 void QCopyFile (char *from, char *to);
127 extern qboolean archive;
128 extern char archivedir[1024];
131 extern qboolean verbose;
132 void qprintf (char *format, ...);
134 void ExpandWildcards (int *argc, char ***argv);
137 // for compression routines