Quake-III-Arena

Quake III Arena GPL Source Release
Log | Files | Refs

l_cmd.h (4101B)


      1 /*
      2 ===========================================================================
      3 Copyright (C) 1999-2005 Id Software, Inc.
      4 
      5 This file is part of Quake III Arena source code.
      6 
      7 Quake III Arena 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.
     11 
     12 Quake III Arena 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.
     16 
     17 You should have received a copy of the GNU General Public License
     18 along with Foobar; if not, write to the Free Software
     19 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
     20 ===========================================================================
     21 */
     22 // cmdlib.h
     23 
     24 #ifndef SIN
     25 #define SIN
     26 #endif //SIN
     27 
     28 #ifndef __CMDLIB__
     29 #define __CMDLIB__
     30 
     31 #ifdef _WIN32
     32 #pragma warning(disable : 4244)     // MIPS
     33 #pragma warning(disable : 4136)     // X86
     34 #pragma warning(disable : 4051)     // ALPHA
     35 
     36 #pragma warning(disable : 4018)     // signed/unsigned mismatch
     37 #pragma warning(disable : 4305)     // truncate from double to float
     38 #endif
     39 
     40 #include <stdio.h>
     41 #include <string.h>
     42 #include <stdlib.h>
     43 #include <errno.h>
     44 #include <ctype.h>
     45 #include <time.h>
     46 #include <stdarg.h>
     47 
     48 #ifndef __BYTEBOOL__
     49 #define __BYTEBOOL__
     50 typedef enum {false, true} qboolean;
     51 typedef unsigned char byte;
     52 #endif
     53 
     54 // the dec offsetof macro doesnt work very well...
     55 #define myoffsetof(type,identifier) ((size_t)&((type *)0)->identifier)
     56 
     57 
     58 // set these before calling CheckParm
     59 extern int myargc;
     60 extern char **myargv;
     61 
     62 char *strupr (char *in);
     63 char *strlower (char *in);
     64 int Q_strncasecmp (char *s1, char *s2, int n);
     65 int Q_strcasecmp (char *s1, char *s2);
     66 void Q_getwd (char *out);
     67 
     68 int Q_filelength (FILE *f);
     69 int	FileTime (char *path);
     70 
     71 void	Q_mkdir (char *path);
     72 
     73 extern	char		qdir[1024];
     74 extern	char		gamedir[1024];
     75 void SetQdirFromPath (char *path);
     76 char *ExpandArg (char *path);	// from cmd line
     77 char *ExpandPath (char *path);	// from scripts
     78 char *ExpandPathAndArchive (char *path);
     79 
     80 
     81 double I_FloatTime (void);
     82 
     83 void Error(char *error, ...);
     84 void Warning(char *warning, ...);
     85 
     86 int		CheckParm (char *check);
     87 
     88 FILE	*SafeOpenWrite (char *filename);
     89 FILE	*SafeOpenRead (char *filename);
     90 void	SafeRead (FILE *f, void *buffer, int count);
     91 void	SafeWrite (FILE *f, void *buffer, int count);
     92 
     93 int LoadFile (char *filename, void **bufferptr, int offset, int length);
     94 int TryLoadFile (char *filename, void **bufferptr);
     95 void SaveFile (char *filename, void *buffer, int count);
     96 qboolean	FileExists (char *filename);
     97 
     98 void 	DefaultExtension (char *path, char *extension);
     99 void 	DefaultPath (char *path, char *basepath);
    100 void 	StripFilename (char *path);
    101 void 	StripExtension (char *path);
    102 
    103 void 	ExtractFilePath (char *path, char *dest);
    104 void 	ExtractFileBase (char *path, char *dest);
    105 void	ExtractFileExtension (char *path, char *dest);
    106 
    107 int 	ParseNum (char *str);
    108 
    109 short	BigShort (short l);
    110 short	LittleShort (short l);
    111 int		BigLong (int l);
    112 int		LittleLong (int l);
    113 float	BigFloat (float l);
    114 float	LittleFloat (float l);
    115 
    116 #ifdef SIN
    117 unsigned short	BigUnsignedShort (unsigned short l);
    118 unsigned short	LittleUnsignedShort (unsigned short l);
    119 unsigned	      BigUnsigned (unsigned l);
    120 unsigned	      LittleUnsigned (unsigned l);
    121 #endif
    122 
    123 
    124 char *COM_Parse (char *data);
    125 
    126 extern	char		com_token[1024];
    127 extern	qboolean	com_eof;
    128 
    129 char *copystring(char *s);
    130 
    131 
    132 void CRC_Init(unsigned short *crcvalue);
    133 void CRC_ProcessByte(unsigned short *crcvalue, byte data);
    134 unsigned short CRC_Value(unsigned short crcvalue);
    135 
    136 void	CreatePath (char *path);
    137 void	QCopyFile (char *from, char *to);
    138 
    139 extern	qboolean		archive;
    140 extern	char			archivedir[1024];
    141 
    142 
    143 extern	qboolean verbose;
    144 void qprintf (char *format, ...);
    145 
    146 void ExpandWildcards (int *argc, char ***argv);
    147 
    148 
    149 // for compression routines
    150 typedef struct
    151 {
    152 	byte	*data;
    153 	int		count;
    154 } cblock_t;
    155 
    156 #endif
    157