+++ /dev/null
-// File : VTKViewer_Common.h
-// Created : Wed May 21 11:36:07 2003
-// Author : Michael PONIKAROV
-// Project : SALOME
-// Module : VTKViewer
-// Copyright : Open CASCADE 2002
-// $Header$
-
-#ifndef __VTKViewer_Common_h
-#define __VTKViewer_Common_h
-
-// common vtk include files
-#include <vtkLODActor.h>
-#include <vtkProperty.h>
-#include <vtkTexture.h>
-#include <vtkMapper.h>
-#include <vtkObjectFactory.h>
-#include <vtkPolyDataMapper.h>
-#include <vtkPolyDataNormals.h>
-#include <vtkMath.h>
-#include <vtkPolyData.h>
-#include <vtkTransform.h>
-#include <vtkRenderer.h>
-#include <vtkMatrix4x4.h>
-#include <vtkCamera.h>
-#include <vtkCell.h>
-#include <vtkCommand.h>
-#include <vtkAssemblyNode.h>
-#include <vtkPicker.h>
-#include <vtkPointPicker.h>
-#include <vtkCellPicker.h>
-#include <vtkLine.h>
-#include <vtkUnstructuredGrid.h>
-#include <vtkExtractEdges.h>
-#include <vtkDataSetCollection.h>
-#include <vtkRenderWindowInteractor.h>
-#include <vtkVolumeMapper.h>
-#include <vtkWarpTransform.h>
-#include <vtkVersion.h>
-#include <vtkTextSource.h>
-#include <vtkConeSource.h>
-#include <vtkTextMapper.h>
-#include <vtkMapper2D.h>
-#include <vtkActor2D.h>
-#include <vtkWindowToImageFilter.h>
-#include <vtkTIFFWriter.h>
-#include <vtkCellArray.h>
-#include <vtkTransformPolyDataFilter.h>
-#include <vtkDataSetMapper.h>
-#include <vtkAxes.h>
-#include <vtkActor.h>
-#include <vtkInteractorStyle.h>
-#include <vtkActor2DCollection.h>
-//#include <vtkScalarBarActor.h>
-#include <vtkShrinkFilter.h>
-#include <vtkMaskPoints.h>
-#include <vtkCellCenters.h>
-#include <vtkSelectVisiblePoints.h>
-#include <vtkPointData.h>
-#include <vtkLabeledDataMapper.h>
-#include <vtkProperty2D.h>
-#include <vtkGeometryFilter.h>
-#include <vtkCellData.h>
-#include <vtkLookupTable.h>
-#include <vtkGlyphSource2D.h>
-#include <vtkFloatArray.h>
-#include <vtkWindow.h>
-#include <vtkTextProperty.h>
-
-#endif
+++ /dev/null
-// SALOME OCCViewer : build OCC Viewer into Salome desktop
-//
-// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// 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
-//
-//
-//
-// File : OCCViewer_Selector.cxx
-// Author : Nicolas REJNERI
-// Module : SALOME
-// $Header$
-
-using namespace std;
-/*!
- \class OCCViewer_Selector OCCViewer_Selector.h
- \brief Base class for object selection in Open CASCADE Viewer.
-*/
-
-#include "OCCViewer_Selector.h"
-
-/*!
- Constructor
-*/
-OCCViewer_Selector::OCCViewer_Selector() :
- myNumSelected (0),
- myEnableSelection( true ),
- myEnableMultipleSelection( true )
-{
-}
-
-/*!
- Destructor
-*/
-OCCViewer_Selector::~OCCViewer_Selector()
-{
-}
-
-/*!
- Enables/disables selection
-*/
-void OCCViewer_Selector::enableSelection( bool bEnable )
-{
- myEnableSelection = bEnable;
-}
-
-/*!
- Enables/disables multiple selection i.e
- selection of several objects at the same time.
- If enabled, non-multiple selection is enabled as well.
-*/
-void OCCViewer_Selector::enableMultipleSelection( bool bEnable )
-{
- myEnableMultipleSelection = bEnable;
- if ( bEnable ) myEnableSelection = bEnable;
-}
+++ /dev/null
-// SALOME OCCViewer : build OCC Viewer into Salome desktop
-//
-// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// 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
-//
-//
-//
-// File : OCCViewer_Selector.h
-// Author : Nicolas REJNERI
-// Module : SALOME
-// $Header$
-
-#ifndef OCCViewer_SELECTOR_H
-#define OCCViewer_SELECTOR_H
-
-#include "QAD.h"
-
-// QT Include
-#include <qobject.h>
-
-// Open CASCADE Include
-#include <AIS_InteractiveObject.hxx>
-#include <AIS_ListOfInteractive.hxx>
-
-class QAD_EXPORT OCCViewer_Selector : public QObject
-{
- Q_OBJECT
-
- public:
- OCCViewer_Selector();
- virtual ~OCCViewer_Selector();
-
- public:
- void enableSelection( bool );
- void enableMultipleSelection( bool );
-
- signals:
-
- void selSelectionDone( bool bAdded );
- void selSelectionCancel( bool bAdded );
-
- protected:
-
- int myNumSelected;
- bool myEnableSelection;
- bool myEnableMultipleSelection;
-};
-
-#endif
-
+++ /dev/null
-// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
-//
-// Copyright (C) 2003 CEA/DEN, EDF R&D
-//
-//
-//
-// File : SALOMEDS_Tool.cxx
-// Author : Sergey RUIN
-// Module : SALOME
-
-using namespace std;
-#include "SALOMEDS_Tool.hxx"
-
-#include "utilities.h"
-
-#include <TCollection_AsciiString.hxx>
-#include <stdio.h>
-#include <iostream.h>
-#include <fstream.h>
-#include <OSD_Path.hxx>
-#include <OSD_File.hxx>
-#include <OSD_Directory.hxx>
-#include <OSD_Process.hxx>
-#include <OSD_Directory.hxx>
-#include <OSD_Protection.hxx>
-#include <OSD_SingleProtection.hxx>
-#include <OSD_FileIterator.hxx>
-
-#include <sys/time.h>
-#include <stdlib.h>
-
-//============================================================================
-// function : GetTempDir
-// purpose : Return a temp directory to store created files like "/tmp/sub_dir/"
-//============================================================================
-char* SALOMEDS_Tool::GetTmpDir()
-{
- //Find a temporary directory to store a file
-
- TCollection_AsciiString aTmpDir;
-
- char *Tmp_dir = getenv("SALOME_TMP_DIR");
- if(Tmp_dir != NULL) {
- aTmpDir = TCollection_AsciiString(Tmp_dir);
-#ifdef WIN32
- if(aTmpDir.Value(aTmpDir.Length()) != '\\') aTmpDir+='\\';
-#else
- if(aTmpDir.Value(aTmpDir.Length()) != '/') aTmpDir+='/';
-#endif
- }
- else {
-#ifdef WIN32
- aTmpDir = TCollection_AsciiString("C:\\");
-#else
- aTmpDir = TCollection_AsciiString("/tmp/");
-#endif
- }
-
- srand((unsigned int)time(NULL));
- int aRND = 999 + (int)(100000.0*rand()/(RAND_MAX+1.0)); //Get a random number to present a name of a sub directory
- TCollection_AsciiString aSubDir(aRND);
- if(aSubDir.Length() <= 1) aSubDir = TCollection_AsciiString("123409876");
-
- MESSAGE("#### RND " << aRND);
-
- aTmpDir += aSubDir; //Get RND sub directory
-
-#ifdef WIN32
- if(aTmpDir.Value(aTmpDir.Length()) != '\\') aTmpDir+='\\';
-#else
- if(aTmpDir.Value(aTmpDir.Length()) != '/') aTmpDir+='/';
-#endif
-
- OSD_Path aPath(aTmpDir);
- OSD_Directory aDir(aPath);
-
- for(aRND = 0; aDir.Exists(); aRND++) {
- aTmpDir.Insert((aTmpDir.Length() - 1), TCollection_AsciiString(aRND)); //Build a unique directory name
- aPath = OSD_Path(aTmpDir);
- aDir = OSD_Directory(aPath);
- }
-
- MESSAGE("#### TMP" << aTmpDir.ToCString());
-
- OSD_Protection aProtection(OSD_RW, OSD_RWX, OSD_RX, OSD_RX);
- aDir.Build(aProtection);
-
- return CORBA::string_dup(aTmpDir.ToCString());
-}
-
-//============================================================================
-// function : RemoveTemporaryFiles
-// purpose : Removes files listed in theFileList
-//============================================================================
-void SALOMEDS_Tool::RemoveTemporaryFiles(const char* theDirectory,
- const SALOMEDS::ListOfFileNames& theFiles,
- const bool IsDirDeleted)
-{
- TCollection_AsciiString aDirName(const_cast<char*>(theDirectory));
-
- int i, aLength = theFiles.length();
- for(i=0; i<aLength; i++) {
- TCollection_AsciiString aFile(aDirName);
-// aFile += (char*)theFiles[i];
- aFile += (char*)theFiles[i].in();
- OSD_Path anOSDPath(aFile);
- OSD_File anOSDFile(anOSDPath);
- if(!anOSDFile.Exists()) continue;
-
- anOSDFile.Remove();
- }
-
- if(IsDirDeleted) {
- OSD_Path aPath(aDirName);
- OSD_Directory aDir(aPath);
- OSD_FileIterator anIterator(aPath, '*');
-
- if(aDir.Exists() && !anIterator.More()) aDir.Remove();
- }
-
-}
-
-//============================================================================
-// function : PutFilesToStream
-// purpose : converts the files from a list 'theFiles' to the stream
-//============================================================================
-SALOMEDS::TMPFile*
-SALOMEDS_Tool::PutFilesToStream(const char* theFromDirectory,
- const SALOMEDS::ListOfFileNames& theFiles,
- const int theNamesOnly)
-{
- int i, aLength = theFiles.length();
- if(aLength == 0) return NULL;
-
- TCollection_AsciiString aTmpDir(const_cast<char*>(theFromDirectory)); //Get a temporary directory for saved a file
-
- long aBufferSize = 0;
- long aCurrentPos;
-
- int aNbFiles = 0;
- int* aFileNameSize= new int[aLength];
- long* aFileSize= new long[aLength];
-
- //Determine the required size of the buffer
-
- for(i=0; i<aLength; i++) {
-
- //Check if the file exists
-
- if (!theNamesOnly) { // mpv 15.01.2003: if only file names must be stroed, then size of files is zero
- TCollection_AsciiString aFullPath = aTmpDir + strdup(theFiles[i]);
- OSD_Path anOSDPath(aFullPath);
- OSD_File anOSDFile(anOSDPath);
- if(!anOSDFile.Exists()) continue;
-#ifdef WNT
- ifstream aFile(aFullPath.ToCString(), ios::binary);
-#else
- ifstream aFile(aFullPath.ToCString());
-#endif
- aFile.seekg(0, ios::end);
- aFileSize[i] = aFile.tellg();
- aBufferSize += aFileSize[i]; //Add a space to store the file
- }
- aFileNameSize[i] = strlen(theFiles[i])+1;
- aBufferSize += aFileNameSize[i]; //Add a space to store the file name
- aBufferSize += (theNamesOnly)?4:12; //Add 4 bytes: a length of the file name,
- // 8 bytes: length of the file itself
- aNbFiles++;
- }
-
- aBufferSize += 4; //4 bytes for a number of the files that will be written to the stream;
- unsigned char* aBuffer = new unsigned char[aBufferSize];
- if(aBuffer == NULL) return NULL;
-
- //Initialize 4 bytes of the buffer by 0
- memset(aBuffer, 0, 4);
- //Copy the number of files that will be written to the stream
- memcpy(aBuffer, &aNbFiles, ((sizeof(int) > 4) ? 4 : sizeof(int)));
-
-
- aCurrentPos = 4;
-
- for(i=0; i<aLength; i++) {
- ifstream *aFile;
- if (!theNamesOnly) { // mpv 15.01.2003: we don't open any file if theNamesOnly = true
- TCollection_AsciiString aFullPath = aTmpDir + strdup(theFiles[i]);
- OSD_Path anOSDPath(aFullPath);
- OSD_File anOSDFile(anOSDPath);
- if(!anOSDFile.Exists()) continue;
-#ifdef WNT
- aFile = new ifstream(aFullPath.ToCString(), ios::binary);
-#else
- aFile = new ifstream(aFullPath.ToCString());
-#endif
- }
- //Initialize 4 bytes of the buffer by 0
- memset((aBuffer + aCurrentPos), 0, 4);
- //Copy the length of the file name to the buffer
- memcpy((aBuffer + aCurrentPos), (aFileNameSize + i), ((sizeof(int) > 4) ? 4 : sizeof(int)));
- aCurrentPos += 4;
-
- //Copy the file name to the buffer
- memcpy((aBuffer + aCurrentPos), theFiles[i], aFileNameSize[i]);
- aCurrentPos += aFileNameSize[i];
-
- if (!theNamesOnly) { // mpv 15.01.2003: we don't copy file content to the buffer if !theNamesOnly
- //Initialize 8 bytes of the buffer by 0
- memset((aBuffer + aCurrentPos), 0, 8);
- //Copy the length of the file to the buffer
- memcpy((aBuffer + aCurrentPos), (aFileSize + i), ((sizeof(long) > 8) ? 8 : sizeof(long)));
- aCurrentPos += 8;
-
- aFile->seekg(0, ios::beg);
- aFile->read((char *)(aBuffer + aCurrentPos), aFileSize[i]);
- aFile->close();
- delete(aFile);
- aCurrentPos += aFileSize[i];
- }
- }
-
- delete[] aFileNameSize;
- delete[] aFileSize;
-
-
- CORBA::Octet* anOctetBuf = (CORBA::Octet*)aBuffer;
-
- return (new SALOMEDS::TMPFile(aBufferSize, aBufferSize, anOctetBuf, 1));
-}
-
-//============================================================================
-// function : PutStreamToFile
-// purpose : converts the stream "theStream" to the files
-//============================================================================
-SALOMEDS::ListOfFileNames*
-SALOMEDS_Tool::PutStreamToFiles(const SALOMEDS::TMPFile& theStream,
- const char* theToDirectory,
- const int theNamesOnly)
-{
- if(theStream.length() == 0) return NULL;
- TCollection_AsciiString aTmpDir(const_cast<char*>(theToDirectory)); //Get a temporary directory for saving a file
-
- unsigned char *aBuffer = (unsigned char*)theStream.NP_data();
-
- if(aBuffer == NULL) return NULL;
-
- long aBufferSize = theStream.length();
- long aFileSize, aCurrentPos = 4;
- int i, aFileNameSize, aNbFiles = 0;
-
- //Copy the number of files in the stream
- memcpy(&aNbFiles, aBuffer, sizeof(int));
-
- SALOMEDS::ListOfFileNames_var aFiles = new SALOMEDS::ListOfFileNames;
- aFiles->length(aNbFiles);
-
- for(i=0; i<aNbFiles; i++) {
-
- //Put a length of the file name to aFileNameSize
- memcpy(&aFileNameSize, (aBuffer + aCurrentPos), ((sizeof(int) > 4) ? 4 : sizeof(int)));
- aCurrentPos += 4;
-
- char *aFileName = new char[aFileNameSize];
- //Put a file name to aFileName
- memcpy(aFileName, (aBuffer + aCurrentPos), aFileNameSize);
- aCurrentPos += aFileNameSize;
-
- //Put a length of the file to aFileSize
- if (!theNamesOnly) {
- memcpy(&aFileSize, (aBuffer + aCurrentPos), ((sizeof(long) > 8) ? 8 : sizeof(long)));
- aCurrentPos += 8;
-
- TCollection_AsciiString aFullPath = aTmpDir + aFileName;
- ofstream aFile(aFullPath.ToCString());
- aFile.write((char *)(aBuffer+aCurrentPos), aFileSize);
- aFile.close();
- aCurrentPos += aFileSize;
- }
- aFiles[i] = CORBA::string_dup(aFileName);
- delete[] aFileName;
- }
-
- return aFiles._retn();
-}
-
-//============================================================================
-// function : GetNameFromPath
-// purpose : Returns the name by the path
-//============================================================================
-char* SALOMEDS_Tool::GetNameFromPath(const char* thePath) {
- if (thePath == NULL) return strdup("");
- OSD_Path aPath = OSD_Path(TCollection_AsciiString(strdup(thePath)));
- TCollection_AsciiString aNameString(aPath.Name());
- return CORBA::string_dup(aNameString.ToCString());
-}
-
-//============================================================================
-// function : GetDirFromPath
-// purpose : Returns the dir by the path
-//============================================================================
-char* SALOMEDS_Tool::GetDirFromPath(const char* thePath) {
- if (thePath == NULL) return strdup("");
- OSD_Path aPath = OSD_Path(TCollection_AsciiString(strdup(thePath)));
- TCollection_AsciiString aDirString(aPath.Trek());
- aDirString.ChangeAll('|','/');
- return CORBA::string_dup(aDirString.ToCString());
-}
+++ /dev/null
-// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
-//
-// Copyright (C) 2003 CEA/DEN, EDF R&D
-//
-//
-//
-// File : SALOMEDS_Tool.hxx
-// Author : Sergey RUIN
-// Module : SALOME
-
-#ifndef __SALOMEDS_Tool_H__
-#define __SALOMEDS_Tool_H__
-
-
-
-// IDL headers
-#include <SALOMEDS.hh>
-
-class SALOMEDS_Tool
-{
-public:
-
- // Returns the unique temporary directory, that is defined in SALOME_TMP_DIR if this variable is set
- // otherwise return /tmp/something/ for Unix or c:\something\ for WNT
- static char* GetTmpDir();
-
-
- // Removes files which are in <theDirectory>, the files for deletion are listed in <theFiles>
- // if <IsDirDeleted> is true <theDirectory> is also deleted if it is empty
- static void RemoveTemporaryFiles(const char* theDirectory,
- const SALOMEDS::ListOfFileNames& theFiles,
- const bool IsDirDeleted);
-
- // Converts files listed in <theFiles> which are in <theFromDirectory> into a byte sequence TMPFile
- static SALOMEDS::TMPFile* PutFilesToStream(const char* theFromDirectory,
- const SALOMEDS::ListOfFileNames& theFiles,
- const int theNamesOnly = 0);
-
- // Converts a byte sequence <theStream> to files and places them in <theToDirectory>
- static SALOMEDS::ListOfFileNames* PutStreamToFiles(const SALOMEDS::TMPFile& theStream,
- const char* theToDirectory,
- const int theNamesOnly = 0);
-
- // Returns the name by the path
- // for an example: if thePath = "/tmp/aaa/doc1.hdf" the function returns "doc1"
- static char* GetNameFromPath(const char* thePath);
-
- // Returns the directory by the path
- // for an example: if thePath = "/tmp/aaa/doc1.hdf" the function returns "/tmp/aaa"
- static char* GetDirFromPath(const char* thePath);
-
-};
-#endif
+++ /dev/null
-// KERNEL Utils : common utils for KERNEL
-// Copyright (C) 2003 CEA
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// 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.salome-platform.org or email : webmaster.salome@opencascade.org
-//
-//
-//
-// File : Utils_CatchSignals.cxx
-// Author : Oksana Tchebanova
-// Module : KERNEL
-// $Header:
-
-
-#include "Utils_CatchSignals.h"
-#include "utilities.h"
-
-#include <stdexcept>
-
-#define RESERVE_SIZE 100000
-
-static void* theCallBack = NULL;
-static int *myReserve = NULL;
-using namespace std;
-//=======================================================================
-//function : Utils_CatchSignals
-//purpose : Constructor
-//=======================================================================
-Utils_CatchSignals::Utils_CatchSignals()
- :myIsActivated(false)
-{
-
- for(int i = 0; i<SIG_MAX_NUM; i++)
- mySigStates[i] = NULL;
-
- theCallBack = NULL;
-}
-
-#ifndef WNT
-
-//================================ UNIX part ==================================================
-
-
-//==============================
-typedef void (ACT_SIGIO_HANDLER)(void) ;
-
-ACT_SIGIO_HANDLER *ADR_ACT_SIGIO_HANDLER = NULL ;
-
-typedef void (* SIG_PFV) (int);
-
-#ifdef SUN
-# include <floatingpoint.h>
-#endif
-
-#ifdef SOLARIS
-# include <floatingpoint.h>
-# include <sys/machsig.h>
-# include <stdlib.h>
-# include <stdio.h>
-#endif
-
-#include <signal.h>
-#include <sys/signal.h>
-
-#ifdef LIN
-# include <stdlib.h>
-# include <stdio.h>
-#else
-# ifdef SA_SIGINFO
-# ifndef AIX
-# include <bits/siginfo.h>
-# endif
-# endif
-#endif
-
-
-#ifdef IRIX
-# include <sigfpe.h>
-# include <sys/siginfo.h>
-#endif
-
-#include <unistd.h>
-//============================================================================
-//function : Handler
-//purpose : univisal handler for signals
-//============================================================================
-static void Handler(const int theSig )
-{
- if (myReserve) {
- delete myReserve;
- myReserve = NULL;
- }
- char aMessage[1000];
-
-#if defined __GNUC__
- #if __GNUC__ == 2
- #define __GNUC_2__
- #endif
-#endif
-#if defined __GNUC_2__
- const char* message = "La fonction strsignal n'est pas supportée par gcc2.95.4";
- sprintf (aMessage, "%d signal cautch : %s", theSig, message);
-#else
- sprintf (aMessage, "%d signal cautch : %s", theSig, strsignal(theSig));
-#endif
-
-
- MESSAGE("Utils_CatchSignal Handler :: " << aMessage );
- if(theCallBack == NULL) {
- MESSAGE("Utils_CatchSignal Handler : throw std::runtime_error()");
- throw (std::runtime_error(aMessage));
- }
- else ((void (*)())theCallBack)();
-}
-//=======================================================================
-//function : TryHandlerReset
-//purpose : Redefine signal handlers. If the handler of the signal is
-// set as SIG_IGN. That's why the shells often ignore some
-// signal when starting child processes. We keep it.
-//=======================================================================
-static SIG_PFV TryHandlerReset( int theSigNum )
-{
- if (signal(theSigNum, (SIG_PFV) &Handler) == SIG_IGN)
- {
- signal(theSigNum, SIG_IGN);
- MESSAGE("signal "<<theSigNum <<" is kept as ignored");
- return SIG_IGN;
- }
- else return signal(theSigNum, (SIG_PFV) &Handler);
-}
-//=======================================================================
-//function : Activate
-//purpose :
-//=======================================================================
-
-void Utils_CatchSignals::Activate()
-{
- if(myIsActivated) return;
-
- if (myReserve) delete myReserve;
- myReserve = new int[RESERVE_SIZE];
-
-
- mySigStates[0] = TryHandlerReset(SIGHUP); // ...... floating point exception
- mySigStates[1] = TryHandlerReset(SIGFPE); // ...... floating point exception
-
- mySigStates[2] = TryHandlerReset(SIGINT); // ...... interrupt
- mySigStates[3] = TryHandlerReset(SIGQUIT); // ...... quit
- mySigStates[4] = TryHandlerReset(SIGBUS); // ...... bus error
- mySigStates[5] = TryHandlerReset(SIGILL); // ...... illegal instruction
- mySigStates[6] = TryHandlerReset(SIGTERM); // ...... termination
- mySigStates[7] = TryHandlerReset(SIGSEGV); // ...... segmentation
- //mySigStates[8] = TryHandlerReset (SIGABRT); // ...... abort (ANSI).
- mySigStates[9] = TryHandlerReset(SIGSTKFLT);// ...... stack fault.
-
- myIsActivated = true;
-}
-
-//=======================================================================
-//function : Deactivate
-//purpose :
-//=======================================================================
-void Utils_CatchSignals::Deactivate()
-{
- if(!myIsActivated) return;
-
- signal(SIGHUP, (SIG_PFV)mySigStates[0]); // ...... hangup
- signal(SIGFPE, (SIG_PFV)mySigStates[1]); // ...... floating point exception
- signal(SIGINT, (SIG_PFV)mySigStates[2]); // ...... interrupt
- signal(SIGQUIT,(SIG_PFV)mySigStates[3]); // ...... quit
- signal(SIGBUS, (SIG_PFV)mySigStates[4]); // ...... bus error
- signal(SIGILL, (SIG_PFV)mySigStates[5]); // ...... illegal instruction
- signal(SIGTERM,(SIG_PFV)mySigStates[6]); // ...... illegal instruction
- signal(SIGSEGV,(SIG_PFV)mySigStates[7]); // ...... segmentation violation
- //signal(SIGABRT,(SIG_PFV)mySigStates[8] ); // ...... abort (ANSI).
- signal(SIGSTKFLT,(SIG_PFV)mySigStates[9]); // ...... stack fault.
-
- myIsActivated = false;
- delete myReserve;
- myReserve = NULL;
-}
-#endif // ifndef WNT
-
-//=======================================================================
-//function : SetCallBack
-//purpose : Sets pointer to (void (*)()
-//=======================================================================
-void Utils_CatchSignals::SetCallBack(const int theAddressHiPart,
- const int theAddressLowPart)
-{
- theCallBack = (void *)((theAddressHiPart << 32 ) + theAddressLowPart);
-}
-
-//=======================================================================
-//function : UnsetCallBack
-//purpose :
-//=======================================================================
-void Utils_CatchSignals::UnsetCallBack()
-{
- theCallBack = NULL;
-}
-
-//=======================================================================
-//function : Destroy
-//purpose :
-//=======================================================================
-void Utils_CatchSignals::Destroy()
-{
- if(myIsActivated) Deactivate();
-}
-
-bool Utils_CatchSignals::ReserveMemory()
-{
- if (!myReserve) myReserve = new int [RESERVE_SIZE];
- return true;
-}
-
-void Utils_CatchSignals::FreeReserved()
-{
- if (myReserve)
- {delete myReserve ; myReserve = NULL;}
-}
+++ /dev/null
-// KERNEL Utils : common utils for KERNEL
-// Copyright (C) 2003 CEA
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// 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.salome-platform.org or email : webmaster.salome@opencascade.org
-//
-//
-//
-// File : Utils_CatchSignals.h
-// Author : Oksana Tchebanova
-// Module : KERNEL
-// $Header:
-
-#ifndef _UTILS_CATCHSIGNALS_H_
-#define _UTILS_CATCHSIGNALS_H_
-
-#include <stdio.h>
-#define SIG_MAX_NUM 11
-
-typedef void (* SIG_PFV) (int);
-
-class Utils_CatchSignals {
-
- public:
- Utils_CatchSignals();
- void Destroy() ;
- ~Utils_CatchSignals()
- {
- Destroy();
- }
-
- static void SetCallBack(const int theAddressHiPart,const int theAddressLowPart) ;
- static void UnsetCallBack() ;
- void Activate();
- void Deactivate() ;
- bool ReserveMemory();
- void FreeReserved();
-
-private:
-
- SIG_PFV mySigStates[SIG_MAX_NUM];
- int myFloatOpWord;
- bool myIsActivated;
-};
-
-#endif