CLHEP 2.0.4.7 Reference Documentation
CLHEP Home Page CLHEP Documentation CLHEP Bug Reports |
00001 // -*- C++ -*- 00002 // $Id: RandomFunc.h,v 1.4.4.1 2004/04/29 00:20:37 garren Exp $ 00003 // ----------------------------------------------------------------------- 00004 // HEP RandomFunc 00005 // get proper system headers for drand, etc. 00006 // ----------------------------------------------------------------------- 00007 00008 #ifndef RANDOMFUNC_H 00009 #define RANDOMFUNC_H 00010 00011 // Those function are available on all unix platform but their 00012 // prototypes are not included in stdlib when strict ANSI flag is set. 00013 // Such behaviour was noticed with "KCC --strict" and "g++ -ansi". 00014 // 00015 // To provide declaration of those functions on Linux g++ should be used 00016 // with -D_GNU_SOURCE. Similar options for non-Linux plaforms are: 00017 // _HPUX_SOURCE, _IRIX_SOURCE, but we prefer just explicitely declare 00018 // the functions on those platforms. 00019 // 00020 // drand48() extracted from GNU C Library 2.1.3 is used on Windows NT 00021 // and Macintosh (see drand48.src) 00022 00023 #if !defined(__GNUC__) 00024 extern "C" { 00025 extern double drand48(void); 00026 extern void srand48(long); 00027 extern unsigned short * seed48(unsigned short int [3]); 00028 } 00029 #else 00030 // only use stdlib.h if -D_GNU_SOURCE is present 00031 #if defined(_GNU_SOURCE) 00032 #include <stdlib.h> 00033 #else 00034 extern "C" { 00035 extern double drand48(void); 00036 extern void srand48(long); 00037 extern unsigned short * seed48(unsigned short int [3]); 00038 } 00039 #endif 00040 #endif 00041 00042 #include "CLHEP/Random/defs.h" 00043 00044 namespace CLHEP { 00045 00046 //#ifdef WIN32 00047 //#include "drand48.src" 00048 //#endif /* WIN32 */ 00049 00050 //#ifdef __APPLE__ 00051 //#include "drand48.src" 00052 //#endif /* __APPLE__ */ 00053 00054 // configure checks for drand48 00055 #ifndef HAVE_DRAND48 00056 #if !defined(__GNUC__) // IRIX gets confused 00057 #include "drand48.src" 00058 #endif 00059 #endif 00060 00061 } // namespace CLHEP 00062 00063 #ifdef ENABLE_BACKWARDS_COMPATIBILITY 00064 // backwards compatibility will be enabled ONLY in CLHEP 1.9 00065 using namespace CLHEP; 00066 #endif 00067 00068 #endif // RANDOMFUNC_H