l_cmd.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. /*
  2. ===========================================================================
  3. Copyright (C) 1999-2005 Id Software, Inc.
  4. This file is part of Quake III Arena source code.
  5. Quake III Arena source code is free software; you can redistribute it
  6. and/or modify it under the terms of the GNU General Public License as
  7. published by the Free Software Foundation; either version 2 of the License,
  8. or (at your option) any later version.
  9. Quake III Arena source code is distributed in the hope that it will be
  10. useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with Foobar; if not, write to the Free Software
  15. Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  16. ===========================================================================
  17. */
  18. // cmdlib.h
  19. #ifndef SIN
  20. #define SIN
  21. #endif //SIN
  22. #ifndef __CMDLIB__
  23. #define __CMDLIB__
  24. #ifdef _WIN32
  25. #pragma warning(disable : 4244) // MIPS
  26. #pragma warning(disable : 4136) // X86
  27. #pragma warning(disable : 4051) // ALPHA
  28. #pragma warning(disable : 4018) // signed/unsigned mismatch
  29. #pragma warning(disable : 4305) // truncate from double to float
  30. #endif
  31. #include <stdio.h>
  32. #include <string.h>
  33. #include <stdlib.h>
  34. #include <errno.h>
  35. #include <ctype.h>
  36. #include <time.h>
  37. #include <stdarg.h>
  38. #ifndef __BYTEBOOL__
  39. #define __BYTEBOOL__
  40. typedef enum {false, true} qboolean;
  41. typedef unsigned char byte;
  42. #endif
  43. // the dec offsetof macro doesnt work very well...
  44. #define myoffsetof(type,identifier) ((size_t)&((type *)0)->identifier)
  45. // set these before calling CheckParm
  46. extern int myargc;
  47. extern char **myargv;
  48. char *strupr (char *in);
  49. char *strlower (char *in);
  50. int Q_strncasecmp (char *s1, char *s2, int n);
  51. int Q_strcasecmp (char *s1, char *s2);
  52. void Q_getwd (char *out);
  53. int Q_filelength (FILE *f);
  54. int FileTime (char *path);
  55. void Q_mkdir (char *path);
  56. extern char qdir[1024];
  57. extern char gamedir[1024];
  58. void SetQdirFromPath (char *path);
  59. char *ExpandArg (char *path); // from cmd line
  60. char *ExpandPath (char *path); // from scripts
  61. char *ExpandPathAndArchive (char *path);
  62. double I_FloatTime (void);
  63. void Error(char *error, ...);
  64. void Warning(char *warning, ...);
  65. int CheckParm (char *check);
  66. FILE *SafeOpenWrite (char *filename);
  67. FILE *SafeOpenRead (char *filename);
  68. void SafeRead (FILE *f, void *buffer, int count);
  69. void SafeWrite (FILE *f, void *buffer, int count);
  70. int LoadFile (char *filename, void **bufferptr, int offset, int length);
  71. int TryLoadFile (char *filename, void **bufferptr);
  72. void SaveFile (char *filename, void *buffer, int count);
  73. qboolean FileExists (char *filename);
  74. void DefaultExtension (char *path, char *extension);
  75. void DefaultPath (char *path, char *basepath);
  76. void StripFilename (char *path);
  77. void StripExtension (char *path);
  78. void ExtractFilePath (char *path, char *dest);
  79. void ExtractFileBase (char *path, char *dest);
  80. void ExtractFileExtension (char *path, char *dest);
  81. int ParseNum (char *str);
  82. short BigShort (short l);
  83. short LittleShort (short l);
  84. int BigLong (int l);
  85. int LittleLong (int l);
  86. float BigFloat (float l);
  87. float LittleFloat (float l);
  88. #ifdef SIN
  89. unsigned short BigUnsignedShort (unsigned short l);
  90. unsigned short LittleUnsignedShort (unsigned short l);
  91. unsigned BigUnsigned (unsigned l);
  92. unsigned LittleUnsigned (unsigned l);
  93. #endif
  94. char *COM_Parse (char *data);
  95. extern char com_token[1024];
  96. extern qboolean com_eof;
  97. char *copystring(char *s);
  98. void CRC_Init(unsigned short *crcvalue);
  99. void CRC_ProcessByte(unsigned short *crcvalue, byte data);
  100. unsigned short CRC_Value(unsigned short crcvalue);
  101. void CreatePath (char *path);
  102. void QCopyFile (char *from, char *to);
  103. extern qboolean archive;
  104. extern char archivedir[1024];
  105. extern qboolean verbose;
  106. void qprintf (char *format, ...);
  107. void ExpandWildcards (int *argc, char ***argv);
  108. // for compression routines
  109. typedef struct
  110. {
  111. byte *data;
  112. int count;
  113. } cblock_t;
  114. #endif