| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
#ifndef __CMDLIB__ |
| 25 |
#define __CMDLIB__ |
| 26 |
|
| 27 |
#if GDEF_COMPILER_MSVC |
| 28 |
#pragma warning(disable : 4244) // MIPS |
| 29 |
#pragma warning(disable : 4136) // X86 |
| 30 |
#pragma warning(disable : 4051) // ALPHA |
| 31 |
|
| 32 |
#pragma warning(disable : 4018) // signed/unsigned mismatch |
| 33 |
#pragma warning(disable : 4305) // truncate from double to float |
| 34 |
|
| 35 |
#pragma check_stack(off) |
| 36 |
|
| 37 |
#endif |
| 38 |
|
| 39 |
#include <stdio.h> |
| 40 |
#include <string.h> |
| 41 |
#include <stdlib.h> |
| 42 |
#include <errno.h> |
| 43 |
#include <ctype.h> |
| 44 |
#include <time.h> |
| 45 |
#include <stdarg.h> |
| 46 |
|
| 47 |
#if GDEF_COMPILER_MSVC |
| 48 |
|
| 49 |
#pragma intrinsic( memset, memcpy ) |
| 50 |
|
| 51 |
#endif |
| 52 |
|
| 53 |
#ifndef __BYTEBOOL__ |
| 54 |
#define __BYTEBOOL__ |
| 55 |
|
| 56 |
|
| 57 |
#include "q_typedef.h" |
| 58 |
#endif |
| 59 |
|
| 60 |
#ifdef PATH_MAX |
| 61 |
#define MAX_OS_PATH PATH_MAX |
| 62 |
#else |
| 63 |
#define MAX_OS_PATH 1024 |
| 64 |
#endif |
| 65 |
#define MEM_BLOCKSIZE 4096 |
| 66 |
|
| 67 |
|
| 68 |
|
| 69 |
|
| 70 |
|
| 71 |
|
| 72 |
|
| 73 |
|
| 74 |
#define myoffsetof( type,identifier ) ( (size_t)& ( (type *)0 )->identifier ) |
| 75 |
|
| 76 |
void *safe_malloc( size_t size ); |
| 77 |
void *safe_malloc_info( size_t size, char* info ); |
| 78 |
|
| 79 |
|
| 80 |
extern int myargc; |
| 81 |
extern char **myargv; |
| 82 |
|
| 83 |
|
| 84 |
#ifndef strupr |
| 85 |
char *strupr (char *start); |
| 86 |
#endif |
| 87 |
|
| 88 |
char *strlower( char *start ); |
| 89 |
int Q_strncasecmp( const char *s1, const char *s2, int n ); |
| 90 |
int Q_stricmp( const char *s1, const char *s2 ); |
| 91 |
int Q_strcasecmp( const char *s1, const char *s2 ); |
| 92 |
void Q_getwd( char *out ); |
| 93 |
|
| 94 |
int Q_filelength( FILE *f ); |
| 95 |
int FileTime( const char *path ); |
| 96 |
|
| 97 |
void Q_mkdir( const char *path ); |
| 98 |
|
| 99 |
extern char qdir[1024]; |
| 100 |
extern char gamedir[1024]; |
| 101 |
extern char writedir[1024]; |
| 102 |
extern char *moddirparam; |
| 103 |
void SetQdirFromPath( const char *path ); |
| 104 |
char *ExpandArg( const char *path ); |
| 105 |
char *ExpandPath( const char *path ); |
| 106 |
char *ExpandGamePath( const char *path ); |
| 107 |
char *ExpandPathAndArchive( const char *path ); |
| 108 |
void ExpandWildcards( int *argc, char ***argv ); |
| 109 |
|
| 110 |
|
| 111 |
double I_FloatTime( void ); |
| 112 |
|
| 113 |
int CheckParm( const char *check ); |
| 114 |
|
| 115 |
void *SafeMalloc( size_t n, char *desc ); |
| 116 |
FILE *SafeOpenWrite( const char *filename ); |
| 117 |
FILE *SafeOpenRead( const char *filename ); |
| 118 |
void SafeRead( FILE *f, void *buffer, int count ); |
| 119 |
void SafeWrite( FILE *f, const void *buffer, int count ); |
| 120 |
|
| 121 |
int LoadFile( const char *filename, void **bufferptr ); |
| 122 |
int LoadFileBlock( const char *filename, void **bufferptr ); |
| 123 |
int TryLoadFile( const char *filename, void **bufferptr ); |
| 124 |
void SaveFile( const char *filename, const void *buffer, int count ); |
| 125 |
qboolean FileExists( const char *filename ); |
| 126 |
|
| 127 |
void DefaultExtension( char *path, const char *extension ); |
| 128 |
void DefaultPath( char *path, const char *basepath ); |
| 129 |
void StripFilename( char *path ); |
| 130 |
void StripExtension( char *path ); |
| 131 |
|
| 132 |
void ExtractFilePath( const char *path, char *dest ); |
| 133 |
void ExtractFileBase( const char *path, char *dest ); |
| 134 |
void ExtractFileExtension( const char *path, char *dest ); |
| 135 |
|
| 136 |
int ParseNum( const char *str ); |
| 137 |
|
| 138 |
|
| 139 |
|
| 140 |
|
| 141 |
|
| 142 |
short BigShort( short l ); |
| 143 |
short LittleShort( short l ); |
| 144 |
int BigLong( int l ); |
| 145 |
int LittleLong( int l ); |
| 146 |
float BigFloat( float l ); |
| 147 |
float LittleFloat( float l ); |
| 148 |
|
| 149 |
|
| 150 |
char *COM_Parse( char *data ); |
| 151 |
|
| 152 |
extern char com_token[1024]; |
| 153 |
extern qboolean com_eof; |
| 154 |
|
| 155 |
char *copystring( const char *s ); |
| 156 |
|
| 157 |
|
| 158 |
void CRC_Init( unsigned short *crcvalue ); |
| 159 |
void CRC_ProcessByte( unsigned short *crcvalue, byte data ); |
| 160 |
unsigned short CRC_Value( unsigned short crcvalue ); |
| 161 |
|
| 162 |
void CreatePath( const char *path ); |
| 163 |
void QCopyFile( const char *from, const char *to ); |
| 164 |
|
| 165 |
extern qboolean archive; |
| 166 |
extern char archivedir[1024]; |
| 167 |
|
| 168 |
extern qboolean g_dokeypress; |
| 169 |
|
| 170 |
|
| 171 |
void Sys_Sleep( int n ); |
| 172 |
|
| 173 |
|
| 174 |
typedef struct |
| 175 |
{ |
| 176 |
byte *data; |
| 177 |
int count; |
| 178 |
} cblock_t; |
| 179 |
|
| 180 |
|
| 181 |
#endif |