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<<std::endl<<std::ends);}
41 #define PYSCRIPT(msg) {SLog.putMessage(SLog<<"---PYSCRIPT--- "<<msg<<std::endl<<std::ends);}
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"
54 #define COMPILER "undefined"
57 #ifdef INFOS_COMPILATION
58 #error INFOS_COMPILATION already defined
61 #define INFOS_COMPILATION { \
63 SLog<<__FILE__<<" ["<< __LINE__<<"] : "\
64 << "COMPILED with " << COMPILER \
66 << " at " << __TIME__ <<std::endl<<std::ends); }
70 /* --- the following MACROS are useful at debug time --- */
72 #define MYTRACE SLog<<"- Trace "<<__FILE__<<" ["<<__LINE__<<"] : "
74 #define MESSAGE(msg) {SLog.putMessage(MYTRACE<<msg<<std::endl<<std::ends);}
75 #define SCRUTE(var) {SLog.putMessage(MYTRACE<<#var<<"="<<var<<std::endl<<std::ends);}
77 #define BEGIN_OF(msg) {SLog.putMessage(MYTRACE<<"Begin of: "<<msg<<"\n\n"<<std::ends);}
78 #define END_OF(msg) {SLog.putMessage(SLog<<"\n"<<std::ends); \
79 SLog.putMessage(MYTRACE<<"Normal end of: "<<msg<<"\n"<<std::ends);}
81 #define HERE {std::cout<<std::flush ;std::cerr<<"- Trace "<<__FILE__<<" ["<<__LINE__<<"] : "<<std::flush;}
83 #define INTERRUPTION(code) {HERE; \
84 cerr<<"INTERRUPTION return code= "<<code<<std::endl; \
88 #define ASSERT(condition) \
91 std::cerr<<"CONDITION "<<#condition<<" NOT VERIFIED"<<std::endl; \
98 #else /* ifdef _DEBUG_*/
101 #define SCRUTE(var) {}
102 #define MESSAGE(msg) {}
103 #define BEGIN_OF(msg) {}
104 #define END_OF(msg) {}
106 #define INTERRUPTION(code) {}
109 #define ASSERT(condition) {}
113 #endif /* ifdef _DEBUG_*/
115 #endif /* ifndef UTILITIES_H */