Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:54:38

0001 // -*- C++ -*-
0002 // $Id: RandomFunc.h,v 1.6 2010/06/16 17:24:53 garren Exp $
0003 // -----------------------------------------------------------------------
0004 //                             HEP RandomFunc
0005 //                      get proper system headers for drand, etc.
0006 // -----------------------------------------------------------------------
0007 
0008 #ifndef RANDOMFUNC_H
0009 #define RANDOMFUNC_H
0010 
0011 // Those function are available on all unix platform but their
0012 // prototypes are not included in stdlib when strict ANSI flag is set.
0013 // Such behaviour was noticed with "KCC --strict" and "g++ -ansi".
0014 //
0015 // To provide declaration of those functions on Linux g++ should be used
0016 // with -D_GNU_SOURCE. Similar options for non-Linux plaforms are: 
0017 // _HPUX_SOURCE, _IRIX_SOURCE, but we prefer just explicitely declare
0018 // the functions on those platforms.
0019 //
0020 // drand48() extracted from GNU C Library 2.1.3 is used on Windows NT
0021 // and Macintosh (see drand48.src)
0022   
0023 #if !defined(__GNUC__)
0024 extern "C" {
0025   extern double drand48(void);
0026   extern void   srand48(long);
0027   extern unsigned short * seed48(unsigned short int [3]);
0028 }
0029 #else
0030 // only use stdlib.h if -D_GNU_SOURCE is present
0031 #if defined(_GNU_SOURCE)
0032 #include <stdlib.h>
0033 #else
0034 extern "C" {
0035   extern double drand48(void);
0036   extern void   srand48(long);
0037   extern unsigned short * seed48(unsigned short int [3]);
0038 }
0039 #endif
0040 #endif
0041 
0042 #include "CLHEP/Random/defs.h"
0043 
0044 namespace CLHEP {
0045 
0046 //#ifdef WIN32
0047 //#include "drand48.src"
0048 //#endif  /* WIN32 */
0049 
0050 //#ifdef __APPLE__ 
0051 //#include "drand48.src"
0052 //#endif  /* __APPLE__ */
0053 
0054 // configure checks for drand48
0055 #ifndef HAVE_DRAND48
0056 #if !defined(__GNUC__)  // IRIX gets confused
0057 #include "drand48.src"
0058 #endif
0059 #endif
0060 
0061 }  // namespace CLHEP
0062 
0063 #ifdef ENABLE_BACKWARDS_COMPATIBILITY
0064 //  backwards compatibility will be enabled ONLY in CLHEP 1.9
0065 using namespace CLHEP;
0066 #endif
0067 
0068 #endif  // RANDOMFUNC_H