#include <signal.h>
#include <float.h>
+static Standard_Boolean fCtrlBrk;
+#if !defined(__CYGWIN32__) && !defined(__MINGW32__)
static Standard_Boolean fMsgBox;
static Standard_Boolean fFltExceptions;
static Standard_Boolean fDbgLoaded;
-static Standard_Boolean fCtrlBrk;
// used to forbid simultaneous execution of setting / executing handlers
static Standard_Mutex THE_SIGNAL_MUTEX;
ptrdiff_t ExceptionInformation1,
ptrdiff_t ExceptionInformation0)
{
-
-#if !defined(__CYGWIN32__) && !defined(__MINGW32__)
-
Standard_Mutex::Sentry aSentry (THE_SIGNAL_MUTEX); // lock the mutex to prevent simultaneous handling
static char buffer[ 2048 ];
int flterr = 0;
// cout << "OSD::WntHandler _controlfp( 0, _OSD_FPX ) " << hex << _controlfp(0,0) << dec << endl ;
}
return _osd_raise ( dwExceptionCode, buffer );
-#else
- return 0;
-#endif
}
//=======================================================================
//=======================================================================
static void SIGWntHandler (int signum, int sub_code)
{
-#if !defined(__CYGWIN32__) && !defined(__MINGW32__)
Standard_Mutex::Sentry aSentry (THE_SIGNAL_MUTEX); // lock the mutex to prevent simultaneous handling
switch( signum ) {
case SIGFPE :
break ;
}
DebugBreak ();
-#endif
}
+#endif
//=======================================================================
//function : TranslateSE
// option and unless user sets his own exception handler with
// ::SetUnhandledExceptionFilter().
//=======================================================================
+#if !defined(__CYGWIN32__) && !defined(__MINGW32__)
static LONG WINAPI WntHandler (EXCEPTION_POINTERS *lpXP)
{
DWORD dwExceptionCode = lpXP->ExceptionRecord->ExceptionCode;
lpXP->ExceptionRecord->ExceptionInformation[1],
lpXP->ExceptionRecord->ExceptionInformation[0]);
}
+#endif
//=======================================================================
//function : SetSignal
}
} // end OSD :: ControlBreak
+#if !defined(__MINGW32__) && !defined(__CYGWIN32__)
//============================================================================
//==== _osd_ctrl_break_handler
//============================================================================
//============================================================================
//==== _osd_debug
//============================================================================
-#if defined(__CYGWIN32__) || defined(__MINGW32__)
-#define __try
-#define __finally
-#define __leave return 0
-#endif
-
LONG _osd_debug ( void ) {
LONG action ;
return action ;
} // end _osd_debug
-
-#if defined(__CYGWIN32__) || defined(__MINGW32__)
-#undef __try
-#undef __finally
-#undef __leave
#endif
#else
#if defined(_MSC_VER) || defined(__ANDROID__) || defined(__QNX__)
#include <malloc.h>
-#elif (defined(__GNUC__) && __GNUC__ >= 4 && __GNUC_MINOR__ >= 1 && defined(__i386))
+#elif (defined(__GNUC__) && __GNUC__ >= 4 && __GNUC_MINOR__ >= 1 && (defined(__i386) || defined(__x86_64)))
#include <mm_malloc.h>
#else
extern "C" int posix_memalign (void** thePtr, size_t theAlign, size_t theSize);
return _aligned_malloc (theSize, theAlign);
#elif defined(__ANDROID__) || defined(__QNX__)
return memalign (theAlign, theSize);
-#elif (defined(__GNUC__) && __GNUC__ >= 4 && __GNUC_MINOR__ >= 1 && defined(__i386))
+#elif (defined(__GNUC__) && __GNUC__ >= 4 && __GNUC_MINOR__ >= 1 && (defined(__i386) || defined(__x86_64)))
return _mm_malloc (theSize, theAlign);
#else
void* aPtr;
_aligned_free (thePtrAligned);
#elif defined(__ANDROID__) || defined(__QNX__)
free (thePtrAligned);
-#elif (defined(__GNUC__) && __GNUC__ >= 4 && __GNUC_MINOR__ >= 1 && defined(__i386))
+#elif (defined(__GNUC__) && __GNUC__ >= 4 && __GNUC_MINOR__ >= 1 && (defined(__i386) || defined(__x86_64)))
_mm_free (thePtrAligned);
#else
free (thePtrAligned);