R:/projects/actioncube/_svn/trunk/ac/source/src/tools.h File Reference

This graph shows which files directly or indirectly include this file:


Classes

struct  s_sprintf_f
struct  databuf< T >
struct  vector< T >
struct  hashtable< K, T >
struct  hashtable< K, T >::chain
struct  hashtable< K, T >::chainchunk
struct  ringbuf< T, SIZE >

Defines

#define NULL   0
#define DEBUG(v)   {}
#define DEBUGVAR(v)   {}
#define ASSERT(c)   if(c) {}
#define clamp(a, b, c)   (max(b, min(a, c)))
#define rnd(max)   (rand()%(max))
#define detrnd(s, x)   ((int)(((((uint)(s))*1103515245+12345)>>16)%(x)))
#define loop(v, m)   for(int v = 0; v<int(m); v++)
#define loopi(m)   loop(i,m)
#define loopj(m)   loop(j,m)
#define loopk(m)   loop(k,m)
#define loopl(m)   loop(l,m)
#define DELETEP(p)   if(p) { delete p; p = 0; }
#define DELETEA(p)   if(p) { delete[] p; p = 0; }
#define PI   (3.1415927f)
#define PI2   (2*PI)
#define SQRT2   (1.4142136f)
#define SQRT3   (1.7320508f)
#define RAD   (PI / 180.0f)
#define __cdecl
#define _vsnprintf   vsnprintf
#define PATHDIV   '/'
#define _MAXDEFSTR   260
#define s_sprintf(d)   s_sprintf_f((char *)d)
#define s_sprintfd(d)   string d; s_sprintf(d)
#define s_sprintfdlv(d, last, fmt)   string d; { va_list ap; va_start(ap, last); formatstring(d, fmt, ap); va_end(ap); }
#define s_sprintfdv(d, fmt)   s_sprintfdlv(d,fmt,fmt)
#define loopv(v)   if(false) {} else for(int i = 0; i<(v).length(); i++)
#define loopvj(v)   if(false) {} else for(int j = 0; j<(v).length(); j++)
#define loopvk(v)   if(false) {} else for(int k = 0; k<(v).length(); k++)
#define loopvrev(v)   if(false) {} else for(int i = (v).length()-1; i>=0; i--)
#define loopvjrev(v)   if(false) {} else for(int j = (v).length()-1; i>=0; i--)
#define HTFIND(success, fail)
#define itoa(s, i)   sprintf(s, "%d", i)
#define ftoa(s, f)   sprintf(s, (f) == int(f) ? "%.1f" : "%.7g", f)
#define enumeratekt(ht, k, e, t, f, b)   loopi((ht).size) for(hashtable<k,t>::chain *enumc = (ht).table[i]; enumc;) { hashtable<k,t>::const_key &e = enumc->key; t &f = enumc->data; enumc = enumc->next; b; }
#define enumerate(ht, t, e, b)   loopi((ht).size) for((ht).enumc = (ht).table[i]; (ht).enumc;) { t &e = (ht).enumc->data; (ht).enumc = (ht).enumc->next; b; }

Typedefs

typedef unsigned char uchar
typedef unsigned short ushort
typedef unsigned int uint
typedef char string [_MAXDEFSTR]
typedef databuf< char > charbuf
typedef databuf< uchar > ucharbuf
typedef vector< char * > cvector
typedef vector< int > ivector
typedef vector< ushort > usvector

Functions

template<class T >
static void swap (T &a, T &b)
template<class T >
static T max (T a, T b)
template<class T >
static T min (T a, T b)
static float round (float x)
void formatstring (char *d, const char *fmt, va_list v)
char * s_strncpy (char *d, const char *s, size_t m)
char * s_strcpy (char *d, const char *s)
char * s_strcat (char *d, const char *s)
static uint hthash (const char *key)
static bool htcmp (const char *x, const char *y)
static uint hthash (int key)
static bool htcmp (int x, int y)
static uint hthash (uint key)
static bool htcmp (uint x, uint y)
char * newstring (size_t l)
char * newstring (const char *s, size_t l)
char * newstring (const char *s)
char * newstringbuf ()
char * newstringbuf (const char *s)
char * path (char *s)
char * path (const char *s, bool copy)
const char * behindpath (const char *s)
const char * parentdir (const char *directory)
bool fileexists (const char *path, const char *mode)
bool createdir (const char *path)
void sethomedir (const char *dir)
void addpackagedir (const char *dir)
const char * findfile (const char *filename, const char *mode)
int getfilesize (const char *filename)
FILE * openfile (const char *filename, const char *mode)
gzFile opengzfile (const char *filename, const char *mode)
char * loadfile (const char *fn, int *size, const char *mode=NULL)
bool listdir (const char *dir, const char *ext, vector< char * > &files)
int listfiles (const char *dir, const char *ext, vector< char * > &files)
bool delfile (const char *path)
bool cmpb (void *b, int n, enet_uint32 c)
bool cmpf (char *fn, enet_uint32 c)
void endianswap (void *, int, int)
bool isbigendian ()

Define Documentation

#define __cdecl

#define _MAXDEFSTR   260

#define _vsnprintf   vsnprintf

#define ASSERT ( c   )     if(c) {}

#define clamp ( a,
b,
c   )     (max(b, min(a, c)))

#define DEBUG ( v   )     {}

#define DEBUGVAR ( v   )     {}

#define DELETEA ( p   )     if(p) { delete[] p; p = 0; }

#define DELETEP ( p   )     if(p) { delete p; p = 0; }

#define detrnd ( s,
x   )     ((int)(((((uint)(s))*1103515245+12345)>>16)%(x)))

#define enumerate ( ht,
t,
e,
b   )     loopi((ht).size) for((ht).enumc = (ht).table[i]; (ht).enumc;) { t &e = (ht).enumc->data; (ht).enumc = (ht).enumc->next; b; }

#define enumeratekt ( ht,
k,
e,
t,
f,
b   )     loopi((ht).size) for(hashtable<k,t>::chain *enumc = (ht).table[i]; enumc;) { hashtable<k,t>::const_key &e = enumc->key; t &f = enumc->data; enumc = enumc->next; b; }

#define ftoa ( s,
f   )     sprintf(s, (f) == int(f) ? "%.1f" : "%.7g", f)

#define HTFIND ( success,
fail   ) 

Value:

uint h = hthash(key)&(size-1); \
        for(chain *c = table[h]; c; c = c->next) \
        { \
            if(htcmp(key, c->key)) return (success); \
        } \
        return (fail);

#define itoa ( s,
i   )     sprintf(s, "%d", i)

#define loop ( v,
m   )     for(int v = 0; v<int(m); v++)

#define loopi ( m   )     loop(i,m)

#define loopj ( m   )     loop(j,m)

#define loopk ( m   )     loop(k,m)

#define loopl ( m   )     loop(l,m)

#define loopv ( v   )     if(false) {} else for(int i = 0; i<(v).length(); i++)

#define loopvj ( v   )     if(false) {} else for(int j = 0; j<(v).length(); j++)

#define loopvjrev ( v   )     if(false) {} else for(int j = (v).length()-1; i>=0; i--)

#define loopvk ( v   )     if(false) {} else for(int k = 0; k<(v).length(); k++)

#define loopvrev ( v   )     if(false) {} else for(int i = (v).length()-1; i>=0; i--)

#define NULL   0

#define PATHDIV   '/'

#define PI   (3.1415927f)

#define PI2   (2*PI)

#define RAD   (PI / 180.0f)

#define rnd ( max   )     (rand()%(max))

#define s_sprintf ( d   )     s_sprintf_f((char *)d)

#define s_sprintfd ( d   )     string d; s_sprintf(d)

#define s_sprintfdlv ( d,
last,
fmt   )     string d; { va_list ap; va_start(ap, last); formatstring(d, fmt, ap); va_end(ap); }

#define s_sprintfdv ( d,
fmt   )     s_sprintfdlv(d,fmt,fmt)

#define SQRT2   (1.4142136f)

#define SQRT3   (1.7320508f)


Typedef Documentation

typedef databuf<char> charbuf

typedef vector<char *> cvector

typedef vector<int> ivector

typedef char string[_MAXDEFSTR]

typedef unsigned char uchar

typedef unsigned int uint

typedef unsigned short ushort


Function Documentation

void addpackagedir ( const char *  dir  ) 

const char* behindpath ( const char *  s  ) 

bool cmpb ( void *  b,
int  n,
enet_uint32  c 
)

bool cmpf ( char *  fn,
enet_uint32  c 
)

bool createdir ( const char *  path  ) 

bool delfile ( const char *  path  ) 

void endianswap ( void *  ,
int  ,
int   
)

bool fileexists ( const char *  path,
const char *  mode 
)

const char* findfile ( const char *  filename,
const char *  mode 
)

void formatstring ( char *  d,
const char *  fmt,
va_list  v 
) [inline]

int getfilesize ( const char *  filename  ) 

static bool htcmp ( uint  x,
uint  y 
) [inline, static]

static bool htcmp ( int  x,
int  y 
) [inline, static]

static bool htcmp ( const char *  x,
const char *  y 
) [inline, static]

static uint hthash ( uint  key  )  [inline, static]

static uint hthash ( int  key  )  [inline, static]

static uint hthash ( const char *  key  )  [inline, static]

bool isbigendian (  ) 

bool listdir ( const char *  dir,
const char *  ext,
vector< char * > &  files 
)

int listfiles ( const char *  dir,
const char *  ext,
vector< char * > &  files 
)

char* loadfile ( const char *  fn,
int *  size,
const char *  mode = NULL 
)

template<class T >
static T max ( T  a,
T  b 
) [inline, static]

template<class T >
static T min ( T  a,
T  b 
) [inline, static]

char* newstring ( const char *  s  )  [inline]

char* newstring ( const char *  s,
size_t  l 
) [inline]

char* newstring ( size_t  l  )  [inline]

char* newstringbuf ( const char *  s  )  [inline]

char* newstringbuf (  )  [inline]

FILE* openfile ( const char *  filename,
const char *  mode 
)

gzFile opengzfile ( const char *  filename,
const char *  mode 
)

const char* parentdir ( const char *  directory  ) 

char* path ( const char *  s,
bool  copy 
)

char* path ( char *  s  ) 

static float round ( float  x  )  [inline, static]

char* s_strcat ( char *  d,
const char *  s 
) [inline]

char* s_strcpy ( char *  d,
const char *  s 
) [inline]

char* s_strncpy ( char *  d,
const char *  s,
size_t  m 
) [inline]

void sethomedir ( const char *  dir  ) 

template<class T >
static void swap ( T &  a,
T &  b 
) [inline, static]


Generated on Mon Dec 8 21:41:33 2008 for AssaultCube by  doxygen 1.5.7.1