Salome HOME
PR: mergefrom_PRAS_br3_06Nov04
[modules/kernel.git] / src / Utils / utilities.h
index 015e84e58f0fd9263c47337d1e5ebad366078980..066e25d24b42dfaebc371f5b374c9cda5114ceaa 100644 (file)
@@ -37,8 +37,8 @@
 
 /* ---  INFOS is always defined (without _DEBUG_): to be used for warnings, with release version --- */
 
-#define INFOS(msg)    {SLog.putMessage(SLog<<__FILE__<<" ["<<__LINE__<<"] : "<<msg<<endl);}
-#define PYSCRIPT(msg) {SLog.putMessage(SLog<<"---PYSCRIPT--- "<<msg<<endl);}
+#define INFOS(msg)    {SLog.putMessage(SLog<<__FILE__<<" ["<<__LINE__<<"] : "<<msg<<std::endl<<std::ends);}
+#define PYSCRIPT(msg) {SLog.putMessage(SLog<<"---PYSCRIPT--- "<<msg<<std::endl<<std::ends);}
 
 /* --- To print date and time of compilation of current source --- */
 
                                           SLog<<__FILE__<<" ["<< __LINE__<<"] : "\
                                           << "COMPILED with " << COMPILER \
                                           << ", " << __DATE__ \
-                                          << " at " << __TIME__ <<endl); }
+                                          << " at " << __TIME__ <<std::endl<<std::ends); }
 
 #ifdef _DEBUG_
 
 /* --- the following MACROS are useful at debug time --- */
 
-#define MYTRACE SLog << "- Trace " << __FILE__ << " [" << __LINE__ << "] : " 
+#define MYTRACE SLog<<"- Trace "<<__FILE__<<" ["<<__LINE__<<"] : " 
 
-#define MESSAGE(msg) {SLog.putMessage( MYTRACE <<msg<<endl<<ends); }
-#define SCRUTE(var)  {SLog.putMessage( MYTRACE << #var << "=" << var <<endl<<ends); }
+#define MESSAGE(msg) {SLog.putMessage(MYTRACE<<msg<<std::endl<<std::ends);}
+#define SCRUTE(var)  {SLog.putMessage(MYTRACE<<#var<<"="<<var<<std::endl<<std::ends);}
 
-#define REPERE SLog << "   --------------" << endl 
-#define BEGIN_OF(msg) {REPERE;MYTRACE<<"Begin of: "     <<msg<<endl;REPERE;} 
-#define END_OF(msg)   {REPERE;MYTRACE<<"Normal end of: "<<msg<<endl;REPERE;} 
+#define BEGIN_OF(msg) {SLog.putMessage(MYTRACE<<"Begin of: "<<msg<<"\n\n"<<std::ends);} 
+#define END_OF(msg)   {SLog.putMessage(SLog<<"\n"<<std::ends); \
+                       SLog.putMessage(MYTRACE<<"Normal end of: "<<msg<<"\n"<<std::ends);}
 
-#define HERE {cout<<flush ;cerr<<"- Trace "<<__FILE__<<" ["<<__LINE__<<"] : "<<flush ;}
+#define HERE {std::cout<<std::flush ;std::cerr<<"- Trace "<<__FILE__<<" ["<<__LINE__<<"] : "<<std::flush;}
 
-#define INTERRUPTION(code) {HERE;cerr<<"INTERRUPTION return code= "<<code<< endl;exit(code);}
+#define INTERRUPTION(code) {HERE; \
+                            cerr<<"INTERRUPTION return code= "<<code<<std::endl; \
+                            std::exit(code);}
 
 #ifndef ASSERT
 #define ASSERT(condition) \
-        if (!(condition)){HERE;cerr<<"CONDITION "<<#condition<<" NOT VERIFIED"<<endl;INTERRUPTION(1);}
+        if(!(condition)){ \
+          HERE; \
+          std::cerr<<"CONDITION "<<#condition<<" NOT VERIFIED"<<std::endl; \
+          INTERRUPTION(1); \
+        }
+
 #endif /* ASSERT */
 
 
 #define HERE 
 #define SCRUTE(var) {}
 #define MESSAGE(msg) {}
-#define REPERE
 #define BEGIN_OF(msg) {}
 #define END_OF(msg) {}