| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
#if !defined( BG_LIB_H ) && defined( Q3_VM ) |
| 27 |
#define BG_LIB_H |
| 28 |
|
| 29 |
#ifndef NULL |
| 30 |
#define NULL ((void *)0) |
| 31 |
#endif |
| 32 |
|
| 33 |
typedef unsigned int size_t; |
| 34 |
|
| 35 |
typedef char * va_list; |
| 36 |
#define _INTSIZEOF(n) ( (sizeof(n) + sizeof(int) - 1) & ~(sizeof(int) - 1) ) |
| 37 |
#define va_start(ap,v) ( ap = (va_list)&v + _INTSIZEOF(v) ) |
| 38 |
#define va_arg(ap,t) ( *(t *)((ap += _INTSIZEOF(t)) - _INTSIZEOF(t)) ) |
| 39 |
#define va_end(ap) ( ap = (va_list)0 ) |
| 40 |
|
| 41 |
#define CHAR_BIT 8 |
| 42 |
#define SCHAR_MAX 0x7f |
| 43 |
#define SCHAR_MIN (-SCHAR_MAX - 1) |
| 44 |
#define UCHAR_MAX 0xff |
| 45 |
|
| 46 |
#define SHRT_MAX 0x7fff |
| 47 |
#define SHRT_MIN (-SHRT_MAX - 1) |
| 48 |
#define USHRT_MAX 0xffff |
| 49 |
#define INT_MAX 0x7fffffff |
| 50 |
#define INT_MIN (-INT_MAX - 1) |
| 51 |
#define UINT_MAX 0xffffffff |
| 52 |
#define LONG_MAX 0x7fffffffL |
| 53 |
#define LONG_MIN (-LONG_MAX - 1) |
| 54 |
#define ULONG_MAX 0xffffffffUL |
| 55 |
|
| 56 |
#define isalnum(c) (isalpha(c) || isdigit(c)) |
| 57 |
#define isalpha(c) (isupper(c) || islower(c)) |
| 58 |
#define isascii(c) ((c) > 0 && (c) <= 0x7f) |
| 59 |
#define iscntrl(c) (((c) >= 0) && (((c) <= 0x1f) || ((c) == 0x7f))) |
| 60 |
#define isdigit(c) ((c) >= '0' && (c) <= '9') |
| 61 |
#define isgraph(c) ((c) != ' ' && isprint(c)) |
| 62 |
#define islower(c) ((c) >= 'a' && (c) <= 'z') |
| 63 |
#define isprint(c) ((c) >= ' ' && (c) <= '~') |
| 64 |
#define ispunct(c) (((c) > ' ' && (c) <= '~') && !isalnum(c)) |
| 65 |
#define isspace(c) ((c) == ' ' || (c) == '\f' || (c) == '\n' || (c) == '\r' || \ |
| 66 |
(c) == '\t' || (c) == '\v') |
| 67 |
#define isupper(c) ((c) >= 'A' && (c) <= 'Z') |
| 68 |
#define isxdigit(c) (isxupper(c) || isxlower(c)) |
| 69 |
#define isxlower(c) (isdigit(c) || (c >= 'a' && c <= 'f')) |
| 70 |
#define isxupper(c) (isdigit(c) || (c >= 'A' && c <= 'F')) |
| 71 |
|
| 72 |
|
| 73 |
typedef int cmp_t(const void *, const void *); |
| 74 |
void qsort(void *a, size_t n, size_t es, cmp_t *cmp); |
| 75 |
void srand( unsigned seed ); |
| 76 |
int rand( void ); |
| 77 |
|
| 78 |
|
| 79 |
size_t strlen( const char *string ); |
| 80 |
char *strcat( char *strDestination, const char *strSource ); |
| 81 |
char *strcpy( char *strDestination, const char *strSource ); |
| 82 |
int strcmp( const char *string1, const char *string2 ); |
| 83 |
char *strchr( const char *string, int c ); |
| 84 |
char *strrchr(const char *string, int c); |
| 85 |
char *strstr( const char *string, const char *strCharSet ); |
| 86 |
char *strncpy( char *strDest, const char *strSource, size_t count ); |
| 87 |
int tolower( int c ); |
| 88 |
int toupper( int c ); |
| 89 |
|
| 90 |
double atof( const char *string ); |
| 91 |
double _atof( const char **stringPtr ); |
| 92 |
double strtod( const char *nptr, char **endptr ); |
| 93 |
int atoi( const char *string ); |
| 94 |
int _atoi( const char **stringPtr ); |
| 95 |
long strtol( const char *nptr, char **endptr, int base ); |
| 96 |
|
| 97 |
int Q_vsnprintf( char *buffer, size_t length, const char *fmt, va_list argptr ) Q_PRINTF_FUNC(3, 0); |
| 98 |
|
| 99 |
int sscanf( const char *buffer, const char *fmt, ... ) Q_SCANF_FUNC(2, 3); |
| 100 |
|
| 101 |
|
| 102 |
void *memmove( void *dest, const void *src, size_t count ); |
| 103 |
void *memset( void *dest, int c, size_t count ); |
| 104 |
void *memcpy( void *dest, const void *src, size_t count ); |
| 105 |
|
| 106 |
|
| 107 |
double ceil( double x ); |
| 108 |
double floor( double x ); |
| 109 |
double sqrt( double x ); |
| 110 |
double sin( double x ); |
| 111 |
double cos( double x ); |
| 112 |
double atan2( double y, double x ); |
| 113 |
double tan( double x ); |
| 114 |
int abs( int n ); |
| 115 |
double fabs( double x ); |
| 116 |
double acos( double x ); |
| 117 |
|
| 118 |
#endif |