11 #pragma warning( disable : 4127 )
17 #define UNUSED __attribute__ ((unused))
22 # define INT16_MAX 32767
25 # define INT16_MIN (-INT16_MAX - 1)
28 #if SHRT_MAX == INT16_MAX
29 typedef short int int16;
30 #elif INT_MAX == INT16_MAX
33 # error failed to define int16, please report this to gary@pa.uky.edu
37 # define UINT16_MAX 65535
40 #if USHRT_MAX == UINT16_MAX
41 typedef unsigned short int uint16;
42 #elif UINT_MAX == UINT16_MAX
43 typedef unsigned int uint16;
45 # error failed to define uint16, please report this to gary@pa.uky.edu
49 # define INT32_MAX 2147483647L
52 # define INT32_MIN (-INT32_MAX - 1)
55 #if INT_MAX == INT32_MAX
57 #elif LONG_MAX == INT32_MAX
58 typedef long int int32;
60 # error failed to define int32, please report this to gary@pa.uky.edu
64 # define UINT32_MAX 4294967295UL
67 #if UINT_MAX == UINT32_MAX
68 typedef unsigned int uint32;
69 #elif ULONG_MAX == UINT32_MAX
70 typedef unsigned long int uint32;
72 # error failed to define uint32, please report this to gary@pa.uky.edu
75 #if LONG_MAX > INT32_MAX
84 # define INT64_MAX 9223372036854775807L
87 # define INT64_MIN (-INT64_MAX - 1L)
89 # if LONG_MAX == INT64_MAX
91 typedef long int int64;
92 # define INT64_LIT(X) X##L
97 #if defined(HAVE_LONG_LONG) && !defined(HAVE_INT64)
100 # if LLONG_MAX > INT32_MAX
103 # define INT64_MAX 9223372036854775807LL
106 # define INT64_MIN (-INT64_MAX - 1LL)
108 # if LLONG_MAX == INT64_MAX
109 # define HAVE_INT64 1
110 typedef long long int int64;
111 # define INT64_LIT(X) X##LL
118 #if ULONG_MAX > UINT32_MAX
121 # define UINT64_MAX 18446744073709551615UL
123 # if ULONG_MAX == UINT64_MAX
124 # define HAVE_UINT64 1
125 typedef unsigned long int uint64;
126 # define UINT64_LIT(X) X##UL
131 #if defined(HAVE_LONG_LONG) && !defined(HAVE_UINT64)
134 # if ULLONG_MAX > UINT32_MAX
137 # define UINT64_MAX 18446744073709551615ULL
139 # if ULLONG_MAX == UINT64_MAX
140 # define HAVE_UINT64 1
141 typedef unsigned long long int uint64;
142 # define UINT64_LIT(X) X##ULL
193 #if defined(_ARCH_PPC) || defined(__POWERPC__) || defined(__powerpc__) || defined(PPC)
204 #if defined(unix) || defined(__unix__)
211 #if defined(linux) || defined(__linux)
226 #if defined(__GNUC__) && ! ( defined(__ICC) || defined(__PATHSCALE__) || defined(__OPENCC__) || defined(__clang__) )
227 #define __GNUC_EXCL__ 1
234 # define __func__ __FUNCTION__
236 # define __func__ DEBUG_ENTRY.name()
267 const ios_base::openmode
mode_r = ios_base::in;
268 const ios_base::openmode
mode_w = ios_base::out | ios_base::trunc;
269 const ios_base::openmode
mode_a = ios_base::out | ios_base::app;
270 const ios_base::openmode
mode_rp = ios_base::in | ios_base::out;
271 const ios_base::openmode
mode_wp = ios_base::in | ios_base::out | ios_base::trunc;
272 const ios_base::openmode
mode_ap = ios_base::in | ios_base::out | ios_base::app;
286 void check_data(
const char* fpath,
const char* fname );
311 struct sigaction p_action;
312 struct sigaction p_default;
361 const struct sigaction* action()
const {
return &p_action; }
362 const struct sigaction* deflt()
const {
return &p_default; }
373 sigaction( SIGABRT, deflt(), NULL );
375 sigaction( SIGABRT, action(), NULL );
379 signal( SIGABRT, SIG_DFL );
406 friend void open_data( fstream& stream,
const char* fname, ios_base::openmode mode,
access_scheme scheme );
408 friend void check_data(
const char* fpath,
const char* fname );
412 friend void set_NaN(
double &x);
413 friend void set_NaN(
double x[],
long n);
451 #define NORETURN __declspec(noreturn)
452 #elif defined(__GNUC__) || ( defined(__INTEL_COMPILER) && defined(__linux__) )
453 #define NORETURN __attribute__ ((noreturn))
458 #define FALLTHROUGH (void)0
462 #define FALLTHROUGH __attribute__ ((fallthrough))
467 #define ALIGNED(X) __declspec(align(X))
469 #define ALIGNED(X) __attribute__ ((aligned(X)))
473 #define UNLIKELY(x) (x)
477 #define UNLIKELY(x) __builtin_expect((x),0)
480 #define RESTRICT __restrict
488 #define DO_EXPAND(VAL) VAL ## 1
489 #define EXPAND(VAL) DO_EXPAND(VAL)
494 #if defined __INTEL_COMPILER
495 # define __COMP "icc"
496 # define __COMP_VER __INTEL_COMPILER
500 #elif defined __PATHSCALE__
501 # define __COMP "pathCC"
502 # define __COMP_VER __PATHCC__ * 100 + __PATHCC_MINOR__ * 10 + __PATHCC_PATCHLEVEL__
506 #elif defined __OPENCC__
507 # define __COMP "Open64"
508 # if EXPAND(__OPENCC_PATCHLEVEL__) == 1
509 # define __COMP_VER __OPENCC__ * 100 + __OPENCC_MINOR__ * 10
511 # define __COMP_VER __OPENCC__ * 100 + __OPENCC_MINOR__ * 10 + __OPENCC_PATCHLEVEL__
516 #elif defined __clang__
517 # define __COMP "clang++"
518 # define __COMP_VER __clang_major__ * 100 + __clang_minor__ * 10 + __clang_patchlevel__
521 #elif defined __GNUC__
522 # define __COMP "g++"
523 # if defined(__GNUC_PATCHLEVEL__)
524 # define __COMP_VER (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
526 # define __COMP_VER (__GNUC__ * 10000 + __GNUC_MINOR__ * 100)
530 # define __COMP "Portland Group"
531 # if defined(__PGIC__)
532 # define __COMP_VER (__PGIC__ * 100 + __PGIC_MINOR__ * 10 + __PGIC_PATCHLEVEL__)
534 # define __COMP_VER 0
539 #elif defined(__sgi) && defined(_COMPILER_VERSION)
540 # define __COMP "MIPSpro"
541 # define __COMP_VER _COMPILER_VERSION
544 #elif defined __HP_aCC
545 # define __COMP "HP aCC"
546 # define __COMP_VER __HP_aCC
550 # define __COMP "DEC CC"
551 # define __COMP_VER __DECC_VER
554 #elif defined _MSC_VER
556 # define __COMP_VER _MSC_VER
559 #elif defined __SUNPRO_CC
560 # define __COMP "Solaris Studio"
561 # define __COMP_VER __SUNPRO_CC
565 # define __COMP "unknown"
566 # define __COMP_VER 0
571 #if defined __linux__
573 # define __OS "Linux (IA32)"
574 # elif defined __amd64
575 # define __OS "Linux (AMD64)"
576 # elif defined __ia64
577 # define __OS "Linux (IA64)"
578 # elif defined __ppc__
579 # define __OS "Linux (PowerPC)"
581 # define __OS "Linux (other)"
585 #elif defined macintosh
586 # define __OS "Mac OS 9"
589 #elif defined __MACOSX__
590 # define __OS "Mac OS X"
593 #elif defined __APPLE__
594 # define __OS "Apple MacOS"
598 # define __OS "HP-UX"
602 # define __OS "Solaris"
610 # define __OS "Ultrix"
613 #elif defined __FreeBSD__
614 # define __OS "FreeBSD"
616 #elif defined __NetBSD__
617 # define __OS "NetBSD"
619 #elif defined __OpenBSD__
620 # define __OS "OpenBSD"
625 # define __OS "Win64"
629 # define __OS "Win32"
632 #elif defined __CYGWIN__
633 # define __OS "Cygwin"
641 # define __OS "unknown"
647 # if defined(__GNUC_EXCL__) && ((__GNUC__ == 2 && __GNUC_MINOR__ == 96) || (__GNUC__ == 3 && __GNUC_MINOR__ == 4))
648 # error "This g++ version cannot compile Cloudy and must not be used! Please update g++ to a functional version. See http://wiki.nublado.org/wiki/CompileCode for more details."
651 # if __INTEL_COMPILER >= 1200 && __INTEL_COMPILER < 1300
652 # error "This icc version cannot compile Cloudy and must not be used! Please use a functional version of icc, or g++. See http://wiki.nublado.org/wiki/CompileCode for more details."
657 #pragma warning( default : 4127 )
const ios_base::openmode mode_wp
map< string, string > md5sum_expct
FILE * open_data(const char *fname, const char *mode, access_scheme scheme)
void set_used_nCPU(long n)
static void signal_handler(int sig)
bool p_lgMPISingleRankMode
void set_NaN(sys_float &x)
friend void set_NaN(sys_float &x)
int32 Double_SNaN_Value[2]
void getPathList(const char *fname, vector< string > &PathList, access_scheme scheme, bool lgRead) const
const ios_base::openmode UNUSED mode_wb
void setAssertAbort(bool val)
const ios_base::openmode UNUSED mode_rpb
bool MyIsnan(const sys_float &x)
double min_double() const
void getMD5sums(const char *fname)
bool little_endian() const
bool lgAssertAbort() const
friend FILE * open_data(const char *fname, const char *mode, access_scheme scheme)
const ios_base::openmode mode_a
const ios_base::openmode mode_r
void printDataPath() const
const ios_base::openmode UNUSED mode_wpb
vector< string > p_exit_status
const ios_base::openmode mode_ap
const ios_base::openmode UNUSED mode_rb
const ios_base::openmode mode_w
bool foundMD5Mismatch() const
void check_data(const char *fpath, const char *fname)
sys_float min_float() const
void set_signal_handlers()
const ios_base::openmode UNUSED mode_ab
void set_MPISingleRankMode(bool mode)
const ios_base::openmode UNUSED mode_apb
void enable_traps() const
vector< string > chSearchPath
const ios_base::openmode mode_rp
char chDirSeparator() const
bool lgMPISingleRankMode() const
const char * host_name() const
friend void check_data(const char *fpath, const char *fname)
const string & chExitStatus(exit_type s) const