Main Page | Class Hierarchy | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

bg_lib.h

Go to the documentation of this file.
00001 /*
00002 ===========================================================================
00003 Copyright (C) 1999-2005 Id Software, Inc.
00004 
00005 This file is part of Quake III Arena source code.
00006 
00007 Quake III Arena source code is free software; you can redistribute it
00008 and/or modify it under the terms of the GNU General Public License as
00009 published by the Free Software Foundation; either version 2 of the License,
00010 or (at your option) any later version.
00011 
00012 Quake III Arena source code is distributed in the hope that it will be
00013 useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015 GNU General Public License for more details.
00016 
00017 You should have received a copy of the GNU General Public License
00018 along with Foobar; if not, write to the Free Software
00019 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00020 ===========================================================================
00021 */
00022 // bg_lib.h -- standard C library replacement routines used by code
00023 // compiled for the virtual machine
00024 
00025 // This file is NOT included on native builds
00026 
00027 typedef int size_t;
00028 
00029 typedef char *  va_list;
00030 #define _INTSIZEOF(n)   ( (sizeof(n) + sizeof(int) - 1) & ~(sizeof(int) - 1) )
00031 #define va_start(ap,v)  ( ap = (va_list)&v + _INTSIZEOF(v) )
00032 #define va_arg(ap,t)    ( *(t *)((ap += _INTSIZEOF(t)) - _INTSIZEOF(t)) )
00033 #define va_end(ap)      ( ap = (va_list)0 )
00034 
00035 #define CHAR_BIT      8         /* number of bits in a char */
00036 #define SCHAR_MIN   (-128)      /* minimum signed char value */
00037 #define SCHAR_MAX     127       /* maximum signed char value */
00038 #define UCHAR_MAX     0xff      /* maximum unsigned char value */
00039 
00040 #define SHRT_MIN    (-32768)        /* minimum (signed) short value */
00041 #define SHRT_MAX      32767         /* maximum (signed) short value */
00042 #define USHRT_MAX     0xffff        /* maximum unsigned short value */
00043 #define INT_MIN     (-2147483647 - 1) /* minimum (signed) int value */
00044 #define INT_MAX       2147483647    /* maximum (signed) int value */
00045 #define UINT_MAX      0xffffffff    /* maximum unsigned int value */
00046 #define LONG_MIN    (-2147483647L - 1) /* minimum (signed) long value */
00047 #define LONG_MAX      2147483647L   /* maximum (signed) long value */
00048 #define ULONG_MAX     0xffffffffUL  /* maximum unsigned long value */
00049 
00050 // Misc functions
00051 typedef int cmp_t(const void *, const void *);
00052 void qsort(void *a, size_t n, size_t es, cmp_t *cmp);
00053 void    srand( unsigned seed );
00054 int     rand( void );
00055 
00056 // String functions
00057 size_t strlen( const char *string );
00058 char *strcat( char *strDestination, const char *strSource );
00059 char *strcpy( char *strDestination, const char *strSource );
00060 int strcmp( const char *string1, const char *string2 );
00061 char *strchr( const char *string, int c );
00062 char *strstr( const char *string, const char *strCharSet );
00063 char *strncpy( char *strDest, const char *strSource, size_t count );
00064 int tolower( int c );
00065 int toupper( int c );
00066 
00067 double atof( const char *string );
00068 double _atof( const char **stringPtr );
00069 int atoi( const char *string );
00070 int _atoi( const char **stringPtr );
00071 
00072 int vsprintf( char *buffer, const char *fmt, va_list argptr );
00073 int sscanf( const char *buffer, const char *fmt, ... );
00074 
00075 // Memory functions
00076 void *memmove( void *dest, const void *src, size_t count );
00077 void *memset( void *dest, int c, size_t count );
00078 void *memcpy( void *dest, const void *src, size_t count );
00079 
00080 // Math functions
00081 double ceil( double x );
00082 double floor( double x );
00083 double sqrt( double x );
00084 double sin( double x );
00085 double cos( double x );
00086 double atan2( double y, double x );
00087 double tan( double x );
00088 int abs( int n );
00089 double fabs( double x );
00090 double acos( double x );
00091 

Generated on Thu Aug 25 12:37:30 2005 for Quake III Arena by  doxygen 1.3.9.1