Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

local.H

Go to the documentation of this file.
00001 /*
00002  * Copyright 2000, Brown University, Providence, RI.
00003  * 
00004  *                         All Rights Reserved
00005  * 
00006  * Permission to use, copy, modify, and distribute this software and its
00007  * documentation for any purpose other than its incorporation into a
00008  * commercial product is hereby granted without fee, provided that the
00009  * above copyright notice appear in all copies and that both that
00010  * copyright notice and this permission notice appear in supporting
00011  * documentation, and that the name of Brown University not be used in
00012  * advertising or publicity pertaining to distribution of the software
00013  * without specific, written prior permission.
00014  * 
00015  * BROWN UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
00016  * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR ANY
00017  * PARTICULAR PURPOSE.  IN NO EVENT SHALL BROWN UNIVERSITY BE LIABLE FOR
00018  * ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
00019  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
00020  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
00021  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
00022  */
00023 //
00024 //
00025 // jot configuration file
00026 //
00027 // XXX - At some point, this should be replaced by autoconf
00028 //
00029 #ifndef _STD_GLUE_LOCAL_H
00030 #define _STD_GLUE_LOCAL_H
00031 
00032 #define brcase    break; case
00033 #define brdefault break; default
00034 
00035 // Helpful debugging statement
00036 #define PRINT_VAR(v) cerr << # v << " = '" << v << "'" << endl
00037 
00038 #include "std/config.H"
00039 
00040 #ifdef WIN32
00041 #  include <float.h>
00042 #  include <windows.h>
00043 #  undef min
00044 #  undef max
00045 #  define strncasecmp _strnicmp
00046 #endif
00047 
00048 #if defined(WIN32) || (defined(__APPLE__) && _GNUC_ < 3)
00049 #ifdef __APPLE__
00050 #include <stdlib.h>
00051 #endif
00052    inline double drand48()          { return rand()/double(RAND_MAX); }
00053    inline void   srand48(long seed) { srand((unsigned int) seed); }
00054    inline long   lrand48()          { return rand(); }
00055 #endif
00056 
00057 #ifdef __CYGWIN__
00058    inline double drand48()                  { return random()/double(INT_MAX); }
00059 #endif
00060 
00061 template <class T>
00062 inline T sqr(const T x)                     { return x*x; }
00063  
00064 #if (!defined(__GNUC__) || (__GNUC__ < 3)) && (!defined(_MSC_VER) || (_MSC_VER < 1300))
00065 #ifndef _STANDARD_C_PLUS_PLUS
00066 template <class Type>
00067 inline Type min(const Type a, const Type b) { return a < b ? a : b; }
00068 
00069 template <class Type>
00070 inline Type max(const Type a, const Type b) { return a > b ? a : b; }
00071 #endif
00072 
00073 template <class Type>
00074 inline void swap(Type &a, Type &b)          { Type c(a); a = b; b = c; }
00075 #endif
00076 
00077 template <class Type>
00078 inline Type clamp(const Type a,const Type b,const Type c) 
00079                                         { return a > b ? (a < c ? a : c) : b ; }
00080 
00081 inline int  Sign (double a)             { return a > 0 ? 1 : a < 0 ? -1 : 0; }
00082 
00083 
00084 
00085 #endif

Generated on Mon Sep 15 16:25:56 2003 for gluebase by doxygen1.2.18