Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 # ifndef UTILITIES_H
00013 # define UTILITIES_H
00014
00015 # include <stdlib.h>
00016
00017 # include <iostream>
00018
00019
00020
00021 # define HEREWEARE cout<<flush ; cerr << __FILE__ << " [" << __LINE__ << "] : " << flush ;
00022 # define INFOS(chain) {HEREWEARE ; cerr << chain << endl ;}
00023 # define PYSCRIPT(chain) {cout<<flush ; cerr << "---PYSCRIPT--- " << chain << endl ;}
00024
00025
00026
00027 # if defined ( __GNUC__ )
00028 # define COMPILER "g++" ;
00029 # elif defined ( __sun )
00030 # define COMPILER "CC" ;
00031 # elif defined ( __KCC )
00032 # define COMPILER "KCC" ;
00033 # elif defined ( __PGI )
00034 # define COMPILER "pgCC" ;
00035 # else
00036 # define COMPILER "undefined" ;
00037 # endif
00038
00039 # ifdef INFOS_COMPILATION
00040 # error INFOS_COMPILATION already defined
00041 # endif
00042 # define INFOS_COMPILATION {\
00043 cerr << flush;\
00044 cout << __FILE__ ;\
00045 cout << " [" << __LINE__ << "] : " ;\
00046 cout << "COMPILED with " << COMPILER ;\
00047 cout << ", " << __DATE__ ; \
00048 cout << " at " << __TIME__ << endl ;\
00049 cout << "\n\n" ;\
00050 cout << flush ;\
00051 }
00052
00053 # ifdef _DEBUG_
00054
00055
00056
00057 # define HERE cout<<flush ; cerr << "- Trace " << __FILE__ << " [" << __LINE__ << "] : " << flush ;
00058 # define SCRUTE(var) HERE ; cerr << #var << "=" << var << endl ;
00059 # define MESSAGE(chain) {HERE ; cerr << chain << endl ;}
00060 # define INTERRUPTION(code) HERE ; cerr << "INTERRUPTION return code= " << code << endl ; exit(code) ;
00061
00062 # ifndef ASSERT
00063 # define ASSERT(condition) if (!(condition)){ HERE ; cerr << "CONDITION " << #condition << " NOT VERIFIED"<< endl ; INTERRUPTION(1) ;}
00064 # endif
00065
00066 #define REPERE cout<<flush ; cerr << " --------------" << endl << flush ;
00067 #define BEGIN_OF(chain) {REPERE ; HERE ; cerr << "Begin of: " << chain << endl ; REPERE ; }
00068 #define END_OF(chain) {REPERE ; HERE ; cerr << "Normal end of: " << chain << endl ; REPERE ; }
00069
00070
00071
00072 # else
00073
00074 # define HERE
00075 # define SCRUTE(var)
00076 # define MESSAGE(chain)
00077 # define INTERRUPTION(code)
00078
00079 # ifndef ASSERT
00080 # define ASSERT(condition)
00081 # endif
00082
00083 #define REPERE
00084 #define BEGIN_OF(chain)
00085 #define END_OF(chain)
00086
00087
00088 # endif
00089
00090 # endif