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 // May be already defined with some compilers on Windows
61 char *strupr (char *start);
64 char *strlower (char *start);
65 int Q_strncasecmp (char *s1, char *s2, int n);
66 int Q_strcasecmp (char *s1, char *s2);
67 void Q_getwd (char *out);
69 int Q_filelength (FILE *f);
70 int FileTime (char *path);
72 void Q_mkdir (char *path);
74 extern char qdir[1024];
75 extern char gamedir[1024];
76 void SetQdirFromPath (char *path);
77 char *ExpandArg (char *path); // from cmd line
78 char *ExpandPath (char *path); // from scripts
79 char *ExpandPathAndArchive (char *path);
82 double I_FloatTime (void);
84 void Error (char *error, ...);
85 int CheckParm (char *check);
87 FILE *SafeOpenWrite (char *filename);
88 FILE *SafeOpenRead (char *filename);
89 void SafeRead (FILE *f, void *buffer, int count);
90 void SafeWrite (FILE *f, void *buffer, int count);
92 int LoadFile (char *filename, void **bufferptr);
93 int TryLoadFile (char *filename, void **bufferptr);
94 void SaveFile (char *filename, void *buffer, int count);
95 qboolean FileExists (char *filename);
97 void DefaultExtension (char *path, char *extension);
98 void DefaultPath (char *path, char *basepath);
99 void StripFilename (char *path);
100 void StripExtension (char *path);
102 void ExtractFilePath (char *path, char *dest);
103 void ExtractFileBase (char *path, char *dest);
104 void ExtractFileExtension (char *path, char *dest);
106 int ParseNum (char *str);
108 short BigShort (short l);
109 short LittleShort (short l);
111 int LittleLong (int l);
112 float BigFloat (float l);
113 float LittleFloat (float l);
116 char *COM_Parse (char *data);
118 extern char com_token[1024];
119 extern qboolean com_eof;
121 char *copystring(char *s);
124 void CRC_Init(unsigned short *crcvalue);
125 void CRC_ProcessByte(unsigned short *crcvalue, byte data);
126 unsigned short CRC_Value(unsigned short crcvalue);
128 void CreatePath (char *path);
129 void QCopyFile (char *from, char *to);
131 extern qboolean archive;
132 extern char archivedir[1024];
135 extern qboolean verbose;
136 void qprintf (char *format, ...);
138 void ExpandWildcards (int *argc, char ***argv);
141 // for compression routines