1 // SALOME Utils : general SALOME's definitions and tools
3 // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
25 // Author : Antoine YESSAYAN, Paul RASCLE, EDF
29 /* --- Definition macros file to print informations if _DEBUG_ is defined --- */
36 #include "SALOME_Log.hxx"
38 /* --- INFOS is always defined (without _DEBUG_): to be used for warnings, with release version --- */
40 #define INFOS(msg) {SLog->putMessage(*SLog<<__FILE__<<" ["<<__LINE__<<"] : "<<msg<<endl);}
41 #define PYSCRIPT(msg) {SLog->putMessage(*SLog<<"---PYSCRIPT--- "<<msg<<endl);}
43 /* --- To print date and time of compilation of current source --- */
45 #if defined ( __GNUC__ )
46 #define COMPILER "g++"
47 #elif defined ( __sun )
49 #elif defined ( __KCC )
50 #define COMPILER "KCC"
51 #elif defined ( __PGI )
52 #define COMPILER "pgCC"
53 #elif defined ( __alpha )
54 #define COMPILER "cxx"
56 #define COMPILER "undefined"
59 #ifdef INFOS_COMPILATION
60 #error INFOS_COMPILATION already defined
63 #define INFOS_COMPILATION { \
65 *SLog<<__FILE__<<" ["<< __LINE__<<"] : "\
66 << "COMPILED with " << COMPILER \
68 << " at " << __TIME__ <<endl); }
72 /* --- the following MACROS are useful at debug time --- */
74 #define MYTRACE *SLog << "- Trace " << __FILE__ << " [" << __LINE__ << "] : "
76 #define MESSAGE(msg) {SLog->putMessage( MYTRACE <<msg<<endl<<ends); }
77 #define SCRUTE(var) {SLog->putMessage( MYTRACE << #var << "=" << var <<endl<<ends); }
79 #define REPERE *SLog << " --------------" << endl
80 #define BEGIN_OF(msg) {REPERE;MYTRACE<<"Begin of: " <<msg<<endl;REPERE;}
81 #define END_OF(msg) {REPERE;MYTRACE<<"Normal end of: "<<msg<<endl;REPERE;}
83 #define HERE {cout<<flush ;cerr<<"- Trace "<<__FILE__<<" ["<<__LINE__<<"] : "<<flush ;}
85 #define INTERRUPTION(code) {HERE;cerr<<"INTERRUPTION return code= "<<code<< endl;exit(code);}
88 #define ASSERT(condition) \
89 if (!(condition)){HERE;cerr<<"CONDITION "<<#condition<<" NOT VERIFIED"<<endl;INTERRUPTION(1);}
93 #else /* ifdef _DEBUG_*/
96 #define SCRUTE(var) {}
97 #define MESSAGE(msg) {}
99 #define BEGIN_OF(msg) {}
100 #define END_OF(msg) {}
102 #define INTERRUPTION(code) {}
105 #define ASSERT(condition) {}
109 #endif /* ifdef _DEBUG_*/
111 #endif /* ifndef UTILITIES_H */