Salome HOME
Corrected implementation of MESSAGE functionality on Windows
[modules/kernel.git] / src / SALOMELocalTrace / utilities.h
index 28696612bdf078508c8c8960eba9a7006c525632..c20c835a06c1fe7c841f9a495f56c25246c6db27 100644 (file)
@@ -17,7 +17,7 @@
 //  License along with this library; if not, write to the Free Software 
 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
 // 
-//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 //
 //
@@ -31,7 +31,6 @@
 #ifndef UTILITIES_H
 #define UTILITIES_H
 
-#include <strstream>
 #include <iostream>
 #include <sstream>
 #include <cstdlib>
 
 #define MESS_INIT(deb) std::ostringstream os; os<<deb
 #define MESS_BEGIN(deb) MESS_INIT(deb)<<__FILE__ <<" ["<<__LINE__<<"] : "
-#define MESS_END endl; LocalTraceBufferPool::instance()->insert(NORMAL_MESS, os.str().c_str());
-#define MESS_ABORT endl; LocalTraceBufferPool::instance()->insert(ABORT_MESS, os.str().c_str());
+#define MESS_END std::endl; LocalTraceBufferPool::instance()->insert(NORMAL_MESS, os.str().c_str());
+#define MESS_ABORT std::endl; LocalTraceBufferPool::instance()->insert(ABORT_MESS, os.str().c_str());
 
 // --- Some macros are always defined (without _DEBUG_): for use with release version
 
 #define INFOS(msg) {MESS_BEGIN("- Trace ") << msg << MESS_END}
 #define PYSCRIPT(msg) {MESS_INIT("---PYSCRIPT--- ") << msg << MESS_END}
 #define INTERRUPTION(msg) {MESS_BEGIN("- INTERRUPTION: ")<< msg << MESS_ABORT}
-#define IMMEDIATE_ABORT(code) {cout <<std::flush; \
-                               cerr << "- ABORT " << __FILE__ << " [" <<__LINE__<< "] : " << flush; \
-                               cerr << "ABORT return code= "<< code << endl; \
+#ifdef WNT
+#define IMMEDIATE_ABORT(code) {std::cout <<std::flush; \
+                               std::cerr << "- ABORT " << __FILE__ << " [" <<__LINE__<< "] : " << flush; \
+                               std::cerr << "ABORT return code= "<< code << std::endl; \
+                               /*std::*/exit(code);}
+#else
+#define IMMEDIATE_ABORT(code) {std::cout <<std::flush; \
+                               std::cerr << "- ABORT " << __FILE__ << " [" <<__LINE__<< "] : " << flush; \
+                               std::cerr << "ABORT return code= "<< code << std::endl; \
                                std::exit(code);}
+#endif
 
 /* --- To print date and time of compilation of current source --- */
 
 #error INFOS_COMPILATION already defined
 #endif
 
+#if defined(_DEBUG_) || defined(_DEBUG)
+
+// --- the following MACROS are useful at debug time
+
 #define INFOS_COMPILATION { MESS_BEGIN("COMPILED with ") << COMPILER \
                                       << ", " << __DATE__ \
                                       << " at " << __TIME__ << MESS_END }
-#ifdef _DEBUG_
-
-// --- the following MACROS are useful at debug time
 
 #define MESSAGE(msg) {MESS_BEGIN("- Trace ") << msg << MESS_END}
 #define SCRUTE(var)  {MESS_BEGIN("- Trace ") << #var << "=" << var <<MESS_END}
 
 #else /* ifdef _DEBUG_*/
 
+#define INFOS_COMPILATION
 #define MESSAGE(msg) {}
 #define SCRUTE(var) {}
 #define REPERE