mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-29 14:00:49 +03:00
0026937: Eliminate NO_CXX_EXCEPTION macro support
Macro NO_CXX_EXCEPTION was removed from code. Method Raise() was replaced by explicit throw statement. Method Standard_Failure::Caught() was replaced by normal C++mechanism of exception transfer. Method Standard_Failure::Caught() is deprecated now. Eliminated empty constructors. Updated samples. Eliminate empty method ChangeValue from NCollection_Map class. Removed not operable methods from NCollection classes.
This commit is contained in:
@@ -99,8 +99,8 @@ public:
|
||||
//! across threads.
|
||||
//!
|
||||
//! Keep in mind that whether the C++ exception will really be thrown (i.e.
|
||||
//! ::throw() will be called) is regulated by the NO_CXX_EXCEPTIONS and
|
||||
//! OCC_CONVERT_SIGNALS macros used during compilation of Open CASCADE and
|
||||
//! ::throw() will be called) is regulated by the
|
||||
//! OCC_CONVERT_SIGNALS macro used during compilation of Open CASCADE and
|
||||
//! user's code. Refer to Foundation Classes User's Guide for further details.
|
||||
//!
|
||||
Standard_EXPORT static void SetSignal (const Standard_Boolean theFloatingSignal = Standard_True);
|
||||
|
@@ -127,7 +127,7 @@ void OSD_Directory :: Build (const OSD_Protection& Protect) {
|
||||
|
||||
if ( dirName.IsEmpty () )
|
||||
|
||||
Standard_ProgramError :: Raise ( "OSD_Directory :: Build (): incorrect call - no directory name");
|
||||
throw Standard_ProgramError ( "OSD_Directory :: Build (): incorrect call - no directory name");
|
||||
|
||||
Standard_Boolean isOK = Exists();
|
||||
if (! isOK)
|
||||
|
@@ -403,7 +403,7 @@ static void __fastcall _osd_wnt_set_disk_name ( TCollection_AsciiString& result,
|
||||
|
||||
} else {
|
||||
badPath:
|
||||
Standard_ProgramError :: Raise ( "OSD_Disk: bad disk name" );
|
||||
throw Standard_ProgramError ( "OSD_Disk: bad disk name" );
|
||||
|
||||
} // end else
|
||||
|
||||
|
@@ -54,7 +54,7 @@ OSD_Environment::OSD_Environment(const TCollection_AsciiString& Name)
|
||||
{
|
||||
|
||||
if (!Name.IsAscii() || Name.Search("$") != -1 )
|
||||
Standard_ConstructionError::Raise("OSD_Environment::OSD_Environment: bad argument");
|
||||
throw Standard_ConstructionError("OSD_Environment::OSD_Environment: bad argument");
|
||||
|
||||
myName = Name;
|
||||
}
|
||||
@@ -71,7 +71,7 @@ OSD_Environment::OSD_Environment(const TCollection_AsciiString& Name,
|
||||
if (!Name.IsAscii() || !Value.IsAscii() ||
|
||||
// JPT : Dec-7-1992 Name.Search("$") != -1 || Value.Search("$") != -1)
|
||||
Name.Search("$") != -1 )
|
||||
Standard_ConstructionError::Raise("OSD_Environment::OSD_Environment: bad argument");
|
||||
throw Standard_ConstructionError("OSD_Environment::OSD_Environment: bad argument");
|
||||
|
||||
myName = Name;
|
||||
myValue = Value;
|
||||
@@ -95,7 +95,7 @@ void OSD_Environment::SetName (const TCollection_AsciiString& Name)
|
||||
{
|
||||
myError.Reset();
|
||||
if (!Name.IsAscii() || Name.Search("$") != -1 )
|
||||
Standard_ConstructionError::Raise("OSD_Environment::SetName: bad argument");
|
||||
throw Standard_ConstructionError("OSD_Environment::SetName: bad argument");
|
||||
|
||||
myName = Name;
|
||||
}
|
||||
@@ -107,7 +107,7 @@ void OSD_Environment::SetName (const TCollection_AsciiString& Name)
|
||||
void OSD_Environment::SetValue (const TCollection_AsciiString& Value)
|
||||
{
|
||||
if (!Value.IsAscii() || Value.Search("$") != -1)
|
||||
Standard_ConstructionError::Raise("OSD_Environment::Change: bad argument");
|
||||
throw Standard_ConstructionError("OSD_Environment::Change: bad argument");
|
||||
|
||||
myValue = Value;
|
||||
}
|
||||
|
@@ -434,7 +434,7 @@ void OSD_Error::Perror() {
|
||||
}
|
||||
}
|
||||
buffer += ".\n\n";
|
||||
OSD_OSDError::Raise (buffer.ToCString());
|
||||
throw OSD_OSDError(buffer.ToCString());
|
||||
}
|
||||
|
||||
#else
|
||||
|
@@ -25,7 +25,7 @@ DEFINE_STANDARD_HANDLE(OSD_Exception, Standard_Failure)
|
||||
|
||||
#if !defined No_Exception && !defined No_OSD_Exception
|
||||
#define OSD_Exception_Raise_if(CONDITION, MESSAGE) \
|
||||
if (CONDITION) OSD_Exception::Raise(MESSAGE);
|
||||
if (CONDITION) throw OSD_Exception(MESSAGE);
|
||||
#else
|
||||
#define OSD_Exception_Raise_if(CONDITION, MESSAGE)
|
||||
#endif
|
||||
|
@@ -25,7 +25,7 @@ DEFINE_STANDARD_HANDLE(OSD_Exception_ACCESS_VIOLATION, OSD_Exception)
|
||||
|
||||
#if !defined No_Exception && !defined No_OSD_Exception_ACCESS_VIOLATION
|
||||
#define OSD_Exception_ACCESS_VIOLATION_Raise_if(CONDITION, MESSAGE) \
|
||||
if (CONDITION) OSD_Exception_ACCESS_VIOLATION::Raise(MESSAGE);
|
||||
if (CONDITION) throw OSD_Exception_ACCESS_VIOLATION(MESSAGE);
|
||||
#else
|
||||
#define OSD_Exception_ACCESS_VIOLATION_Raise_if(CONDITION, MESSAGE)
|
||||
#endif
|
||||
|
@@ -25,7 +25,7 @@ DEFINE_STANDARD_HANDLE(OSD_Exception_ARRAY_BOUNDS_EXCEEDED, OSD_Exception)
|
||||
|
||||
#if !defined No_Exception && !defined No_OSD_Exception_ARRAY_BOUNDS_EXCEEDED
|
||||
#define OSD_Exception_ARRAY_BOUNDS_EXCEEDED_Raise_if(CONDITION, MESSAGE) \
|
||||
if (CONDITION) OSD_Exception_ARRAY_BOUNDS_EXCEEDED::Raise(MESSAGE);
|
||||
if (CONDITION) throw OSD_Exception_ARRAY_BOUNDS_EXCEEDED(MESSAGE);
|
||||
#else
|
||||
#define OSD_Exception_ARRAY_BOUNDS_EXCEEDED_Raise_if(CONDITION, MESSAGE)
|
||||
#endif
|
||||
|
@@ -25,7 +25,7 @@ DEFINE_STANDARD_HANDLE(OSD_Exception_CTRL_BREAK, OSD_Exception)
|
||||
|
||||
#if !defined No_Exception && !defined No_OSD_Exception_CTRL_BREAK
|
||||
#define OSD_Exception_CTRL_BREAK_Raise_if(CONDITION, MESSAGE) \
|
||||
if (CONDITION) OSD_Exception_CTRL_BREAK::Raise(MESSAGE);
|
||||
if (CONDITION) throw OSD_Exception_CTRL_BREAK(MESSAGE);
|
||||
#else
|
||||
#define OSD_Exception_CTRL_BREAK_Raise_if(CONDITION, MESSAGE)
|
||||
#endif
|
||||
|
@@ -25,7 +25,7 @@ DEFINE_STANDARD_HANDLE(OSD_Exception_FLT_DENORMAL_OPERAND, OSD_Exception)
|
||||
|
||||
#if !defined No_Exception && !defined No_OSD_Exception_FLT_DENORMAL_OPERAND
|
||||
#define OSD_Exception_FLT_DENORMAL_OPERAND_Raise_if(CONDITION, MESSAGE) \
|
||||
if (CONDITION) OSD_Exception_FLT_DENORMAL_OPERAND::Raise(MESSAGE);
|
||||
if (CONDITION) throw OSD_Exception_FLT_DENORMAL_OPERAND(MESSAGE);
|
||||
#else
|
||||
#define OSD_Exception_FLT_DENORMAL_OPERAND_Raise_if(CONDITION, MESSAGE)
|
||||
#endif
|
||||
|
@@ -25,7 +25,7 @@ DEFINE_STANDARD_HANDLE(OSD_Exception_FLT_DIVIDE_BY_ZERO, OSD_Exception)
|
||||
|
||||
#if !defined No_Exception && !defined No_OSD_Exception_FLT_DIVIDE_BY_ZERO
|
||||
#define OSD_Exception_FLT_DIVIDE_BY_ZERO_Raise_if(CONDITION, MESSAGE) \
|
||||
if (CONDITION) OSD_Exception_FLT_DIVIDE_BY_ZERO::Raise(MESSAGE);
|
||||
if (CONDITION) throw OSD_Exception_FLT_DIVIDE_BY_ZERO(MESSAGE);
|
||||
#else
|
||||
#define OSD_Exception_FLT_DIVIDE_BY_ZERO_Raise_if(CONDITION, MESSAGE)
|
||||
#endif
|
||||
|
@@ -25,7 +25,7 @@ DEFINE_STANDARD_HANDLE(OSD_Exception_FLT_INEXACT_RESULT, OSD_Exception)
|
||||
|
||||
#if !defined No_Exception && !defined No_OSD_Exception_FLT_INEXACT_RESULT
|
||||
#define OSD_Exception_FLT_INEXACT_RESULT_Raise_if(CONDITION, MESSAGE) \
|
||||
if (CONDITION) OSD_Exception_FLT_INEXACT_RESULT::Raise(MESSAGE);
|
||||
if (CONDITION) throw OSD_Exception_FLT_INEXACT_RESULT(MESSAGE);
|
||||
#else
|
||||
#define OSD_Exception_FLT_INEXACT_RESULT_Raise_if(CONDITION, MESSAGE)
|
||||
#endif
|
||||
|
@@ -25,7 +25,7 @@ DEFINE_STANDARD_HANDLE(OSD_Exception_FLT_INVALID_OPERATION, OSD_Exception)
|
||||
|
||||
#if !defined No_Exception && !defined No_OSD_Exception_FLT_INVALID_OPERATION
|
||||
#define OSD_Exception_FLT_INVALID_OPERATION_Raise_if(CONDITION, MESSAGE) \
|
||||
if (CONDITION) OSD_Exception_FLT_INVALID_OPERATION::Raise(MESSAGE);
|
||||
if (CONDITION) throw OSD_Exception_FLT_INVALID_OPERATION(MESSAGE);
|
||||
#else
|
||||
#define OSD_Exception_FLT_INVALID_OPERATION_Raise_if(CONDITION, MESSAGE)
|
||||
#endif
|
||||
|
@@ -25,7 +25,7 @@ DEFINE_STANDARD_HANDLE(OSD_Exception_FLT_OVERFLOW, OSD_Exception)
|
||||
|
||||
#if !defined No_Exception && !defined No_OSD_Exception_FLT_OVERFLOW
|
||||
#define OSD_Exception_FLT_OVERFLOW_Raise_if(CONDITION, MESSAGE) \
|
||||
if (CONDITION) OSD_Exception_FLT_OVERFLOW::Raise(MESSAGE);
|
||||
if (CONDITION) throw OSD_Exception_FLT_OVERFLOW(MESSAGE);
|
||||
#else
|
||||
#define OSD_Exception_FLT_OVERFLOW_Raise_if(CONDITION, MESSAGE)
|
||||
#endif
|
||||
|
@@ -25,7 +25,7 @@ DEFINE_STANDARD_HANDLE(OSD_Exception_FLT_STACK_CHECK, OSD_Exception)
|
||||
|
||||
#if !defined No_Exception && !defined No_OSD_Exception_FLT_STACK_CHECK
|
||||
#define OSD_Exception_FLT_STACK_CHECK_Raise_if(CONDITION, MESSAGE) \
|
||||
if (CONDITION) OSD_Exception_FLT_STACK_CHECK::Raise(MESSAGE);
|
||||
if (CONDITION) throw OSD_Exception_FLT_STACK_CHECK(MESSAGE);
|
||||
#else
|
||||
#define OSD_Exception_FLT_STACK_CHECK_Raise_if(CONDITION, MESSAGE)
|
||||
#endif
|
||||
|
@@ -25,7 +25,7 @@ DEFINE_STANDARD_HANDLE(OSD_Exception_FLT_UNDERFLOW, OSD_Exception)
|
||||
|
||||
#if !defined No_Exception && !defined No_OSD_Exception_FLT_UNDERFLOW
|
||||
#define OSD_Exception_FLT_UNDERFLOW_Raise_if(CONDITION, MESSAGE) \
|
||||
if (CONDITION) OSD_Exception_FLT_UNDERFLOW::Raise(MESSAGE);
|
||||
if (CONDITION) throw OSD_Exception_FLT_UNDERFLOW(MESSAGE);
|
||||
#else
|
||||
#define OSD_Exception_FLT_UNDERFLOW_Raise_if(CONDITION, MESSAGE)
|
||||
#endif
|
||||
|
@@ -25,7 +25,7 @@ DEFINE_STANDARD_HANDLE(OSD_Exception_ILLEGAL_INSTRUCTION, OSD_Exception)
|
||||
|
||||
#if !defined No_Exception && !defined No_OSD_Exception_ILLEGAL_INSTRUCTION
|
||||
#define OSD_Exception_ILLEGAL_INSTRUCTION_Raise_if(CONDITION, MESSAGE) \
|
||||
if (CONDITION) OSD_Exception_ILLEGAL_INSTRUCTION::Raise(MESSAGE);
|
||||
if (CONDITION) throw OSD_Exception_ILLEGAL_INSTRUCTION(MESSAGE);
|
||||
#else
|
||||
#define OSD_Exception_ILLEGAL_INSTRUCTION_Raise_if(CONDITION, MESSAGE)
|
||||
#endif
|
||||
|
@@ -25,7 +25,7 @@ DEFINE_STANDARD_HANDLE(OSD_Exception_INT_DIVIDE_BY_ZERO, OSD_Exception)
|
||||
|
||||
#if !defined No_Exception && !defined No_OSD_Exception_INT_DIVIDE_BY_ZERO
|
||||
#define OSD_Exception_INT_DIVIDE_BY_ZERO_Raise_if(CONDITION, MESSAGE) \
|
||||
if (CONDITION) OSD_Exception_INT_DIVIDE_BY_ZERO::Raise(MESSAGE);
|
||||
if (CONDITION) throw OSD_Exception_INT_DIVIDE_BY_ZERO(MESSAGE);
|
||||
#else
|
||||
#define OSD_Exception_INT_DIVIDE_BY_ZERO_Raise_if(CONDITION, MESSAGE)
|
||||
#endif
|
||||
|
@@ -25,7 +25,7 @@ DEFINE_STANDARD_HANDLE(OSD_Exception_INT_OVERFLOW, OSD_Exception)
|
||||
|
||||
#if !defined No_Exception && !defined No_OSD_Exception_INT_OVERFLOW
|
||||
#define OSD_Exception_INT_OVERFLOW_Raise_if(CONDITION, MESSAGE) \
|
||||
if (CONDITION) OSD_Exception_INT_OVERFLOW::Raise(MESSAGE);
|
||||
if (CONDITION) throw OSD_Exception_INT_OVERFLOW(MESSAGE);
|
||||
#else
|
||||
#define OSD_Exception_INT_OVERFLOW_Raise_if(CONDITION, MESSAGE)
|
||||
#endif
|
||||
|
@@ -25,7 +25,7 @@ DEFINE_STANDARD_HANDLE(OSD_Exception_INVALID_DISPOSITION, OSD_Exception)
|
||||
|
||||
#if !defined No_Exception && !defined No_OSD_Exception_INVALID_DISPOSITION
|
||||
#define OSD_Exception_INVALID_DISPOSITION_Raise_if(CONDITION, MESSAGE) \
|
||||
if (CONDITION) OSD_Exception_INVALID_DISPOSITION::Raise(MESSAGE);
|
||||
if (CONDITION) throw OSD_Exception_INVALID_DISPOSITION(MESSAGE);
|
||||
#else
|
||||
#define OSD_Exception_INVALID_DISPOSITION_Raise_if(CONDITION, MESSAGE)
|
||||
#endif
|
||||
|
@@ -25,7 +25,7 @@ DEFINE_STANDARD_HANDLE(OSD_Exception_IN_PAGE_ERROR, OSD_Exception)
|
||||
|
||||
#if !defined No_Exception && !defined No_OSD_Exception_IN_PAGE_ERROR
|
||||
#define OSD_Exception_IN_PAGE_ERROR_Raise_if(CONDITION, MESSAGE) \
|
||||
if (CONDITION) OSD_Exception_IN_PAGE_ERROR::Raise(MESSAGE);
|
||||
if (CONDITION) throw OSD_Exception_IN_PAGE_ERROR(MESSAGE);
|
||||
#else
|
||||
#define OSD_Exception_IN_PAGE_ERROR_Raise_if(CONDITION, MESSAGE)
|
||||
#endif
|
||||
|
@@ -25,7 +25,7 @@ DEFINE_STANDARD_HANDLE(OSD_Exception_NONCONTINUABLE_EXCEPTION, OSD_Exception)
|
||||
|
||||
#if !defined No_Exception && !defined No_OSD_Exception_NONCONTINUABLE_EXCEPTION
|
||||
#define OSD_Exception_NONCONTINUABLE_EXCEPTION_Raise_if(CONDITION, MESSAGE) \
|
||||
if (CONDITION) OSD_Exception_NONCONTINUABLE_EXCEPTION::Raise(MESSAGE);
|
||||
if (CONDITION) throw OSD_Exception_NONCONTINUABLE_EXCEPTION(MESSAGE);
|
||||
#else
|
||||
#define OSD_Exception_NONCONTINUABLE_EXCEPTION_Raise_if(CONDITION, MESSAGE)
|
||||
#endif
|
||||
|
@@ -25,7 +25,7 @@ DEFINE_STANDARD_HANDLE(OSD_Exception_PRIV_INSTRUCTION, OSD_Exception)
|
||||
|
||||
#if !defined No_Exception && !defined No_OSD_Exception_PRIV_INSTRUCTION
|
||||
#define OSD_Exception_PRIV_INSTRUCTION_Raise_if(CONDITION, MESSAGE) \
|
||||
if (CONDITION) OSD_Exception_PRIV_INSTRUCTION::Raise(MESSAGE);
|
||||
if (CONDITION) throw OSD_Exception_PRIV_INSTRUCTION(MESSAGE);
|
||||
#else
|
||||
#define OSD_Exception_PRIV_INSTRUCTION_Raise_if(CONDITION, MESSAGE)
|
||||
#endif
|
||||
|
@@ -25,7 +25,7 @@ DEFINE_STANDARD_HANDLE(OSD_Exception_STACK_OVERFLOW, OSD_Exception)
|
||||
|
||||
#if !defined No_Exception && !defined No_OSD_Exception_STACK_OVERFLOW
|
||||
#define OSD_Exception_STACK_OVERFLOW_Raise_if(CONDITION, MESSAGE) \
|
||||
if (CONDITION) OSD_Exception_STACK_OVERFLOW::Raise(MESSAGE);
|
||||
if (CONDITION) throw OSD_Exception_STACK_OVERFLOW(MESSAGE);
|
||||
#else
|
||||
#define OSD_Exception_STACK_OVERFLOW_Raise_if(CONDITION, MESSAGE)
|
||||
#endif
|
||||
|
@@ -25,7 +25,7 @@ DEFINE_STANDARD_HANDLE(OSD_Exception_STATUS_NO_MEMORY, OSD_Exception)
|
||||
|
||||
#if !defined No_Exception && !defined No_OSD_Exception_STATUS_NO_MEMORY
|
||||
#define OSD_Exception_STATUS_NO_MEMORY_Raise_if(CONDITION, MESSAGE) \
|
||||
if (CONDITION) OSD_Exception_STATUS_NO_MEMORY::Raise(MESSAGE);
|
||||
if (CONDITION) throw OSD_Exception_STATUS_NO_MEMORY(MESSAGE);
|
||||
#else
|
||||
#define OSD_Exception_STATUS_NO_MEMORY_Raise_if(CONDITION, MESSAGE)
|
||||
#endif
|
||||
|
@@ -91,10 +91,10 @@ void OSD_File::Build(const OSD_OpenMode Mode,
|
||||
TCollection_AsciiString aBuffer;
|
||||
|
||||
if (myPath.Name().Length()==0)
|
||||
Standard_ProgramError::Raise("OSD_File::Build : no name was given");
|
||||
throw Standard_ProgramError("OSD_File::Build : no name was given");
|
||||
|
||||
if (myFileChannel != -1)
|
||||
Standard_ProgramError::Raise("OSD_File::Build : file is already open");
|
||||
throw Standard_ProgramError("OSD_File::Build : file is already open");
|
||||
|
||||
|
||||
myMode = Mode;
|
||||
@@ -144,14 +144,14 @@ void OSD_File::Append(const OSD_OpenMode Mode,
|
||||
TCollection_AsciiString aBuffer;
|
||||
|
||||
if ( OSD_File::KindOfFile ( ) == OSD_DIRECTORY ) {
|
||||
Standard_ProgramError::Raise("OSD_File::Append : it is a directory");
|
||||
throw Standard_ProgramError("OSD_File::Append : it is a directory");
|
||||
}
|
||||
|
||||
if (myPath.Name().Length()==0)
|
||||
Standard_ProgramError::Raise("OSD_File::Append : no name was given");
|
||||
throw Standard_ProgramError("OSD_File::Append : no name was given");
|
||||
|
||||
if (myFileChannel != -1)
|
||||
Standard_ProgramError::Raise("OSD_File::Append : file is already open");
|
||||
throw Standard_ProgramError("OSD_File::Append : file is already open");
|
||||
|
||||
internal_prot = Protect.Internal();
|
||||
myMode = Mode;
|
||||
@@ -202,10 +202,10 @@ void OSD_File::Open(const OSD_OpenMode Mode,
|
||||
}
|
||||
|
||||
if (myPath.Name().Length()==0)
|
||||
Standard_ProgramError::Raise("OSD_File::Open : no name was given");
|
||||
throw Standard_ProgramError("OSD_File::Open : no name was given");
|
||||
|
||||
if (myFileChannel != -1)
|
||||
Standard_ProgramError::Raise("OSD_File::Open : file is already open");
|
||||
throw Standard_ProgramError("OSD_File::Open : file is already open");
|
||||
|
||||
internal_prot = Protect.Internal();
|
||||
myMode = Mode;
|
||||
@@ -283,19 +283,19 @@ void OSD_File::Read(TCollection_AsciiString& Buffer,
|
||||
int status;
|
||||
|
||||
if ( OSD_File::KindOfFile ( ) == OSD_DIRECTORY ) {
|
||||
Standard_ProgramError::Raise("OSD_File::Read : it is a directory");
|
||||
throw Standard_ProgramError("OSD_File::Read : it is a directory");
|
||||
}
|
||||
|
||||
if (myFileChannel == -1)
|
||||
Standard_ProgramError::Raise("OSD_File::Read : file is not open");
|
||||
throw Standard_ProgramError("OSD_File::Read : file is not open");
|
||||
|
||||
if (Failed()) Perror();
|
||||
|
||||
if (myMode == OSD_WriteOnly)
|
||||
Standard_ProgramError::Raise("OSD_File::Read : file is Write only");
|
||||
throw Standard_ProgramError("OSD_File::Read : file is Write only");
|
||||
|
||||
if (Nbyte <= 0)
|
||||
Standard_ProgramError::Raise("OSD_File::Read : Nbyte is null");
|
||||
throw Standard_ProgramError("OSD_File::Read : Nbyte is null");
|
||||
|
||||
TCollection_AsciiString transfert(Nbyte,' ');
|
||||
readbuf = (Standard_PCharacter)transfert.ToCString();
|
||||
@@ -321,19 +321,19 @@ void OSD_File::ReadLine(TCollection_AsciiString& Buffer,
|
||||
Standard_PCharacter readbuf, abuffer;
|
||||
//
|
||||
if (OSD_File::KindOfFile() == OSD_DIRECTORY ) {
|
||||
Standard_ProgramError::Raise("OSD_File::Read : it is a directory");
|
||||
throw Standard_ProgramError("OSD_File::Read : it is a directory");
|
||||
}
|
||||
if (myFileChannel == -1){
|
||||
Standard_ProgramError::Raise("OSD_File::ReadLine : file is not open");
|
||||
throw Standard_ProgramError("OSD_File::ReadLine : file is not open");
|
||||
}
|
||||
if (Failed()) {
|
||||
Perror();
|
||||
}
|
||||
if (myMode == OSD_WriteOnly) {
|
||||
Standard_ProgramError::Raise("OSD_File::ReadLine : file is Write only");
|
||||
throw Standard_ProgramError("OSD_File::ReadLine : file is Write only");
|
||||
}
|
||||
if (Nbyte <= 0){
|
||||
Standard_ProgramError::Raise("OSD_File::ReadLine : Nbyte is null");
|
||||
throw Standard_ProgramError("OSD_File::ReadLine : Nbyte is null");
|
||||
}
|
||||
//
|
||||
TCollection_AsciiString transfert(Nbyte,' ');
|
||||
@@ -391,22 +391,22 @@ void OSD_File::Read(const Standard_Address Buffer,
|
||||
|
||||
Readbyte = 0;
|
||||
if ( OSD_File::KindOfFile ( ) == OSD_DIRECTORY ) {
|
||||
Standard_ProgramError::Raise("OSD_File::Read : it is a directory");
|
||||
throw Standard_ProgramError("OSD_File::Read : it is a directory");
|
||||
}
|
||||
|
||||
if (myFileChannel == -1)
|
||||
Standard_ProgramError::Raise("OSD_File::Read : file is not open");
|
||||
throw Standard_ProgramError("OSD_File::Read : file is not open");
|
||||
|
||||
if (Failed()) Perror();
|
||||
|
||||
if (myMode == OSD_WriteOnly)
|
||||
Standard_ProgramError::Raise("OSD_File::Read : file is Write only");
|
||||
throw Standard_ProgramError("OSD_File::Read : file is Write only");
|
||||
|
||||
if (Nbyte <= 0)
|
||||
Standard_ProgramError::Raise("OSD_File::Read : Nbyte is null");
|
||||
throw Standard_ProgramError("OSD_File::Read : Nbyte is null");
|
||||
|
||||
if (Buffer == NULL)
|
||||
Standard_ProgramError::Raise("OSD_File::Read : Buffer is null");
|
||||
throw Standard_ProgramError("OSD_File::Read : Buffer is null");
|
||||
|
||||
status = read (myFileChannel, (char*) Buffer, Nbyte);
|
||||
|
||||
@@ -426,19 +426,19 @@ void OSD_File::Write(const TCollection_AsciiString &Buffer,
|
||||
int status;
|
||||
|
||||
if ( OSD_File::KindOfFile ( ) == OSD_DIRECTORY ) {
|
||||
Standard_ProgramError::Raise("OSD_File::Write : it is a directory");
|
||||
throw Standard_ProgramError("OSD_File::Write : it is a directory");
|
||||
}
|
||||
|
||||
if (myFileChannel == -1)
|
||||
Standard_ProgramError::Raise("OSD_File::Write : file is not open");
|
||||
throw Standard_ProgramError("OSD_File::Write : file is not open");
|
||||
|
||||
if (Failed()) Perror();
|
||||
|
||||
if (myMode == OSD_ReadOnly)
|
||||
Standard_ProgramError::Raise("OSD_File::Write : file is Read only");
|
||||
throw Standard_ProgramError("OSD_File::Write : file is Read only");
|
||||
|
||||
if (Nbyte <= 0)
|
||||
Standard_ProgramError::Raise("OSD_File::Write : Nbyte is null");
|
||||
throw Standard_ProgramError("OSD_File::Write : Nbyte is null");
|
||||
|
||||
writebuf = Buffer.ToCString();
|
||||
|
||||
@@ -457,15 +457,15 @@ void OSD_File::Write(const Standard_Address Buffer,
|
||||
int status;
|
||||
|
||||
if (myFileChannel == -1)
|
||||
Standard_ProgramError::Raise("OSD_File::Write : file is not open");
|
||||
throw Standard_ProgramError("OSD_File::Write : file is not open");
|
||||
|
||||
if (Failed()) Perror();
|
||||
|
||||
if (myMode == OSD_ReadOnly)
|
||||
Standard_ProgramError::Raise("OSD_File::Write : file is Read only");
|
||||
throw Standard_ProgramError("OSD_File::Write : file is Read only");
|
||||
|
||||
if (Nbyte <= 0)
|
||||
Standard_ProgramError::Raise("OSD_File::Write : Nbyte is null");
|
||||
throw Standard_ProgramError("OSD_File::Write : Nbyte is null");
|
||||
|
||||
status = write (myFileChannel, (const char *)Buffer, Nbyte);
|
||||
|
||||
@@ -485,7 +485,7 @@ void OSD_File::Seek(const Standard_Integer Offset,
|
||||
int iwhere=0;
|
||||
|
||||
if (myFileChannel == -1)
|
||||
Standard_ProgramError::Raise("OSD_File::Seek : file is not open");
|
||||
throw Standard_ProgramError("OSD_File::Seek : file is not open");
|
||||
|
||||
if (Failed()) Perror();
|
||||
|
||||
@@ -518,7 +518,7 @@ void OSD_File::Close(){
|
||||
int status;
|
||||
|
||||
if (myFileChannel == -1)
|
||||
Standard_ProgramError::Raise("OSD_File::Close : file is not open");
|
||||
throw Standard_ProgramError("OSD_File::Close : file is not open");
|
||||
|
||||
if (Failed()) Perror();
|
||||
|
||||
@@ -543,7 +543,7 @@ void OSD_File::Close(){
|
||||
|
||||
Standard_Boolean OSD_File::IsAtEnd(){
|
||||
if (myFileChannel == -1)
|
||||
Standard_ProgramError::Raise("OSD_File::IsAtEnd : file is not open");
|
||||
throw Standard_ProgramError("OSD_File::IsAtEnd : file is not open");
|
||||
|
||||
if (myIO == EOF) return (Standard_True);
|
||||
return (Standard_False);
|
||||
@@ -553,7 +553,7 @@ Standard_Boolean OSD_File::IsAtEnd(){
|
||||
|
||||
/*void OSD_File::Link(const TCollection_AsciiString& ToFile){
|
||||
if (myFileChannel == -1)
|
||||
Standard_ProgramError::Raise("OSD_File::Link : file is not open");
|
||||
throw Standard_ProgramError("OSD_File::Link : file is not open");
|
||||
|
||||
TCollection_AsciiString aBuffer;
|
||||
myPath.SystemName ( aBuffer );
|
||||
@@ -567,7 +567,7 @@ void OSD_File::SetLock(const OSD_LockType Lock){
|
||||
int status;
|
||||
|
||||
if (myFileChannel == -1)
|
||||
Standard_ProgramError::Raise("OSD_File::SetLock : file is not open");
|
||||
throw Standard_ProgramError("OSD_File::SetLock : file is not open");
|
||||
|
||||
|
||||
#ifdef POSIX
|
||||
@@ -652,7 +652,7 @@ void OSD_File::UnLock(){
|
||||
int status;
|
||||
|
||||
if (myFileChannel == -1)
|
||||
Standard_ProgramError::Raise("OSD_File::UnLock : file is not open");
|
||||
throw Standard_ProgramError("OSD_File::UnLock : file is not open");
|
||||
|
||||
#ifdef POSIX
|
||||
struct stat buf;
|
||||
@@ -711,7 +711,7 @@ Standard_Size OSD_File::Size(){
|
||||
int status;
|
||||
|
||||
if (myPath.Name().Length()==0)
|
||||
Standard_ProgramError::Raise("OSD_File::Size : empty file name");
|
||||
throw Standard_ProgramError("OSD_File::Size : empty file name");
|
||||
|
||||
TCollection_AsciiString aBuffer;
|
||||
myPath.SystemName ( aBuffer );
|
||||
@@ -814,7 +814,7 @@ void OSD_File::Rewind() {
|
||||
|
||||
#define ACE_HEADER_SIZE ( sizeof ( ACCESS_ALLOWED_ACE ) - sizeof ( DWORD ) )
|
||||
|
||||
#define RAISE( arg ) Standard_ProgramError :: Raise ( ( arg ) )
|
||||
#define RAISE( arg ) throw Standard_ProgramError ( ( arg ) )
|
||||
#define TEST_RAISE( arg ) _test_raise ( myFileHandle, ( arg ) )
|
||||
|
||||
#define OPEN_NEW 0
|
||||
@@ -923,7 +923,7 @@ void OSD_File :: Build ( const OSD_OpenMode Mode, const OSD_Protection& Protect)
|
||||
TCollection_AsciiString fName;
|
||||
|
||||
if ( OSD_File::KindOfFile ( ) == OSD_DIRECTORY ) {
|
||||
Standard_ProgramError::Raise("OSD_File::Read : it is a directory");
|
||||
throw Standard_ProgramError("OSD_File::Read : it is a directory");
|
||||
}
|
||||
|
||||
if (myFileHandle != INVALID_HANDLE_VALUE)
|
||||
@@ -1050,7 +1050,7 @@ void OSD_File :: Read (
|
||||
cout << " OSD_File::Read : it is a directory " << endl;
|
||||
#endif
|
||||
return ;
|
||||
// Standard_ProgramError::Raise("OSD_File::Read : it is a directory");
|
||||
// throw Standard_ProgramError("OSD_File::Read : it is a directory");
|
||||
}
|
||||
|
||||
Standard_Integer NbyteRead;
|
||||
@@ -1096,7 +1096,7 @@ void OSD_File :: ReadLine (
|
||||
LONG aSeekPos;
|
||||
|
||||
if ( OSD_File::KindOfFile ( ) == OSD_DIRECTORY ) {
|
||||
Standard_ProgramError::Raise("OSD_File::Read : it is a directory");
|
||||
throw Standard_ProgramError("OSD_File::Read : it is a directory");
|
||||
}
|
||||
|
||||
TEST_RAISE( "ReadLine" );
|
||||
@@ -1237,7 +1237,7 @@ void OSD_File :: Read (
|
||||
DWORD dwBytesRead;
|
||||
|
||||
if ( OSD_File::KindOfFile ( ) == OSD_DIRECTORY ) {
|
||||
Standard_ProgramError::Raise("OSD_File::Read : it is a directory");
|
||||
throw Standard_ProgramError("OSD_File::Read : it is a directory");
|
||||
}
|
||||
|
||||
TEST_RAISE( "Read" );
|
||||
@@ -1926,7 +1926,7 @@ static void __fastcall _test_raise ( HANDLE hFile, Standard_CString str ) {
|
||||
buff += str;
|
||||
buff += " (): wrong access";
|
||||
|
||||
Standard_ProgramError::Raise(buff.ToCString());
|
||||
throw Standard_ProgramError(buff.ToCString());
|
||||
} // end if
|
||||
|
||||
} // end _test_raise
|
||||
|
@@ -78,7 +78,7 @@ int status;
|
||||
|
||||
|
||||
// if (myPath.Name().Length()==0) A directory can have a null name field (ex: root)
|
||||
// OSD_OSDError::Raise("OSD_FileNode::Exists : no name was given"); (LD)
|
||||
// throw OSD_OSDError("OSD_FileNode::Exists : no name was given"); (LD)
|
||||
|
||||
// if (Failed()) Perror();
|
||||
|
||||
@@ -98,7 +98,7 @@ int status;
|
||||
void OSD_FileNode::Remove(){
|
||||
|
||||
// if (myPath.Name().Length()==0) A directory can have a null name field (ex: root)
|
||||
// OSD_OSDError::Raise("OSD_FileNode::Remove : no name was given"); (LD)
|
||||
// throw OSD_OSDError("OSD_FileNode::Remove : no name was given"); (LD)
|
||||
|
||||
// if (Failed()) Perror();
|
||||
|
||||
@@ -151,7 +151,7 @@ int status;
|
||||
TCollection_AsciiString thisPath;
|
||||
|
||||
// if (myPath.Name().Length()==0)
|
||||
// OSD_OSDError::Raise("OSD_FileNode::Move : no name was given");
|
||||
// throw OSD_OSDError("OSD_FileNode::Move : no name was given");
|
||||
|
||||
// if (Failed()) Perror();
|
||||
|
||||
@@ -206,7 +206,7 @@ int status;
|
||||
TCollection_AsciiString second_name;
|
||||
|
||||
// if (myPath.Name().Length()==0) Copy .login would raise !!
|
||||
// OSD_OSDError::Raise("OSD_FileNode::Copy : no name was given");
|
||||
// throw OSD_OSDError("OSD_FileNode::Copy : no name was given");
|
||||
// if (Failed()) Perror();
|
||||
|
||||
ToPath.SystemName (second_name);
|
||||
@@ -233,7 +233,7 @@ int status;
|
||||
int s,u,g,w;
|
||||
|
||||
// if (myPath.Name().Length()==0)
|
||||
// OSD_OSDError::Raise("OSD_FileNode::Protection : no name was given");
|
||||
// throw OSD_OSDError("OSD_FileNode::Protection : no name was given");
|
||||
|
||||
// if (Failed()) Perror();
|
||||
|
||||
@@ -272,7 +272,7 @@ void OSD_FileNode::SetProtection(const OSD_Protection& Prot){
|
||||
int status;
|
||||
|
||||
// if (myPath.Name().Length()==0)
|
||||
// OSD_OSDError::Raise("OSD_FileNode::SetProtection : no name was given");
|
||||
// throw OSD_OSDError("OSD_FileNode::SetProtection : no name was given");
|
||||
|
||||
// if (Failed()) Perror();
|
||||
|
||||
@@ -291,7 +291,7 @@ Quantity_Date OSD_FileNode::CreationMoment(){
|
||||
struct stat buffer;
|
||||
|
||||
// if (myPath.Name().Length()==0)
|
||||
// OSD_OSDError::Raise("OSD_FileNode::CreationMoment : no name was given");
|
||||
// throw OSD_OSDError("OSD_FileNode::CreationMoment : no name was given");
|
||||
|
||||
// if (Failed()) Perror();
|
||||
|
||||
@@ -319,7 +319,7 @@ Quantity_Date OSD_FileNode::AccessMoment(){
|
||||
struct stat buffer;
|
||||
|
||||
// if (myPath.Name().Length()==0)
|
||||
// OSD_OSDError::Raise("OSD_FileNode::AccessMoment : no name was given");
|
||||
// throw OSD_OSDError("OSD_FileNode::AccessMoment : no name was given");
|
||||
|
||||
// if (Failed()) Perror();
|
||||
|
||||
@@ -383,7 +383,7 @@ Standard_Integer OSD_FileNode::Error()const{
|
||||
#include <Strsafe.h>
|
||||
|
||||
#define TEST_RAISE( arg ) _test_raise ( fName, ( arg ) )
|
||||
#define RAISE( arg ) Standard_ProgramError :: Raise ( ( arg ) )
|
||||
#define RAISE( arg ) throw Standard_ProgramError ( ( arg ) )
|
||||
|
||||
#ifndef OCCT_UWP
|
||||
// None of the existing security APIs are supported in a UWP applications
|
||||
@@ -925,7 +925,7 @@ static void __fastcall _test_raise ( TCollection_AsciiString fName, Standard_CSt
|
||||
buff += str;
|
||||
buff += " (): wrong access";
|
||||
|
||||
Standard_ProgramError::Raise(buff.ToCString());
|
||||
throw Standard_ProgramError(buff.ToCString());
|
||||
} // end if
|
||||
|
||||
} // end _test_raise
|
||||
|
@@ -25,7 +25,7 @@ DEFINE_STANDARD_HANDLE(OSD_OSDError, Standard_Failure)
|
||||
|
||||
#if !defined No_Exception && !defined No_OSD_OSDError
|
||||
#define OSD_OSDError_Raise_if(CONDITION, MESSAGE) \
|
||||
if (CONDITION) OSD_OSDError::Raise(MESSAGE);
|
||||
if (CONDITION) throw OSD_OSDError(MESSAGE);
|
||||
#else
|
||||
#define OSD_OSDError_Raise_if(CONDITION, MESSAGE)
|
||||
#endif
|
||||
|
@@ -222,7 +222,7 @@ void OSD_Parallel::ForEach( InputIterator theBegin,
|
||||
}
|
||||
catch ( tbb::captured_exception& anException )
|
||||
{
|
||||
Standard_NotImplemented::Raise(anException.what());
|
||||
throw Standard_NotImplemented(anException.what());
|
||||
}
|
||||
}
|
||||
#else
|
||||
@@ -271,7 +271,7 @@ void OSD_Parallel::For( const Standard_Integer theBegin,
|
||||
}
|
||||
catch ( tbb::captured_exception& anException )
|
||||
{
|
||||
Standard_NotImplemented::Raise(anException.what());
|
||||
throw Standard_NotImplemented(anException.what());
|
||||
}
|
||||
}
|
||||
#else
|
||||
|
@@ -456,7 +456,7 @@ void OSD_Path::RemoveATrek(const Standard_Integer thewhere){
|
||||
Standard_Integer length=TrekLength();
|
||||
|
||||
if (length <= 0 || thewhere > length)
|
||||
Standard_NumericError::Raise("OSD_Path::RemoveATrek : where has an invalid value");
|
||||
throw Standard_NumericError("OSD_Path::RemoveATrek : where has an invalid value");
|
||||
|
||||
Standard_Integer posit,aHowmany;
|
||||
TCollection_AsciiString tok;
|
||||
@@ -494,7 +494,7 @@ TCollection_AsciiString OSD_Path::TrekValue(const Standard_Integer thewhere)cons
|
||||
TCollection_AsciiString result=myTrek.Token("|",thewhere);
|
||||
|
||||
if (result == "")
|
||||
Standard_NumericError::Raise("OSD_Path::TrekValue : where is invalid");
|
||||
throw Standard_NumericError("OSD_Path::TrekValue : where is invalid");
|
||||
|
||||
return(result);
|
||||
}
|
||||
@@ -504,7 +504,7 @@ void OSD_Path::InsertATrek(const TCollection_AsciiString& aName,
|
||||
Standard_Integer length=TrekLength();
|
||||
|
||||
if (thewhere <= 0 || thewhere > length)
|
||||
Standard_NumericError::Raise("OSD_Path::InsertATrek : where has an invalid value");
|
||||
throw Standard_NumericError("OSD_Path::InsertATrek : where has an invalid value");
|
||||
|
||||
TCollection_AsciiString tok=myTrek.Token("|",thewhere);
|
||||
Standard_Integer wwhere = myTrek.Search(tok);
|
||||
@@ -1362,7 +1362,7 @@ static void __fastcall _test_raise ( OSD_SysType type, Standard_CString str ) {
|
||||
strcat ( buff, str );
|
||||
strcat ( buff, " (): unknown system type" );
|
||||
|
||||
Standard_ProgramError :: Raise ( buff );
|
||||
throw Standard_ProgramError ( buff );
|
||||
|
||||
} // end if
|
||||
|
||||
|
@@ -25,7 +25,7 @@ DEFINE_STANDARD_HANDLE(OSD_SIGBUS, OSD_Signal)
|
||||
|
||||
#if !defined No_Exception && !defined No_OSD_SIGBUS
|
||||
#define OSD_SIGBUS_Raise_if(CONDITION, MESSAGE) \
|
||||
if (CONDITION) OSD_SIGBUS::Raise(MESSAGE);
|
||||
if (CONDITION) throw OSD_SIGBUS(MESSAGE);
|
||||
#else
|
||||
#define OSD_SIGBUS_Raise_if(CONDITION, MESSAGE)
|
||||
#endif
|
||||
|
@@ -25,7 +25,7 @@ DEFINE_STANDARD_HANDLE(OSD_SIGHUP, OSD_Signal)
|
||||
|
||||
#if !defined No_Exception && !defined No_OSD_SIGHUP
|
||||
#define OSD_SIGHUP_Raise_if(CONDITION, MESSAGE) \
|
||||
if (CONDITION) OSD_SIGHUP::Raise(MESSAGE);
|
||||
if (CONDITION) throw OSD_SIGHUP(MESSAGE);
|
||||
#else
|
||||
#define OSD_SIGHUP_Raise_if(CONDITION, MESSAGE)
|
||||
#endif
|
||||
|
@@ -25,7 +25,7 @@ DEFINE_STANDARD_HANDLE(OSD_SIGILL, OSD_Signal)
|
||||
|
||||
#if !defined No_Exception && !defined No_OSD_SIGILL
|
||||
#define OSD_SIGILL_Raise_if(CONDITION, MESSAGE) \
|
||||
if (CONDITION) OSD_SIGILL::Raise(MESSAGE);
|
||||
if (CONDITION) throw OSD_SIGILL(MESSAGE);
|
||||
#else
|
||||
#define OSD_SIGILL_Raise_if(CONDITION, MESSAGE)
|
||||
#endif
|
||||
|
@@ -25,7 +25,7 @@ DEFINE_STANDARD_HANDLE(OSD_SIGINT, OSD_Signal)
|
||||
|
||||
#if !defined No_Exception && !defined No_OSD_SIGINT
|
||||
#define OSD_SIGINT_Raise_if(CONDITION, MESSAGE) \
|
||||
if (CONDITION) OSD_SIGINT::Raise(MESSAGE);
|
||||
if (CONDITION) throw OSD_SIGINT(MESSAGE);
|
||||
#else
|
||||
#define OSD_SIGINT_Raise_if(CONDITION, MESSAGE)
|
||||
#endif
|
||||
|
@@ -25,7 +25,7 @@ DEFINE_STANDARD_HANDLE(OSD_SIGKILL, OSD_Signal)
|
||||
|
||||
#if !defined No_Exception && !defined No_OSD_SIGKILL
|
||||
#define OSD_SIGKILL_Raise_if(CONDITION, MESSAGE) \
|
||||
if (CONDITION) OSD_SIGKILL::Raise(MESSAGE);
|
||||
if (CONDITION) throw OSD_SIGKILL(MESSAGE);
|
||||
#else
|
||||
#define OSD_SIGKILL_Raise_if(CONDITION, MESSAGE)
|
||||
#endif
|
||||
|
@@ -25,7 +25,7 @@ DEFINE_STANDARD_HANDLE(OSD_SIGQUIT, OSD_Signal)
|
||||
|
||||
#if !defined No_Exception && !defined No_OSD_SIGQUIT
|
||||
#define OSD_SIGQUIT_Raise_if(CONDITION, MESSAGE) \
|
||||
if (CONDITION) OSD_SIGQUIT::Raise(MESSAGE);
|
||||
if (CONDITION) throw OSD_SIGQUIT(MESSAGE);
|
||||
#else
|
||||
#define OSD_SIGQUIT_Raise_if(CONDITION, MESSAGE)
|
||||
#endif
|
||||
|
@@ -25,7 +25,7 @@ DEFINE_STANDARD_HANDLE(OSD_SIGSEGV, OSD_Signal)
|
||||
|
||||
#if !defined No_Exception && !defined No_OSD_SIGSEGV
|
||||
#define OSD_SIGSEGV_Raise_if(CONDITION, MESSAGE) \
|
||||
if (CONDITION) OSD_SIGSEGV::Raise(MESSAGE);
|
||||
if (CONDITION) throw OSD_SIGSEGV(MESSAGE);
|
||||
#else
|
||||
#define OSD_SIGSEGV_Raise_if(CONDITION, MESSAGE)
|
||||
#endif
|
||||
|
@@ -25,7 +25,7 @@ DEFINE_STANDARD_HANDLE(OSD_SIGSYS, OSD_Signal)
|
||||
|
||||
#if !defined No_Exception && !defined No_OSD_SIGSYS
|
||||
#define OSD_SIGSYS_Raise_if(CONDITION, MESSAGE) \
|
||||
if (CONDITION) OSD_SIGSYS::Raise(MESSAGE);
|
||||
if (CONDITION) throw OSD_SIGSYS(MESSAGE);
|
||||
#else
|
||||
#define OSD_SIGSYS_Raise_if(CONDITION, MESSAGE)
|
||||
#endif
|
||||
|
@@ -25,7 +25,7 @@ DEFINE_STANDARD_HANDLE(OSD_Signal, Standard_Failure)
|
||||
|
||||
#if !defined No_Exception && !defined No_OSD_Signal
|
||||
#define OSD_Signal_Raise_if(CONDITION, MESSAGE) \
|
||||
if (CONDITION) OSD_Signal::Raise(MESSAGE);
|
||||
if (CONDITION) throw OSD_Signal(MESSAGE);
|
||||
#else
|
||||
#define OSD_Signal_Raise_if(CONDITION, MESSAGE)
|
||||
#endif
|
||||
|
@@ -149,8 +149,7 @@ static LONG CallHandler (DWORD dwExceptionCode,
|
||||
break ;
|
||||
case STATUS_NO_MEMORY:
|
||||
// cout << "CallHandler : STATUS_NO_MEMORY:" << endl ;
|
||||
OSD_Exception_STATUS_NO_MEMORY ::
|
||||
Raise ( "MEMORY ALLOCATION ERROR ( no room in the process heap )" );
|
||||
throw OSD_Exception_STATUS_NO_MEMORY ( "MEMORY ALLOCATION ERROR ( no room in the process heap )" );
|
||||
case EXCEPTION_ACCESS_VIOLATION:
|
||||
// cout << "CallHandler : EXCEPTION_ACCESS_VIOLATION:" << endl ;
|
||||
StringCchPrintfW (buffer, _countof(buffer), L"%s%s%s0x%.8p%s%s%s", L"ACCESS VIOLATION",
|
||||
@@ -288,8 +287,8 @@ static void SIGWntHandler (int signum, int sub_code)
|
||||
CallHandler( EXCEPTION_FLT_INEXACT_RESULT ,0,0) ;
|
||||
break ;
|
||||
default:
|
||||
cout << "SIGWntHandler(default) -> Standard_NumericError::Raise(\"Floating Point Error\");" << endl;
|
||||
Standard_NumericError::Raise("Floating Point Error");
|
||||
cout << "SIGWntHandler(default) -> throw Standard_NumericError(\"Floating Point Error\");" << endl;
|
||||
throw Standard_NumericError("Floating Point Error");
|
||||
break ;
|
||||
}
|
||||
break ;
|
||||
@@ -421,7 +420,7 @@ void OSD::SetSignal (const Standard_Boolean theFloatingSignal)
|
||||
void OSD::ControlBreak () {
|
||||
if ( fCtrlBrk ) {
|
||||
fCtrlBrk = Standard_False;
|
||||
OSD_Exception_CTRL_BREAK :: Raise ( "*** INTERRUPT ***" );
|
||||
throw OSD_Exception_CTRL_BREAK ( "*** INTERRUPT ***" );
|
||||
}
|
||||
} // end OSD :: ControlBreak
|
||||
#if !defined(__MINGW32__) && !defined(__CYGWIN32__)
|
||||
@@ -449,54 +448,54 @@ static LONG __fastcall _osd_raise ( DWORD dwCode, LPSTR msg )
|
||||
switch (dwCode)
|
||||
{
|
||||
case EXCEPTION_ACCESS_VIOLATION:
|
||||
OSD_Exception_ACCESS_VIOLATION::Raise (msg);
|
||||
throw OSD_Exception_ACCESS_VIOLATION(msg);
|
||||
break;
|
||||
case EXCEPTION_ARRAY_BOUNDS_EXCEEDED:
|
||||
OSD_Exception_ARRAY_BOUNDS_EXCEEDED::Raise (msg);
|
||||
throw OSD_Exception_ARRAY_BOUNDS_EXCEEDED(msg);
|
||||
break;
|
||||
case EXCEPTION_DATATYPE_MISALIGNMENT:
|
||||
Standard_ProgramError::Raise (msg);
|
||||
throw Standard_ProgramError(msg);
|
||||
break;
|
||||
case EXCEPTION_ILLEGAL_INSTRUCTION:
|
||||
OSD_Exception_ILLEGAL_INSTRUCTION::Raise (msg);
|
||||
throw OSD_Exception_ILLEGAL_INSTRUCTION(msg);
|
||||
break;
|
||||
case EXCEPTION_IN_PAGE_ERROR:
|
||||
OSD_Exception_IN_PAGE_ERROR::Raise (msg);
|
||||
throw OSD_Exception_IN_PAGE_ERROR(msg);
|
||||
break;
|
||||
case EXCEPTION_INT_DIVIDE_BY_ZERO:
|
||||
Standard_DivideByZero::Raise (msg);
|
||||
throw Standard_DivideByZero(msg);
|
||||
break;
|
||||
case EXCEPTION_INT_OVERFLOW:
|
||||
OSD_Exception_INT_OVERFLOW::Raise (msg);
|
||||
throw OSD_Exception_INT_OVERFLOW(msg);
|
||||
break;
|
||||
case EXCEPTION_INVALID_DISPOSITION:
|
||||
OSD_Exception_INVALID_DISPOSITION::Raise (msg);
|
||||
throw OSD_Exception_INVALID_DISPOSITION(msg);
|
||||
break;
|
||||
case EXCEPTION_NONCONTINUABLE_EXCEPTION:
|
||||
OSD_Exception_NONCONTINUABLE_EXCEPTION::Raise (msg);
|
||||
throw OSD_Exception_NONCONTINUABLE_EXCEPTION(msg);
|
||||
break;
|
||||
case EXCEPTION_PRIV_INSTRUCTION:
|
||||
OSD_Exception_PRIV_INSTRUCTION::Raise (msg);
|
||||
throw OSD_Exception_PRIV_INSTRUCTION(msg);
|
||||
break;
|
||||
case EXCEPTION_STACK_OVERFLOW:
|
||||
OSD_Exception_STACK_OVERFLOW::Raise (msg);
|
||||
throw OSD_Exception_STACK_OVERFLOW(msg);
|
||||
break;
|
||||
case EXCEPTION_FLT_DIVIDE_BY_ZERO:
|
||||
Standard_DivideByZero::Raise (msg);
|
||||
throw Standard_DivideByZero(msg);
|
||||
break;
|
||||
case EXCEPTION_FLT_STACK_CHECK:
|
||||
case EXCEPTION_FLT_OVERFLOW:
|
||||
Standard_Overflow::Raise (msg);
|
||||
throw Standard_Overflow(msg);
|
||||
break;
|
||||
case EXCEPTION_FLT_UNDERFLOW:
|
||||
Standard_Underflow::Raise (msg);
|
||||
throw Standard_Underflow(msg);
|
||||
break;
|
||||
case EXCEPTION_FLT_INVALID_OPERATION:
|
||||
case EXCEPTION_FLT_DENORMAL_OPERAND:
|
||||
case EXCEPTION_FLT_INEXACT_RESULT:
|
||||
case STATUS_FLOAT_MULTIPLE_TRAPS:
|
||||
case STATUS_FLOAT_MULTIPLE_FAULTS:
|
||||
Standard_NumericError::Raise (msg);
|
||||
throw Standard_NumericError(msg);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -650,27 +649,6 @@ typedef void (* SIG_PFV) (int);
|
||||
#include <sys/signal.h>
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_PTHREAD_H) && defined(NO_CXX_EXCEPTION)
|
||||
//============================================================================
|
||||
//==== GetOldSigAction
|
||||
//==== get previous
|
||||
//============================================================================
|
||||
|
||||
static struct sigaction *GetOldSigAction()
|
||||
{
|
||||
static struct sigaction oldSignals[NSIG];
|
||||
return oldSignals;
|
||||
}
|
||||
|
||||
#ifdef SOLARIS
|
||||
static sigfpe_handler_type *GetOldFPE()
|
||||
{
|
||||
static sigfpe_handler_type aIEEEHandler[5] = { NULL, NULL, NULL, NULL, NULL } ;
|
||||
return aIEEEHandler;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//============================================================================
|
||||
//==== Handler
|
||||
//==== Catche the differents signals:
|
||||
@@ -691,11 +669,7 @@ static sigfpe_handler_type *GetOldFPE()
|
||||
//==== SIGSEGV is handled by "SegvHandler()"
|
||||
//============================================================================
|
||||
#ifdef SA_SIGINFO
|
||||
#if defined(HAVE_PTHREAD_H) && defined(NO_CXX_EXCEPTION)
|
||||
static void Handler (const int theSignal, siginfo_t *theSigInfo, const Standard_Address theContext)
|
||||
#else
|
||||
static void Handler (const int theSignal, siginfo_t */*theSigInfo*/, const Standard_Address /*theContext*/)
|
||||
#endif
|
||||
#else
|
||||
static void Handler (const int theSignal)
|
||||
#endif
|
||||
@@ -710,91 +684,6 @@ static void Handler (const int theSignal)
|
||||
perror ("sigaction");
|
||||
}
|
||||
|
||||
#if defined(HAVE_PTHREAD_H) && defined(NO_CXX_EXCEPTION)
|
||||
if (pthread_self() != getOCCThread() || !Standard_ErrorHandler::IsInTryBlock()) {
|
||||
// use the previous signal handler
|
||||
// cout << "OSD::Handler: signal " << (int) theSignal << " occured outside a try block " << endl ;
|
||||
struct sigaction *oldSignals = GetOldSigAction();
|
||||
struct sigaction asigacthandler = oldSignals[theSignal >= 0 && theSignal < NSIG ? theSignal : 0];
|
||||
|
||||
if (asigacthandler.sa_flags & SA_SIGINFO) {
|
||||
void (*aCurInfoHandle)(int, siginfo_t *, void *) = asigacthandler.sa_sigaction;
|
||||
|
||||
siginfo_t * aSigInfo = NULL;
|
||||
#ifdef SA_SIGINFO
|
||||
aSigInfo = theSigInfo;
|
||||
#endif
|
||||
|
||||
if (aSigInfo) {
|
||||
switch (aSigInfo->si_signo) {
|
||||
case SIGFPE:
|
||||
{
|
||||
#ifdef SOLARIS
|
||||
sigfpe_handler_type *aIEEEHandlerTab = GetOldFPE();
|
||||
sigfpe_handler_type aIEEEHandler = NULL;
|
||||
switch (aSigInfo->si_code) {
|
||||
case FPE_INTDIV_TRAP :
|
||||
case FPE_FLTDIV_TRAP :
|
||||
aIEEEHandler = aIEEEHandlerTab[1];
|
||||
break;
|
||||
case FPE_INTOVF_TRAP :
|
||||
case FPE_FLTOVF_TRAP :
|
||||
aIEEEHandler = aIEEEHandlerTab[2];
|
||||
break;
|
||||
case FPE_FLTUND_TRAP :
|
||||
aIEEEHandler = aIEEEHandlerTab[4];
|
||||
break;
|
||||
case FPE_FLTRES_TRAP :
|
||||
aIEEEHandler = aIEEEHandlerTab[3];
|
||||
break;
|
||||
case FPE_FLTINV_TRAP :
|
||||
aIEEEHandler = aIEEEHandlerTab[0];
|
||||
break;
|
||||
case FPE_FLTSUB_TRAP :
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (aIEEEHandler) {
|
||||
// cout << "OSD::Handler: calling previous IEEE signal handler with info" << endl ;
|
||||
(*aIEEEHandler) (theSignal, aSigInfo, theContext);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (aCurInfoHandle) {
|
||||
// cout << "OSD::Handler: calling previous signal handler with info " << aCurInfoHandle << endl ;
|
||||
(*aCurInfoHandle) (theSignal, aSigInfo, theContext);
|
||||
#ifdef OCCT_DEBUG
|
||||
cerr << " previous signal handler return" << endl ;
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
else {
|
||||
// cout << "OSD::Handler: no handler with info for the signal" << endl;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// no siginfo needed for the signal
|
||||
void (*aCurHandler) (int) = asigacthandler.sa_handler;
|
||||
if(aCurHandler) {
|
||||
// cout << "OSD::Handler: calling previous signal handler" << endl ;
|
||||
(*aCurHandler) (theSignal);
|
||||
#ifdef OCCT_DEBUG
|
||||
cerr << " previous signal handler return" << endl ;
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
}
|
||||
// cout << " Signal occured outside a try block, but no handler for it" <<endl;
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
// cout << "OSD::Handler: signal " << (int) theSignal << " occured inside a try block " << endl ;
|
||||
if ( ADR_ACT_SIGIO_HANDLER != NULL )
|
||||
(*ADR_ACT_SIGIO_HANDLER)() ;
|
||||
@@ -913,15 +802,9 @@ static void SegvHandler(const int theSignal,
|
||||
siginfo_t *ip,
|
||||
const Standard_Address theContext)
|
||||
{
|
||||
#ifdef NO_CXX_EXCEPTION
|
||||
if (!Standard_ErrorHandler::IsInTryBlock()) {
|
||||
Handler(theSignal, ip, theContext);
|
||||
return;
|
||||
}
|
||||
#else
|
||||
(void)theSignal; // silence GCC warnings
|
||||
(void)theContext;
|
||||
#endif
|
||||
|
||||
#ifdef __linux__
|
||||
if (fFltExceptions)
|
||||
feenableexcept (FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW);
|
||||
@@ -1149,7 +1032,7 @@ void OSD :: ControlBreak ()
|
||||
{
|
||||
if ( fCtrlBrk ) {
|
||||
fCtrlBrk = Standard_False;
|
||||
OSD_Exception_CTRL_BREAK::Raise ("*** INTERRUPT ***");
|
||||
throw OSD_Exception_CTRL_BREAK("*** INTERRUPT ***");
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user