mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-04 13:13:25 +03:00
0022972: Eliminate macro definitions that has compiler-provided analogs (WNT and so on)
1) Macro definition WNT replaced by _WIN32 and _MSC_VER for platform and compiler detection accordingly. 2) Macro definition LIN replaced by __linux__ macro. 3) Macro definition DEB replaced by OCCT_DEBUG macro.
This commit is contained in:
@@ -68,7 +68,7 @@ Standard_Boolean OSD::CStringToReal(const Standard_CString aString,
|
||||
//purpose : Cause the process to sleep during a amount of seconds
|
||||
//=======================================================================
|
||||
|
||||
#ifdef WNT
|
||||
#ifdef _WIN32
|
||||
# include <Windows.h>
|
||||
#if !defined(__CYGWIN32__) && !defined(__MINGW32__)
|
||||
//# include <Mapiwin.h>
|
||||
@@ -214,7 +214,7 @@ Standard_Integer OSD::AvailableMemory()
|
||||
# define SIZE_MAX 0x7fffffff
|
||||
# elif defined(__osf__) || defined(DECOSF1)
|
||||
# define SIZE_MAX 0x10000000000
|
||||
# elif defined(WNT)
|
||||
# elif defined(_WIN32)
|
||||
# define SIZE_MAX 0x7ffdefff
|
||||
# else
|
||||
# define SIZE_MAX 0xffffffff
|
||||
|
@@ -19,7 +19,7 @@
|
||||
#include <Standard_Stream.hxx>
|
||||
|
||||
// ====================== PLATFORM-SPECIFIC PART ========================
|
||||
#ifndef WNT
|
||||
#ifndef _WIN32
|
||||
|
||||
//---------- Systemes autres que WNT : ----------------------------------
|
||||
|
||||
@@ -57,7 +57,7 @@
|
||||
//=======================================================================
|
||||
void OSD_Chronometer::GetProcessCPU (Standard_Real& UserSeconds, Standard_Real& SystemSeconds)
|
||||
{
|
||||
#if defined(LIN) || defined(linux) || defined(__FreeBSD__) || defined(__ANDROID__)
|
||||
#if defined(__linux__) || defined(linux) || defined(__FreeBSD__) || defined(__ANDROID__)
|
||||
static const long aCLK_TCK = sysconf(_SC_CLK_TCK);
|
||||
#else
|
||||
static const long aCLK_TCK = CLK_TCK;
|
||||
@@ -154,7 +154,7 @@ void OSD_Chronometer::GetThreadCPU (Standard_Real& UserSeconds, Standard_Real& S
|
||||
SystemSeconds = 0.0000001 * EncodeFILETIME (&ftKernel);
|
||||
}
|
||||
|
||||
#endif /* WNT */
|
||||
#endif /* _WIN32 */
|
||||
|
||||
// ====================== PLATFORM-INDEPENDENT PART ========================
|
||||
|
||||
|
@@ -12,7 +12,7 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef WNT
|
||||
#ifndef _WIN32
|
||||
|
||||
|
||||
#include <OSD_Directory.hxx>
|
||||
|
@@ -12,7 +12,7 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef WNT
|
||||
#ifndef _WIN32
|
||||
|
||||
|
||||
#include <OSD_Directory.hxx>
|
||||
|
@@ -12,7 +12,7 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef WNT
|
||||
#ifndef _WIN32
|
||||
|
||||
|
||||
#include <OSD_Environment.hxx>
|
||||
|
@@ -12,7 +12,7 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef WNT
|
||||
#ifndef _WIN32
|
||||
|
||||
|
||||
#include <OSD_Error.hxx>
|
||||
|
@@ -12,7 +12,7 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef WNT
|
||||
#ifndef _WIN32
|
||||
|
||||
|
||||
#include <OSD_File.hxx>
|
||||
|
@@ -12,7 +12,7 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef WNT
|
||||
#ifndef _WIN32
|
||||
|
||||
|
||||
#include <OSD_Host.hxx>
|
||||
|
@@ -15,7 +15,7 @@
|
||||
|
||||
#include <OSD_MAllocHook.hxx>
|
||||
|
||||
#ifndef WNT
|
||||
#ifndef _MSC_VER
|
||||
#if !defined __STDC_LIMIT_MACROS
|
||||
#define __STDC_LIMIT_MACROS
|
||||
#endif
|
||||
@@ -82,7 +82,7 @@ OSD_MAllocHook::CollectBySize* OSD_MAllocHook::GetCollectBySize()
|
||||
// Platform-dependent methods
|
||||
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
|
||||
#ifdef WNT
|
||||
#ifdef _MSC_VER
|
||||
#include <crtdbg.h>
|
||||
|
||||
#if _MSC_VER >= 1500 /* VS 2008 */
|
||||
@@ -174,7 +174,7 @@ void OSD_MAllocHook::SetCallback(Callback* theCB)
|
||||
_CrtSetAllocHook(MyAllocHook);
|
||||
}
|
||||
|
||||
#else // ! WNT
|
||||
#else // ! _MSC_VER
|
||||
|
||||
// Not yet implemented for non-WNT platform
|
||||
|
||||
@@ -183,7 +183,7 @@ void OSD_MAllocHook::SetCallback(Callback* theCB)
|
||||
MypCurrentCallback = theCB;
|
||||
}
|
||||
|
||||
#endif // WNT
|
||||
#endif // _MSC_VER
|
||||
|
||||
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
// LogFileHandler handler methods
|
||||
|
@@ -18,7 +18,7 @@
|
||||
|
||||
// Platform-dependent definition of the thread handle type
|
||||
|
||||
#ifdef WNT
|
||||
#ifdef _WIN32
|
||||
|
||||
#include <windows.h>
|
||||
typedef HANDLE OSD_PThread;
|
||||
|
@@ -43,7 +43,7 @@ static OSD_SysType whereAmI(){
|
||||
#elif defined(vax) || defined(__vms)
|
||||
return OSD_VMS;
|
||||
}
|
||||
#elif defined(__linux__) || defined(LIN)
|
||||
#elif defined(__linux__) || defined(__linux)
|
||||
return OSD_LinuxREDHAT;
|
||||
}
|
||||
#elif defined(_AIX) || defined(AIX)
|
||||
|
@@ -12,7 +12,7 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef WNT
|
||||
#ifndef _WIN32
|
||||
|
||||
|
||||
#include <OSD_OSDError.hxx>
|
||||
|
@@ -12,7 +12,7 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef WNT
|
||||
#ifndef _WIN32
|
||||
|
||||
|
||||
#include <OSD_Environment.hxx>
|
||||
|
@@ -12,7 +12,7 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef WNT
|
||||
#ifndef _WIN32
|
||||
|
||||
|
||||
#include <OSD_Directory.hxx>
|
||||
|
@@ -12,7 +12,7 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef WNT
|
||||
#ifndef _WIN32
|
||||
|
||||
|
||||
#include <OSD_Function.hxx>
|
||||
|
@@ -51,7 +51,7 @@ void OSD_Thread::Assign (const OSD_Thread &other)
|
||||
myFunc = other.myFunc;
|
||||
myPriority = other.myPriority;
|
||||
|
||||
#ifdef WNT
|
||||
#ifdef _WIN32
|
||||
|
||||
// On Windows, close current handle
|
||||
if ( myThread )
|
||||
@@ -81,7 +81,7 @@ void OSD_Thread::Assign (const OSD_Thread &other)
|
||||
|
||||
void OSD_Thread::Destroy ()
|
||||
{
|
||||
#ifdef WNT
|
||||
#ifdef _WIN32
|
||||
|
||||
// On Windows, close current handle
|
||||
if ( myThread )
|
||||
@@ -105,7 +105,7 @@ void OSD_Thread::Destroy ()
|
||||
void OSD_Thread::SetPriority (const Standard_Integer thePriority)
|
||||
{
|
||||
myPriority = thePriority;
|
||||
#ifdef WNT
|
||||
#ifdef _WIN32
|
||||
if (myThread)
|
||||
SetThreadPriority (myThread, thePriority);
|
||||
#endif
|
||||
@@ -126,7 +126,7 @@ void OSD_Thread::SetFunction (const OSD_ThreadFunction &func)
|
||||
// OSD_Thread::Run
|
||||
//=============================================
|
||||
|
||||
#ifdef WNT
|
||||
#ifdef _WIN32
|
||||
#include <malloc.h>
|
||||
// On Windows the signature of the thread function differs from that on UNIX/Linux.
|
||||
// As we use the same definition of the thread function on all platforms (POSIX-like),
|
||||
@@ -142,7 +142,7 @@ static DWORD WINAPI WNTthread_func (LPVOID data)
|
||||
#endif
|
||||
|
||||
Standard_Boolean OSD_Thread::Run (const Standard_Address data,
|
||||
#ifdef WNT
|
||||
#ifdef _WIN32
|
||||
const Standard_Integer WNTStackSize
|
||||
#else
|
||||
const Standard_Integer
|
||||
@@ -153,7 +153,7 @@ Standard_Boolean OSD_Thread::Run (const Standard_Address data,
|
||||
|
||||
myThreadId = 0;
|
||||
|
||||
#ifdef WNT
|
||||
#ifdef _WIN32
|
||||
|
||||
// On Windows, close current handle if open
|
||||
if ( myThread )
|
||||
@@ -195,7 +195,7 @@ Standard_Boolean OSD_Thread::Run (const Standard_Address data,
|
||||
|
||||
void OSD_Thread::Detach ()
|
||||
{
|
||||
#ifdef WNT
|
||||
#ifdef _WIN32
|
||||
|
||||
// On Windows, close current handle
|
||||
if ( myThread )
|
||||
@@ -234,7 +234,7 @@ Standard_Boolean OSD_Thread::Wait (Standard_Address &result) const
|
||||
if ( ! myThread )
|
||||
return Standard_False;
|
||||
|
||||
#ifdef WNT
|
||||
#ifdef _WIN32
|
||||
|
||||
// On Windows, wait for the thread handle to be signaled
|
||||
if ( WaitForSingleObject ( myThread, INFINITE ) != WAIT_OBJECT_0 )
|
||||
@@ -265,7 +265,7 @@ Standard_Boolean OSD_Thread::Wait (const Standard_Integer time, Standard_Address
|
||||
if ( ! myThread )
|
||||
return Standard_False;
|
||||
|
||||
#ifdef WNT
|
||||
#ifdef _WIN32
|
||||
|
||||
// On Windows, wait for the thread handle to be signaled
|
||||
DWORD ret = WaitForSingleObject ( myThread, time );
|
||||
@@ -306,7 +306,7 @@ Standard_ThreadId OSD_Thread::GetId () const
|
||||
|
||||
Standard_ThreadId OSD_Thread::Current ()
|
||||
{
|
||||
#ifdef WNT
|
||||
#ifdef _WIN32
|
||||
return GetCurrentThreadId();
|
||||
#else
|
||||
return pthread_self();
|
||||
|
@@ -31,7 +31,7 @@
|
||||
// that the thread function returns just integer (casted to void*).
|
||||
// This shall work on all platforms.
|
||||
|
||||
//#ifdef WNT
|
||||
//#ifdef _WIN32
|
||||
//#include <windows.h>
|
||||
//typedef LPTHREAD_START_ROUTINE OSD_ThreadFunction;
|
||||
//#else
|
||||
|
@@ -21,7 +21,7 @@
|
||||
|
||||
#include <OSD_Timer.hxx>
|
||||
|
||||
#ifndef WNT
|
||||
#ifndef _WIN32
|
||||
|
||||
//---------- No Windows NT Systems ----------------------------------
|
||||
|
||||
@@ -65,7 +65,7 @@ static inline Standard_Real GetWallClockTime ()
|
||||
0.001 * GetTickCount();
|
||||
}
|
||||
|
||||
#endif /* WNT */
|
||||
#endif /* _WIN32 */
|
||||
|
||||
// ====================== PLATFORM-INDEPENDENT PART ========================
|
||||
|
||||
|
@@ -13,7 +13,7 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifdef WNT
|
||||
#ifdef _WIN32
|
||||
|
||||
/******************************************************************************/
|
||||
/* File: OSD_WNT.cxx */
|
||||
|
@@ -15,10 +15,10 @@
|
||||
#ifndef __OSD_WNT_BREAK_HXX
|
||||
# define __OSD_WNT_BREAK_HXX
|
||||
|
||||
# ifdef WNT
|
||||
# ifdef _WIN32
|
||||
# include <OSD.hxx>
|
||||
# define _TSTBRK() OSD :: ControlBreak ()
|
||||
# endif // WNT
|
||||
# endif // _WIN32
|
||||
|
||||
#endif // __OSD_WNT_BREAK_HXX
|
||||
|
||||
|
@@ -513,7 +513,7 @@ void OSD::SetSignal(const Standard_Boolean aFloatingSignal)
|
||||
sigaction(SIGBUS,&oact,&oact);
|
||||
#endif
|
||||
|
||||
#if (!defined (linux)) && (!defined(LININTEL))
|
||||
#if (!defined (linux)) && (!defined(__linux__))
|
||||
sigaction(SIGSYS,&act,&oact); // ...... bad argument to system call
|
||||
|
||||
# ifdef OBJS
|
||||
|
@@ -598,4 +598,4 @@ LONG _osd_debug ( void ) {
|
||||
#undef __finally
|
||||
#undef __leave
|
||||
#endif
|
||||
#endif // WNT
|
||||
#endif // _WIN32
|
||||
|
Reference in New Issue
Block a user