diff options
Diffstat (limited to 'src/game')
-rw-r--r-- | src/game/bg_lib.c | 27 | ||||
-rw-r--r-- | src/game/bg_lib.h | 18 |
2 files changed, 20 insertions, 25 deletions
diff --git a/src/game/bg_lib.c b/src/game/bg_lib.c index 8594db44..b007d256 100644 --- a/src/game/bg_lib.c +++ b/src/game/bg_lib.c @@ -25,6 +25,8 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA // compiled for the virtual machine +#ifdef Q3_VM + #include "../qcommon/q_shared.h" /*- @@ -70,10 +72,6 @@ static const char rcsid[] = "$Id$"; #endif /* LIBC_SCCS and not lint */ -#if !defined( Q3_VM ) -typedef int cmp_t(const void *, const void *); -#endif - static char* med3(char *, char *, char *, cmp_t *); static void swapfunc(char *, char *, int, int); @@ -214,10 +212,6 @@ loop: SWAPINIT(a, es); //================================================================================== -// this file is excluded from release builds because of intrinsics - -#if defined ( Q3_VM ) - size_t strlen( const char *string ) { const char *s; @@ -318,10 +312,6 @@ char *strstr( const char *string, const char *strCharSet ) return (char *)0; } -#endif - -#if defined ( Q3_VM ) - int tolower( int c ) { if( c >= 'A' && c <= 'Z' ) @@ -339,8 +329,6 @@ int toupper( int c ) return c; } -#endif - void *memmove( void *dest, const void *src, size_t count ) { int i; @@ -813,7 +801,6 @@ double atan2( double y, double x ) { #endif -#ifdef Q3_VM /* =============== rint @@ -1311,8 +1298,6 @@ float pow( float x, float y ) return s * z; } -#endif - static int randSeed = 0; @@ -1484,8 +1469,6 @@ double _atof( const char **stringPtr ) } -#if defined ( Q3_VM ) - int atoi( const char *string ) { int sign; @@ -1941,11 +1924,7 @@ reswitch: case 'f': AddFloat( &buf_p, *(double *)arg, width, prec ); -#ifdef Q3_VM - arg += 1; // everything is 32 bit in my compiler -#else - arg += 2; -#endif + arg += 1; // everything is 32 bit break; case 's': diff --git a/src/game/bg_lib.h b/src/game/bg_lib.h index 021ebc39..2289af18 100644 --- a/src/game/bg_lib.h +++ b/src/game/bg_lib.h @@ -25,7 +25,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA // compiled for the virtual machine // This file is NOT included on native builds -#ifndef BG_LIB_H +#if !defined( BG_LIB_H ) && defined( Q3_VM ) #define BG_LIB_H #ifndef NULL @@ -55,6 +55,22 @@ typedef char * va_list; #define LONG_MAX 2147483647L /* maximum (signed) long value */ #define ULONG_MAX 0xffffffffUL /* maximum unsigned long value */ +#define isalnum(c) (isalpha(c) || isdigit(c)) +#define isalpha(c) (isupper(c) || islower(c)) +#define isascii(c) ((c) > 0 && (c) <= 0x7f) +#define iscntrl(c) (((c) >= 0) && (((c) <= 0x1f) || ((c) == 0x7f))) +#define isdigit(c) ((c) >= '0' && (c) <= '9') +#define isgraph(c) ((c) != ' ' && isprint(c) +#define islower(c) ((c) >= 'a' && (c) <= 'z') +#define isprint(c) ((c) >= ' ' && (c) <= '~') +#define ispunct(c) (((c) > ' ' && (c) <= '~') && !isalnum(c)) +#define isspace(c) ((c) == ' ' || (c) == '\f' || (c) == '\n' || (c) == '\r' || \ + (c) == '\t' || (c) == '\v') +#define isupper(c) ((c) >= 'A' && (c) <= 'Z') +#define isxdigit(c) (isxupper(c) || isxlower(c)) +#define isxlower(c) (isdigit(c) || (c >= 'a' && c <= 'f')) +#define isxupper(c) (isdigit(c) || (c >= 'A' && c <= 'F')) + // Misc functions typedef int cmp_t( const void *, const void * ); void qsort( void *a, size_t n, size_t es, cmp_t *cmp ); |