mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-14 13:30:48 +03:00
0024002: Overall code and build procedure refactoring -- automatic
Automatic upgrade of OCCT code by command "occt_upgrade . -nocdl": - WOK-generated header files from inc and sources from drv are moved to src - CDL files removed - All packages are converted to nocdlpack
This commit is contained in:
110
src/OSD/FILES
110
src/OSD/FILES
@@ -1,23 +1,99 @@
|
||||
EXTERNLIB
|
||||
OSD_CMPLRS.edl
|
||||
OSD_Function.hxx
|
||||
OSD.cxx
|
||||
OSD.hxx
|
||||
OSD_Chronometer.cxx
|
||||
OSD_Chronometer.hxx
|
||||
OSD_Directory.cxx
|
||||
OSD_Directory.hxx
|
||||
OSD_DirectoryIterator.cxx
|
||||
OSD_DirectoryIterator.hxx
|
||||
OSD_Disk.cxx
|
||||
OSD_Disk.hxx
|
||||
OSD_Environment.cxx
|
||||
OSD_Environment.hxx
|
||||
OSD_EnvironmentIterator.cxx
|
||||
OSD_EnvironmentIterator.hxx
|
||||
OSD_Error.cxx
|
||||
OSD_Error.hxx
|
||||
OSD_ErrorList.hxx
|
||||
OSD_Exception.hxx
|
||||
OSD_Exception_ACCESS_VIOLATION.hxx
|
||||
OSD_Exception_ARRAY_BOUNDS_EXCEEDED.hxx
|
||||
OSD_Exception_CTRL_BREAK.hxx
|
||||
OSD_Exception_FLT_DENORMAL_OPERAND.hxx
|
||||
OSD_Exception_FLT_DIVIDE_BY_ZERO.hxx
|
||||
OSD_Exception_FLT_INEXACT_RESULT.hxx
|
||||
OSD_Exception_FLT_INVALID_OPERATION.hxx
|
||||
OSD_Exception_FLT_OVERFLOW.hxx
|
||||
OSD_Exception_FLT_STACK_CHECK.hxx
|
||||
OSD_Exception_FLT_UNDERFLOW.hxx
|
||||
OSD_Exception_ILLEGAL_INSTRUCTION.hxx
|
||||
OSD_Exception_IN_PAGE_ERROR.hxx
|
||||
OSD_Exception_INT_DIVIDE_BY_ZERO.hxx
|
||||
OSD_Exception_INT_OVERFLOW.hxx
|
||||
OSD_Exception_INVALID_DISPOSITION.hxx
|
||||
OSD_Exception_NONCONTINUABLE_EXCEPTION.hxx
|
||||
OSD_Exception_PRIV_INSTRUCTION.hxx
|
||||
OSD_Exception_STACK_OVERFLOW.hxx
|
||||
OSD_Exception_STATUS_NO_MEMORY.hxx
|
||||
OSD_File.cxx
|
||||
OSD_File.hxx
|
||||
OSD_FileIterator.cxx
|
||||
OSD_FileIterator.hxx
|
||||
OSD_FileNode.cxx
|
||||
OSD_FileNode.hxx
|
||||
OSD_FromWhere.hxx
|
||||
OSD_Function.hxx
|
||||
OSD_Host.cxx
|
||||
OSD_Host.hxx
|
||||
OSD_KindFile.hxx
|
||||
OSD_LoadMode.hxx
|
||||
OSD_LockType.hxx
|
||||
OSD_MAllocHook.cxx
|
||||
OSD_MAllocHook.hxx
|
||||
OSD_MemInfo.cxx
|
||||
OSD_MemInfo.hxx
|
||||
OSD_OEMType.hxx
|
||||
OSD_OpenFile.cxx
|
||||
OSD_OpenFile.hxx
|
||||
OSD_OpenMode.hxx
|
||||
OSD_OSDError.hxx
|
||||
OSD_Parallel.cxx
|
||||
OSD_Parallel.hxx
|
||||
OSD_Path.cxx
|
||||
OSD_Path.hxx
|
||||
OSD_PerfMeter.cxx
|
||||
OSD_PerfMeter.h
|
||||
OSD_PerfMeter.hxx
|
||||
OSD_Printer.cxx
|
||||
OSD_Printer.hxx
|
||||
OSD_Process.cxx
|
||||
OSD_Process.hxx
|
||||
OSD_Protection.cxx
|
||||
OSD_Protection.hxx
|
||||
OSD_PThread.hxx
|
||||
OSD_SharedLibrary.cxx
|
||||
OSD_SharedLibrary.hxx
|
||||
OSD_SIGBUS.hxx
|
||||
OSD_SIGHUP.hxx
|
||||
OSD_SIGILL.hxx
|
||||
OSD_SIGINT.hxx
|
||||
OSD_SIGKILL.hxx
|
||||
OSD_signal.cxx
|
||||
OSD_Signal.hxx
|
||||
OSD_signal_WNT.cxx
|
||||
OSD_SIGQUIT.hxx
|
||||
OSD_SIGSEGV.hxx
|
||||
OSD_SIGSYS.hxx
|
||||
OSD_SingleProtection.hxx
|
||||
OSD_SysType.hxx
|
||||
OSD_Thread.cxx
|
||||
OSD_Thread.hxx
|
||||
OSD_ThreadFunction.hxx
|
||||
OSD_Timer.cxx
|
||||
OSD_Timer.hxx
|
||||
OSD_WhoAmI.hxx
|
||||
OSD_WNT.cxx
|
||||
OSD_WNT.hxx
|
||||
OSD_WNT_1.hxx
|
||||
OSD_WNT_BREAK.hxx
|
||||
OSD_signal.cxx
|
||||
OSD_signal_WNT.cxx
|
||||
OSD_ThreadFunction.hxx
|
||||
OSD_PThread.hxx
|
||||
OSD_PerfMeter.cxx
|
||||
OSD_PerfMeter.h
|
||||
OSD_PerfMeter.hxx
|
||||
OSD_MAllocHook.cxx
|
||||
OSD_MAllocHook.hxx
|
||||
OSD_MemInfo.hxx
|
||||
OSD_MemInfo.cxx
|
||||
OSD_Parallel.hxx
|
||||
OSD_Parallel.cxx
|
||||
OSD_OpenFile.hxx
|
||||
OSD_OpenFile.cxx
|
||||
|
282
src/OSD/OSD.cdl
282
src/OSD/OSD.cdl
@@ -1,282 +0,0 @@
|
||||
-- Copyright (c) 1992-1999 Matra Datavision
|
||||
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
--
|
||||
-- This file is part of Open CASCADE Technology software library.
|
||||
--
|
||||
-- This library is free software; you can redistribute it and/or modify it under
|
||||
-- the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
-- by the Free Software Foundation, with special exception defined in the file
|
||||
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
-- distribution for complete text of the license and disclaimer of any warranty.
|
||||
--
|
||||
-- Alternatively, this file may be used under the terms of Open CASCADE
|
||||
-- commercial license or contractual agreement.
|
||||
|
||||
-- Update:
|
||||
-- 20-01-2009 : ABD Integration support of system fonts (using FTGL and FreeType)
|
||||
|
||||
package OSD
|
||||
|
||||
---History:
|
||||
-- Version Date Purpose
|
||||
-- 1.1 24/06/92 Operating System Dependent tools
|
||||
-- 1.2
|
||||
-- 2.0
|
||||
-- 3.0
|
||||
-- Windows NT 30/09/96 ( EUG )
|
||||
---Purpose: Set of Operating Sytem Dependent Tools
|
||||
-- (O)perating (S)ystem (D)ependent
|
||||
|
||||
uses
|
||||
|
||||
Standard ,
|
||||
Quantity ,
|
||||
TCollection
|
||||
|
||||
is
|
||||
|
||||
exception OSDError inherits Failure from Standard ;
|
||||
|
||||
imported Function;
|
||||
--- C++: alias "typedef int (* OSD_Function)(...);"
|
||||
|
||||
enumeration OEMType is Unavailable,SUN,DEC,SGI,NEC,MAC,PC,HP,IBM,VAX,LIN,AIX;
|
||||
---Purpose: This is set of possible machine types
|
||||
-- used in OSD_Host::MachineType
|
||||
|
||||
enumeration SysType is Unknown,Default,UnixBSD, UnixSystemV, VMS, OS2,
|
||||
OSF, MacOs, Taligent, WindowsNT, LinuxREDHAT,Aix;
|
||||
---Purpose: Thisd is a set of possible system types.
|
||||
-- 'Default' means SysType of machine operating this process.
|
||||
-- This can be used with the Path class.
|
||||
-- All UNIX-like are grouped under "UnixBSD" or "UnixSystemV".
|
||||
-- Such systems are Solaris, NexTOS ...
|
||||
-- A category of systems accept MSDOS-like path such as
|
||||
-- WindowsNT and OS2.
|
||||
|
||||
enumeration FromWhere is FromBeginning, FromHere, FromEnd;
|
||||
---Purpose: Used by OSD_File in the method Seek.
|
||||
|
||||
enumeration LockType is NoLock, ReadLock, WriteLock, ExclusiveLock;
|
||||
---Purpose: locks for files.
|
||||
-- NoLock is the default value when opening a file.
|
||||
--
|
||||
-- ReadLock allows only one reading of the file at a time.
|
||||
--
|
||||
-- WriteLock prevents others writing into a file(excepted the user
|
||||
-- who puts the lock)but allows everybody to read.
|
||||
--
|
||||
-- ExclusiveLock prevents reading and writing except for the
|
||||
-- current user of the file.
|
||||
-- So ExclusiveLock means only one user on the file and this
|
||||
-- user is the one who puts the lock.
|
||||
|
||||
enumeration SingleProtection is None,R,W,RW,X,RX,WX,RWX,D,RD,WD,RWD,XD,RXD,WXD,RWXD;
|
||||
---Purpose: Access rights for files.
|
||||
-- R means Read, W means Write, X means eXecute and D means Delete.
|
||||
-- On UNIX, the right to Delete is combined with Write access.
|
||||
-- So if "W"rite is not set and "D"elete is, "W"rite will be set
|
||||
-- and if "W" is set, "D" will be too.
|
||||
|
||||
enumeration OpenMode is ReadOnly, WriteOnly, ReadWrite;
|
||||
---Purpose: Specifies the file open mode.
|
||||
|
||||
enumeration LoadMode is RTLD_LAZY, RTLD_NOW;
|
||||
---Purpose: This enumeration is used to load shareable libraries.
|
||||
|
||||
enumeration KindFile is FILE, DIRECTORY, LINK, SOCKET, UNKNOWN;
|
||||
---Purpose: Specifies the type of files.
|
||||
|
||||
private enumeration WhoAmI is WDirectory, WDirectoryIterator,
|
||||
WEnvironment, WFile, WFileNode, WFileIterator,
|
||||
WPath, WProcess, WProtection, WHost, WDisk,
|
||||
WChronometer, WTimer, WPackage, WPrinter,
|
||||
WEnvironmentIterator;
|
||||
---Purpose: Allows great accuracy for error management.
|
||||
-- This is private.
|
||||
|
||||
class Error;
|
||||
|
||||
class Protection;
|
||||
|
||||
class Path;
|
||||
|
||||
deferred class FileNode;
|
||||
|
||||
class Disk;
|
||||
|
||||
class File;
|
||||
|
||||
class FileIterator;
|
||||
|
||||
class Directory;
|
||||
|
||||
class DirectoryIterator;
|
||||
|
||||
class Chronometer;
|
||||
|
||||
class Timer;
|
||||
|
||||
class Printer;
|
||||
|
||||
class Host;
|
||||
|
||||
class Environment;
|
||||
|
||||
class EnvironmentIterator;
|
||||
|
||||
class Process;
|
||||
|
||||
class SharedLibrary;
|
||||
|
||||
imported MemInfo;
|
||||
imported PThread;
|
||||
imported ThreadFunction;
|
||||
class Thread;
|
||||
---Purpose: A tool to manage threads
|
||||
|
||||
-----------------------------------------------
|
||||
-- UNIX specific exceptions and enumeration --
|
||||
-----------------------------------------------
|
||||
|
||||
exception Signal inherits Failure from Standard;
|
||||
exception SIGHUP inherits Signal;
|
||||
exception SIGINT inherits Signal;
|
||||
exception SIGQUIT inherits Signal;
|
||||
exception SIGILL inherits Signal;
|
||||
exception SIGKILL inherits Signal;
|
||||
exception SIGBUS inherits Signal;
|
||||
exception SIGSEGV inherits Signal;
|
||||
exception SIGSYS inherits Signal;
|
||||
|
||||
----------------------------------------
|
||||
-- Exceptions ( Windows NT specific ) --
|
||||
----------------------------------------
|
||||
|
||||
exception Exception inherits Failure from Standard;
|
||||
|
||||
exception Exception_ACCESS_VIOLATION inherits Exception;
|
||||
exception Exception_ARRAY_BOUNDS_EXCEEDED inherits Exception;
|
||||
exception Exception_FLT_DENORMAL_OPERAND inherits Exception;
|
||||
exception Exception_FLT_DIVIDE_BY_ZERO inherits Exception;
|
||||
exception Exception_FLT_INEXACT_RESULT inherits Exception;
|
||||
exception Exception_FLT_INVALID_OPERATION inherits Exception;
|
||||
exception Exception_FLT_OVERFLOW inherits Exception;
|
||||
exception Exception_FLT_STACK_CHECK inherits Exception;
|
||||
exception Exception_FLT_UNDERFLOW inherits Exception;
|
||||
exception Exception_ILLEGAL_INSTRUCTION inherits Exception;
|
||||
exception Exception_IN_PAGE_ERROR inherits Exception;
|
||||
exception Exception_INT_DIVIDE_BY_ZERO inherits Exception;
|
||||
exception Exception_INT_OVERFLOW inherits Exception;
|
||||
exception Exception_INVALID_DISPOSITION inherits Exception;
|
||||
exception Exception_NONCONTINUABLE_EXCEPTION inherits Exception;
|
||||
exception Exception_PRIV_INSTRUCTION inherits Exception;
|
||||
exception Exception_STACK_OVERFLOW inherits Exception;
|
||||
exception Exception_STATUS_NO_MEMORY inherits Exception; -- generating by 'HeapAlloc'
|
||||
exception Exception_CTRL_BREAK inherits Exception; -- generating by 'Ctrl-C' keystroke
|
||||
|
||||
SetSignal(theFloatingSignal: Boolean = Standard_True);
|
||||
---Purpose:
|
||||
-- Sets signal and exception handlers.
|
||||
-- <b>Windows-specific notes<\b>
|
||||
-- Compiled with MS VC++ sets 3 main handlers:
|
||||
-- @li Signal handlers (via ::signal() functions) that translate system signals
|
||||
-- (SIGSEGV, SIGFPE, SIGILL) into C++ exceptions (classes inheriting
|
||||
-- Standard_Failure). They only be called if user calls ::raise() function
|
||||
-- with one of supported signal type set.
|
||||
-- @li Exception handler OSD::WntHandler() (via ::SetUnhandledExceptionFilter())
|
||||
-- that will be used when user's code is compiled with /EHs option.
|
||||
-- @li Structured exception (SE) translator (via _set_se_translator()) that
|
||||
-- translates SE exceptions (aka asynchronous exceptions) into the
|
||||
-- C++ exceptions inheriting Standard_Failure. This translator will be
|
||||
-- used when user's code is compiled with /EHa option.
|
||||
-- .
|
||||
-- This approach ensures that regardless of the option the user chooses to
|
||||
-- compile his code with (/EHs or /EHa), signals (or SE exceptions) will be
|
||||
-- translated into Open CASCADE C++ exceptions.
|
||||
-- .
|
||||
-- If @a theFloatingSignal is TRUE then floating point exceptions will be
|
||||
-- generated in accordance with the mask
|
||||
-- <tt>_EM_INVALID | _EM_DENORMAL | _EM_ZERODIVIDE | _EM_OVERFLOW<\tt> that is
|
||||
-- used to call ::_controlfp() system function. If @a theFloatingSignal is FALSE
|
||||
-- corresponding operations (e.g. division by zero) will gracefully complete
|
||||
-- without an exception.
|
||||
-- .
|
||||
-- <b>Unix-specific notes<\b>
|
||||
-- OSD::SetSignal() sets handlers (via ::sigaction()) for multiple signals
|
||||
-- (SIGFPE, SIGSEGV, etc). Currently the number of handled signals is much
|
||||
-- greater than for Windows, in the future this may change to provide better
|
||||
-- consistency with Windows.
|
||||
-- .
|
||||
-- @a theFloatingSignal is recognized on Sun Solaris, Linux, and SGI Irix to
|
||||
-- generate floating-point exception according to the mask
|
||||
-- <tt>FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW</tt> (in Linux conventions).<br>
|
||||
-- When compiled with OBJS macro defined, already set signal handlers (e.g.
|
||||
-- by Data Base Managers) are not redefined.
|
||||
-- .
|
||||
-- <b>Common notes<\b>
|
||||
-- If OSD::SetSignal() method is used in at least one thread, it must also be
|
||||
-- called in any other thread where Open CASCADE will be used, to ensure
|
||||
-- consistency of behavior. Its @a aFloatingSignal argument must be consistent
|
||||
-- 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
|
||||
-- user's code. Refer to Foundation Classes User's Guide for further details.
|
||||
--
|
||||
|
||||
AvailableMemory returns Integer from Standard;
|
||||
---Purpose: Returns available memory in Kilobytes.
|
||||
---Level: Advanced
|
||||
|
||||
SecSleep(aDelay: Integer from Standard);
|
||||
---Purpose: Commands the process to sleep for a number of seconds.
|
||||
---Level: Public
|
||||
|
||||
MilliSecSleep(aDelay: Integer from Standard);
|
||||
---Purpose: Commands the process to sleep for a number of milliseconds
|
||||
---Level: Public
|
||||
|
||||
RealToCString(aReal: Real; aString:out PCharacter)
|
||||
returns Boolean ;
|
||||
---Purpose:
|
||||
-- Converts aReal into aCstring in exponential format with a period as
|
||||
-- decimal point, no thousand separator and no grouping of digits.
|
||||
-- The conversion is independant from the current locale
|
||||
---Level: Public
|
||||
|
||||
CStringToReal(aString: CString; aReal: out Real) returns Boolean ;
|
||||
---Purpose:
|
||||
-- Converts aCstring representing a real with a period as
|
||||
-- decimal point, no thousand separator and no grouping of digits
|
||||
-- into aReal .
|
||||
-- The conversion is independant from the current locale.
|
||||
---Level: Public
|
||||
|
||||
IsDivisible(aDividend, aDivisor: Real from Standard)
|
||||
returns Boolean from Standard;
|
||||
---Purpose: Tests if the quotient theDividend/theDivisor
|
||||
-- does not overflow
|
||||
---Level: Public
|
||||
|
||||
GetExponent(aReal: Real from Standard)
|
||||
returns Integer from Standard;
|
||||
---Purpose: Returns the exponent in base 2 of a floating-point number.
|
||||
---Level: Public
|
||||
|
||||
GetMantissa(aReal: Real from Standard)
|
||||
returns Real from Standard;
|
||||
---Purpose: Returns the mantissa of a floating-point number.
|
||||
---Level: Public
|
||||
|
||||
-------------------------
|
||||
-- Windows NT specific --
|
||||
-------------------------
|
||||
|
||||
ControlBreak raises Exception_CTRL_BREAK;
|
||||
---Purpose: since Windows NT does not support 'SIGINT' signal like UNIX,
|
||||
-- then this method checks whether Ctrl-Break keystroke was or
|
||||
-- not. If yes then raises Exception_CTRL_BREAK.
|
||||
|
||||
end OSD;
|
@@ -12,10 +12,12 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#include <OSD.ixx>
|
||||
|
||||
#include <OSD.hxx>
|
||||
#include <Standard_Stream.hxx>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
#if defined(isfinite)
|
||||
# define finite isfinite
|
||||
#endif
|
||||
|
185
src/OSD/OSD.hxx
Normal file
185
src/OSD/OSD.hxx
Normal file
@@ -0,0 +1,185 @@
|
||||
// Copyright (c) 1992-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _OSD_HeaderFile
|
||||
#define _OSD_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
#include <Standard_Handle.hxx>
|
||||
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <Standard_Real.hxx>
|
||||
#include <Standard_PCharacter.hxx>
|
||||
#include <Standard_CString.hxx>
|
||||
class OSD_Error;
|
||||
class OSD_Protection;
|
||||
class OSD_Path;
|
||||
class OSD_FileNode;
|
||||
class OSD_Disk;
|
||||
class OSD_File;
|
||||
class OSD_FileIterator;
|
||||
class OSD_Directory;
|
||||
class OSD_DirectoryIterator;
|
||||
class OSD_Chronometer;
|
||||
class OSD_Timer;
|
||||
class OSD_Printer;
|
||||
class OSD_Host;
|
||||
class OSD_Environment;
|
||||
class OSD_EnvironmentIterator;
|
||||
class OSD_Process;
|
||||
class OSD_SharedLibrary;
|
||||
class OSD_Thread;
|
||||
|
||||
|
||||
//! Set of Operating Sytem Dependent Tools
|
||||
//! (O)perating (S)ystem (D)ependent
|
||||
class OSD
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
//! A tool to manage threads
|
||||
//!
|
||||
//! Sets signal and exception handlers.
|
||||
//! <b>Windows-specific notes<\b>
|
||||
//! Compiled with MS VC++ sets 3 main handlers:
|
||||
//! @li Signal handlers (via ::signal() functions) that translate system signals
|
||||
//! (SIGSEGV, SIGFPE, SIGILL) into C++ exceptions (classes inheriting
|
||||
//! Standard_Failure). They only be called if user calls ::raise() function
|
||||
//! with one of supported signal type set.
|
||||
//! @li Exception handler OSD::WntHandler() (via ::SetUnhandledExceptionFilter())
|
||||
//! that will be used when user's code is compiled with /EHs option.
|
||||
//! @li Structured exception (SE) translator (via _set_se_translator()) that
|
||||
//! translates SE exceptions (aka asynchronous exceptions) into the
|
||||
//! C++ exceptions inheriting Standard_Failure. This translator will be
|
||||
//! used when user's code is compiled with /EHa option.
|
||||
//!
|
||||
//! This approach ensures that regardless of the option the user chooses to
|
||||
//! compile his code with (/EHs or /EHa), signals (or SE exceptions) will be
|
||||
//! translated into Open CASCADE C++ exceptions.
|
||||
//!
|
||||
//! If @a theFloatingSignal is TRUE then floating point exceptions will be
|
||||
//! generated in accordance with the mask
|
||||
//! <tt>_EM_INVALID | _EM_DENORMAL | _EM_ZERODIVIDE | _EM_OVERFLOW<\tt> that is
|
||||
//! used to call ::_controlfp() system function. If @a theFloatingSignal is FALSE
|
||||
//! corresponding operations (e.g. division by zero) will gracefully complete
|
||||
//! without an exception.
|
||||
//!
|
||||
//! <b>Unix-specific notes<\b>
|
||||
//! OSD::SetSignal() sets handlers (via ::sigaction()) for multiple signals
|
||||
//! (SIGFPE, SIGSEGV, etc). Currently the number of handled signals is much
|
||||
//! greater than for Windows, in the future this may change to provide better
|
||||
//! consistency with Windows.
|
||||
//!
|
||||
//! @a theFloatingSignal is recognized on Sun Solaris, Linux, and SGI Irix to
|
||||
//! generate floating-point exception according to the mask
|
||||
//! <tt>FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW</tt> (in Linux conventions).<br>
|
||||
//! When compiled with OBJS macro defined, already set signal handlers (e.g.
|
||||
//! by Data Base Managers) are not redefined.
|
||||
//!
|
||||
//! <b>Common notes<\b>
|
||||
//! If OSD::SetSignal() method is used in at least one thread, it must also be
|
||||
//! called in any other thread where Open CASCADE will be used, to ensure
|
||||
//! consistency of behavior. Its @a aFloatingSignal argument must be consistent
|
||||
//! 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
|
||||
//! user's code. Refer to Foundation Classes User's Guide for further details.
|
||||
Standard_EXPORT static void SetSignal (const Standard_Boolean theFloatingSignal = Standard_True);
|
||||
|
||||
//! Returns available memory in Kilobytes.
|
||||
Standard_EXPORT static Standard_Integer AvailableMemory();
|
||||
|
||||
//! Commands the process to sleep for a number of seconds.
|
||||
Standard_EXPORT static void SecSleep (const Standard_Integer aDelay);
|
||||
|
||||
//! Commands the process to sleep for a number of milliseconds
|
||||
Standard_EXPORT static void MilliSecSleep (const Standard_Integer aDelay);
|
||||
|
||||
|
||||
//! Converts aReal into aCstring in exponential format with a period as
|
||||
//! decimal point, no thousand separator and no grouping of digits.
|
||||
//! The conversion is independant from the current locale
|
||||
Standard_EXPORT static Standard_Boolean RealToCString (const Standard_Real aReal, Standard_PCharacter& aString);
|
||||
|
||||
|
||||
//! Converts aCstring representing a real with a period as
|
||||
//! decimal point, no thousand separator and no grouping of digits
|
||||
//! into aReal .
|
||||
//! The conversion is independant from the current locale.
|
||||
Standard_EXPORT static Standard_Boolean CStringToReal (const Standard_CString aString, Standard_Real& aReal);
|
||||
|
||||
//! Tests if the quotient theDividend/theDivisor
|
||||
//! does not overflow
|
||||
Standard_EXPORT static Standard_Boolean IsDivisible (const Standard_Real aDividend, const Standard_Real aDivisor);
|
||||
|
||||
//! Returns the exponent in base 2 of a floating-point number.
|
||||
Standard_EXPORT static Standard_Integer GetExponent (const Standard_Real aReal);
|
||||
|
||||
//! Returns the mantissa of a floating-point number.
|
||||
Standard_EXPORT static Standard_Real GetMantissa (const Standard_Real aReal);
|
||||
|
||||
//! since Windows NT does not support 'SIGINT' signal like UNIX,
|
||||
//! then this method checks whether Ctrl-Break keystroke was or
|
||||
//! not. If yes then raises Exception_CTRL_BREAK.
|
||||
Standard_EXPORT static void ControlBreak();
|
||||
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
|
||||
friend class OSD_Error;
|
||||
friend class OSD_Protection;
|
||||
friend class OSD_Path;
|
||||
friend class OSD_FileNode;
|
||||
friend class OSD_Disk;
|
||||
friend class OSD_File;
|
||||
friend class OSD_FileIterator;
|
||||
friend class OSD_Directory;
|
||||
friend class OSD_DirectoryIterator;
|
||||
friend class OSD_Chronometer;
|
||||
friend class OSD_Timer;
|
||||
friend class OSD_Printer;
|
||||
friend class OSD_Host;
|
||||
friend class OSD_Environment;
|
||||
friend class OSD_EnvironmentIterator;
|
||||
friend class OSD_Process;
|
||||
friend class OSD_SharedLibrary;
|
||||
friend class OSD_Thread;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _OSD_HeaderFile
|
@@ -1,17 +0,0 @@
|
||||
-- Copyright (c) 1998-1999 Matra Datavision
|
||||
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
--
|
||||
-- This file is part of Open CASCADE Technology software library.
|
||||
--
|
||||
-- This library is free software; you can redistribute it and/or modify it under
|
||||
-- the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
-- by the Free Software Foundation, with special exception defined in the file
|
||||
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
-- distribution for complete text of the license and disclaimer of any warranty.
|
||||
--
|
||||
-- Alternatively, this file may be used under the terms of Open CASCADE
|
||||
-- commercial license or contractual agreement.
|
||||
|
||||
@if (%Station == "ao1") then
|
||||
@string %CMPLRS_CXX_Command = "/usr/bin/cxx -shared ";
|
||||
@endif;
|
@@ -1,110 +0,0 @@
|
||||
-- Created on: 2018-03-15
|
||||
-- Created by: Stephan GARNAUD (ARM)
|
||||
-- Copyright (c) 1998-1999 Matra Datavision
|
||||
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
--
|
||||
-- This file is part of Open CASCADE Technology software library.
|
||||
--
|
||||
-- This library is free software; you can redistribute it and/or modify it under
|
||||
-- the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
-- by the Free Software Foundation, with special exception defined in the file
|
||||
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
-- distribution for complete text of the license and disclaimer of any warranty.
|
||||
--
|
||||
-- Alternatively, this file may be used under the terms of Open CASCADE
|
||||
-- commercial license or contractual agreement.
|
||||
|
||||
-- Updated: J.P. TIRAULT August 1993
|
||||
-- All methods are static methods.
|
||||
-- the "Show" method returns the consumed CPU time in a Real
|
||||
-- variable.
|
||||
-- J.P. TIRAULT October 15 1994
|
||||
-- We measure both user and system cpu time.
|
||||
class Chronometer from OSD
|
||||
|
||||
---Purpose: This class measures CPU time (both user and system) consumed
|
||||
-- by current process or thread. The chronometer can be started
|
||||
-- and stopped multiple times, and measures cumulative time.
|
||||
--
|
||||
-- If only the thread is measured, calls to Stop() and Show()
|
||||
-- must occur from the same thread where Start() was called
|
||||
-- (unless chronometer is stopped); otherwise measurement will
|
||||
-- yield false values.
|
||||
|
||||
is
|
||||
|
||||
Create (ThisThreadOnly: Boolean = Standard_False) returns Chronometer from OSD;
|
||||
---Purpose: Initializes a stopped Chronometer.
|
||||
--
|
||||
-- If ThisThreadOnly is True, measured CPU time will account
|
||||
-- time of the current thread only; otherwise CPU of the
|
||||
-- process (all threads, and completed children) is measured.
|
||||
--
|
||||
---Level: Public
|
||||
|
||||
---C++ : alias " Standard_EXPORT virtual ~OSD_Chronometer();"
|
||||
|
||||
Reset (me : in out) is virtual;
|
||||
---Purpose: Stops and Reinitializes the Chronometer.
|
||||
---Level: Public
|
||||
|
||||
Stop (me : in out) is virtual;
|
||||
---Purpose: Stops the Chronometer.
|
||||
---Level: Public
|
||||
|
||||
Start (me : in out) is virtual;
|
||||
---Purpose: Starts (after Create or Reset) or restarts (after Stop)
|
||||
-- the chronometer.
|
||||
---Level: Public
|
||||
|
||||
Show (me) is virtual;
|
||||
---Purpose: Shows the current CPU user and system time on the
|
||||
-- standard output stream <cout>.
|
||||
-- The chronometer can be running (laps Time) or stopped.
|
||||
---Level: Public
|
||||
|
||||
Show (me; os : in out OStream from Standard) is virtual;
|
||||
---Purpose: Shows the current CPU user and system time on the output
|
||||
-- stream <os>.
|
||||
-- The chronometer can be running (laps Time) or stopped.
|
||||
---Level: Public
|
||||
|
||||
Show (me; theUserSeconds : in out Real from Standard);
|
||||
---Purpose: Returns the current CPU user time in a variable.
|
||||
-- The chronometer can be running (laps Time) or stopped.
|
||||
---Level: Public
|
||||
|
||||
Show (me; theUserSeconds : in out Real from Standard;
|
||||
theSystemSeconds : in out Real from Standard);
|
||||
---Purpose: Returns the current CPU user and system time in variables.
|
||||
-- The chronometer can be running (laps Time) or stopped.
|
||||
---Level: Public
|
||||
|
||||
GetProcessCPU (myclass; UserSeconds : out Real from Standard;
|
||||
SystemSeconds : out Real from Standard);
|
||||
---Purpose: Returns CPU time (user and system) consumed by the current
|
||||
-- process since its start, in seconds. The actual precision of
|
||||
-- the measurement depends on granularity provided by the system,
|
||||
-- and is platform-specific.
|
||||
---Level: Public
|
||||
|
||||
GetThreadCPU (myclass; UserSeconds : out Real from Standard;
|
||||
SystemSeconds : out Real from Standard);
|
||||
---Purpose: Returns CPU time (user and system) consumed by the current
|
||||
-- thread since its start. Note that this measurement is
|
||||
-- platform-specific, as threads are implemented and managed
|
||||
-- differently on different platforms and CPUs.
|
||||
---Level: Advanced
|
||||
|
||||
fields
|
||||
|
||||
Stopped : Boolean is protected;
|
||||
ThreadOnly : Boolean;
|
||||
Start_user : Real;
|
||||
Start_sys : Real;
|
||||
Cumul_user : Real;
|
||||
Cumul_sys : Real;
|
||||
|
||||
end;
|
||||
|
||||
|
@@ -14,11 +14,11 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#include <OSD_Chronometer.ixx>
|
||||
|
||||
#include <OSD_Chronometer.hxx>
|
||||
#include <Standard_Stream.hxx>
|
||||
|
||||
// ====================== PLATFORM-SPECIFIC PART ========================
|
||||
|
||||
#ifndef WNT
|
||||
|
||||
//---------- Systemes autres que WNT : ----------------------------------
|
||||
|
121
src/OSD/OSD_Chronometer.hxx
Normal file
121
src/OSD/OSD_Chronometer.hxx
Normal file
@@ -0,0 +1,121 @@
|
||||
// Created on: 2018-03-15
|
||||
// Created by: Stephan GARNAUD (ARM)
|
||||
// Copyright (c) 1998-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _OSD_Chronometer_HeaderFile
|
||||
#define _OSD_Chronometer_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
#include <Standard_Handle.hxx>
|
||||
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <Standard_Real.hxx>
|
||||
#include <Standard_OStream.hxx>
|
||||
|
||||
|
||||
//! This class measures CPU time (both user and system) consumed
|
||||
//! by current process or thread. The chronometer can be started
|
||||
//! and stopped multiple times, and measures cumulative time.
|
||||
//!
|
||||
//! If only the thread is measured, calls to Stop() and Show()
|
||||
//! must occur from the same thread where Start() was called
|
||||
//! (unless chronometer is stopped); otherwise measurement will
|
||||
//! yield false values.
|
||||
class OSD_Chronometer
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
//! Initializes a stopped Chronometer.
|
||||
//!
|
||||
//! If ThisThreadOnly is True, measured CPU time will account
|
||||
//! time of the current thread only; otherwise CPU of the
|
||||
//! process (all threads, and completed children) is measured.
|
||||
Standard_EXPORT OSD_Chronometer(const Standard_Boolean ThisThreadOnly = Standard_False);
|
||||
Standard_EXPORT virtual ~OSD_Chronometer();
|
||||
|
||||
//! Stops and Reinitializes the Chronometer.
|
||||
Standard_EXPORT virtual void Reset();
|
||||
|
||||
//! Stops the Chronometer.
|
||||
Standard_EXPORT virtual void Stop();
|
||||
|
||||
//! Starts (after Create or Reset) or restarts (after Stop)
|
||||
//! the chronometer.
|
||||
Standard_EXPORT virtual void Start();
|
||||
|
||||
//! Shows the current CPU user and system time on the
|
||||
//! standard output stream <cout>.
|
||||
//! The chronometer can be running (laps Time) or stopped.
|
||||
Standard_EXPORT virtual void Show() const;
|
||||
|
||||
//! Shows the current CPU user and system time on the output
|
||||
//! stream <os>.
|
||||
//! The chronometer can be running (laps Time) or stopped.
|
||||
Standard_EXPORT virtual void Show (Standard_OStream& os) const;
|
||||
|
||||
//! Returns the current CPU user time in a variable.
|
||||
//! The chronometer can be running (laps Time) or stopped.
|
||||
Standard_EXPORT void Show (Standard_Real& theUserSeconds) const;
|
||||
|
||||
//! Returns the current CPU user and system time in variables.
|
||||
//! The chronometer can be running (laps Time) or stopped.
|
||||
Standard_EXPORT void Show (Standard_Real& theUserSeconds, Standard_Real& theSystemSeconds) const;
|
||||
|
||||
//! Returns CPU time (user and system) consumed by the current
|
||||
//! process since its start, in seconds. The actual precision of
|
||||
//! the measurement depends on granularity provided by the system,
|
||||
//! and is platform-specific.
|
||||
Standard_EXPORT static void GetProcessCPU (Standard_Real& UserSeconds, Standard_Real& SystemSeconds);
|
||||
|
||||
//! Returns CPU time (user and system) consumed by the current
|
||||
//! thread since its start. Note that this measurement is
|
||||
//! platform-specific, as threads are implemented and managed
|
||||
//! differently on different platforms and CPUs.
|
||||
Standard_EXPORT static void GetThreadCPU (Standard_Real& UserSeconds, Standard_Real& SystemSeconds);
|
||||
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
Standard_Boolean Stopped;
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
Standard_Boolean ThreadOnly;
|
||||
Standard_Real Start_user;
|
||||
Standard_Real Start_sys;
|
||||
Standard_Real Cumul_user;
|
||||
Standard_Real Cumul_sys;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _OSD_Chronometer_HeaderFile
|
@@ -1,55 +0,0 @@
|
||||
-- Created on: 1992-05-18
|
||||
-- Created by: Stephan GARNAUD (ARM)
|
||||
-- Copyright (c) 1992-1999 Matra Datavision
|
||||
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
--
|
||||
-- This file is part of Open CASCADE Technology software library.
|
||||
--
|
||||
-- This library is free software; you can redistribute it and/or modify it under
|
||||
-- the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
-- by the Free Software Foundation, with special exception defined in the file
|
||||
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
-- distribution for complete text of the license and disclaimer of any warranty.
|
||||
--
|
||||
-- Alternatively, this file may be used under the terms of Open CASCADE
|
||||
-- commercial license or contractual agreement.
|
||||
|
||||
-- Updated: J.P. TIRAULT August 1993
|
||||
-- All classes are static class.
|
||||
|
||||
|
||||
class Directory from OSD
|
||||
|
||||
---Purpose: Management of directories (a set of directory oriented tools)
|
||||
|
||||
inherits FileNode
|
||||
|
||||
uses Protection, Path
|
||||
|
||||
is
|
||||
Create returns Directory;
|
||||
---Purpose: Creates Directory object.
|
||||
-- It is initiliazed to an empty name.
|
||||
---Level: Public
|
||||
|
||||
Create (Name : Path) returns Directory;
|
||||
---Purpose: Creates Directory object initialized with Name.
|
||||
---Level: Public
|
||||
|
||||
Build (me : in out ; Protect : Protection) is static;
|
||||
---Purpose: Creates (physically) a directory.
|
||||
-- When a directory of the same name already exists, no error is
|
||||
-- returned, and only <Protect> is applied to the existing directory.
|
||||
--
|
||||
-- If Build is used and <me> is instantiated without a name,
|
||||
-- OSDError is raised.
|
||||
---Level: Public
|
||||
|
||||
BuildTemporary (myclass ) returns Directory;
|
||||
---Purpose: Creates a temporary Directory in current directory.
|
||||
-- This directory is automatically removed when object dies.
|
||||
---Level: Public
|
||||
|
||||
end Directory from OSD;
|
||||
|
||||
|
@@ -14,15 +14,16 @@
|
||||
|
||||
#ifndef WNT
|
||||
|
||||
#include <OSD_Directory.ixx>
|
||||
#include <OSD_WhoAmI.hxx>
|
||||
#include <OSD_Protection.hxx>
|
||||
|
||||
#include <sys/stat.h>
|
||||
#include <OSD_Directory.hxx>
|
||||
#include <OSD_Path.hxx>
|
||||
#include <OSD_Protection.hxx>
|
||||
#include <OSD_WhoAmI.hxx>
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
|
||||
const OSD_WhoAmI Iam = OSD_WDirectory;
|
||||
|
||||
|
||||
|
79
src/OSD/OSD_Directory.hxx
Normal file
79
src/OSD/OSD_Directory.hxx
Normal file
@@ -0,0 +1,79 @@
|
||||
// Created on: 1992-05-18
|
||||
// Created by: Stephan GARNAUD (ARM)
|
||||
// Copyright (c) 1992-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _OSD_Directory_HeaderFile
|
||||
#define _OSD_Directory_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
#include <Standard_Handle.hxx>
|
||||
|
||||
#include <OSD_FileNode.hxx>
|
||||
class OSD_Path;
|
||||
class OSD_Protection;
|
||||
|
||||
|
||||
//! Management of directories (a set of directory oriented tools)
|
||||
class OSD_Directory : public OSD_FileNode
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
//! Creates Directory object.
|
||||
//! It is initiliazed to an empty name.
|
||||
Standard_EXPORT OSD_Directory();
|
||||
|
||||
//! Creates Directory object initialized with Name.
|
||||
Standard_EXPORT OSD_Directory(const OSD_Path& Name);
|
||||
|
||||
//! Creates (physically) a directory.
|
||||
//! When a directory of the same name already exists, no error is
|
||||
//! returned, and only <Protect> is applied to the existing directory.
|
||||
//!
|
||||
//! If Build is used and <me> is instantiated without a name,
|
||||
//! OSDError is raised.
|
||||
Standard_EXPORT void Build (const OSD_Protection& Protect);
|
||||
|
||||
//! Creates a temporary Directory in current directory.
|
||||
//! This directory is automatically removed when object dies.
|
||||
Standard_EXPORT static OSD_Directory BuildTemporary();
|
||||
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _OSD_Directory_HeaderFile
|
@@ -1,97 +0,0 @@
|
||||
-- Created on: 1992-05-18
|
||||
-- Created by: Stephan GARNAUD
|
||||
-- Copyright (c) 1992-1999 Matra Datavision
|
||||
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
--
|
||||
-- This file is part of Open CASCADE Technology software library.
|
||||
--
|
||||
-- This library is free software; you can redistribute it and/or modify it under
|
||||
-- the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
-- by the Free Software Foundation, with special exception defined in the file
|
||||
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
-- distribution for complete text of the license and disclaimer of any warranty.
|
||||
--
|
||||
-- Alternatively, this file may be used under the terms of Open CASCADE
|
||||
-- commercial license or contractual agreement.
|
||||
|
||||
-- Updated: J.P. TIRAULT August 1993
|
||||
-- All methods are static methods.
|
||||
|
||||
|
||||
class DirectoryIterator from OSD
|
||||
|
||||
---Purpose: Manages a breadth-only search for sub-directories in the specified
|
||||
-- Path.
|
||||
-- There is no specific order of results.
|
||||
|
||||
uses Directory, Path, Error, AsciiString from TCollection
|
||||
|
||||
raises OSDError
|
||||
|
||||
is
|
||||
|
||||
Create returns DirectoryIterator ;
|
||||
---WARNING! : This method is not implemented on Windows NT System
|
||||
---Purpose: Instantiates Object as empty Iterator;
|
||||
---Level: Public
|
||||
|
||||
Create (where : Path ; Mask : AsciiString) returns DirectoryIterator;
|
||||
---Purpose: Instantiates Object as Iterator.
|
||||
-- Wild-card "*" can be used in Mask the same way it
|
||||
-- is used by unix shell for file names
|
||||
---Level: Public
|
||||
|
||||
Destroy ( me : out );
|
||||
---C++: alias ~
|
||||
-- Only implemented on Windows NT
|
||||
|
||||
Initialize (me : in out ; where : Path ; Mask : AsciiString) is static;
|
||||
---WARNING! : This method is not implemented on Windows NT System
|
||||
---Purpose: Initializes the current File Directory
|
||||
---Level: Public
|
||||
|
||||
More (me : in out) returns Boolean is static;
|
||||
---Purpose: Returns TRUE if other items are found while
|
||||
-- using the 'Tree' method.
|
||||
---Level: Public
|
||||
|
||||
Next (me : in out) is static;
|
||||
---Purpose: Sets the iterator to the next item.
|
||||
-- Returns the item value corresponding to the current
|
||||
-- position of the iterator.
|
||||
---Level: Public
|
||||
|
||||
Values (me : in out) returns Directory is static;
|
||||
---Purpose: Returns the next item found .
|
||||
---Level: Public
|
||||
|
||||
Failed (me) returns Boolean is static;
|
||||
---Purpose: Returns TRUE if an error occurs
|
||||
---Level: Public
|
||||
|
||||
Reset (me : in out) is static;
|
||||
---Purpose: Resets error counter to zero
|
||||
---Level: Public
|
||||
|
||||
Perror (me : in out)
|
||||
---Purpose: Raises OSD_Error
|
||||
---Level: Public
|
||||
raises OSDError is static;
|
||||
|
||||
Error (me) returns Integer is static;
|
||||
---Purpose: Returns error number if 'Failed' is TRUE.
|
||||
---Level: Public
|
||||
|
||||
fields
|
||||
TheIterator : Directory; -- The iterator item
|
||||
myFlag : Integer;
|
||||
myMask : AsciiString;
|
||||
myPlace : AsciiString;
|
||||
myDescr : Address ; -- unused by Windows NT code
|
||||
myEntry : Address ; -- unused by Windows NT code
|
||||
myInit : Integer ; -- unused by Windows NT code
|
||||
myError : Error;
|
||||
myHandle : Address; -- Windows NT specific
|
||||
myData : Address; -- Windows NT specific
|
||||
myFirstCall : Boolean; -- Windows NT specific
|
||||
end DirectoryIterator from OSD;
|
@@ -14,15 +14,18 @@
|
||||
|
||||
#ifndef WNT
|
||||
|
||||
#include <OSD_DirectoryIterator.ixx>
|
||||
|
||||
#include <OSD_Directory.hxx>
|
||||
#include <OSD_DirectoryIterator.hxx>
|
||||
#include <OSD_OSDError.hxx>
|
||||
#include <OSD_Path.hxx>
|
||||
#include <OSD_WhoAmI.hxx>
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <dirent.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
//const OSD_WhoAmI Iam = OSD_WDirectoryIterator;
|
||||
|
||||
OSD_DirectoryIterator::OSD_DirectoryIterator() {
|
||||
|
||||
myDescr = NULL ;
|
||||
@@ -178,7 +181,12 @@ Standard_Integer OSD_DirectoryIterator::Error()const{
|
||||
#define STRICT
|
||||
#include <windows.h>
|
||||
|
||||
#include <OSD_DirectoryIterator.ixx>
|
||||
|
||||
#include <OSD_Directory.hxx>
|
||||
#include <OSD_DirectoryIterator.hxx>
|
||||
#include <OSD_OSDError.hxx>
|
||||
#include <OSD_Path.hxx>
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
#include <TCollection_ExtendedString.hxx>
|
||||
|
||||
#define _FD ( ( PWIN32_FIND_DATAW )myData )
|
||||
|
121
src/OSD/OSD_DirectoryIterator.hxx
Normal file
121
src/OSD/OSD_DirectoryIterator.hxx
Normal file
@@ -0,0 +1,121 @@
|
||||
// Created on: 1992-05-18
|
||||
// Created by: Stephan GARNAUD
|
||||
// Copyright (c) 1992-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _OSD_DirectoryIterator_HeaderFile
|
||||
#define _OSD_DirectoryIterator_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
#include <Standard_Handle.hxx>
|
||||
|
||||
#include <OSD_Directory.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
#include <Standard_Address.hxx>
|
||||
#include <OSD_Error.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
class OSD_OSDError;
|
||||
class OSD_Path;
|
||||
class TCollection_AsciiString;
|
||||
class OSD_Directory;
|
||||
|
||||
|
||||
//! Manages a breadth-only search for sub-directories in the specified
|
||||
//! Path.
|
||||
//! There is no specific order of results.
|
||||
class OSD_DirectoryIterator
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
//! Instantiates Object as empty Iterator;
|
||||
Standard_EXPORT OSD_DirectoryIterator();
|
||||
|
||||
//! Instantiates Object as Iterator.
|
||||
//! Wild-card "*" can be used in Mask the same way it
|
||||
//! is used by unix shell for file names
|
||||
Standard_EXPORT OSD_DirectoryIterator(const OSD_Path& where, const TCollection_AsciiString& Mask);
|
||||
|
||||
Standard_EXPORT void Destroy();
|
||||
~OSD_DirectoryIterator()
|
||||
{
|
||||
Destroy();
|
||||
}
|
||||
|
||||
//! Initializes the current File Directory
|
||||
Standard_EXPORT void Initialize (const OSD_Path& where, const TCollection_AsciiString& Mask);
|
||||
|
||||
//! Returns TRUE if other items are found while
|
||||
//! using the 'Tree' method.
|
||||
Standard_EXPORT Standard_Boolean More();
|
||||
|
||||
//! Sets the iterator to the next item.
|
||||
//! Returns the item value corresponding to the current
|
||||
//! position of the iterator.
|
||||
Standard_EXPORT void Next();
|
||||
|
||||
//! Returns the next item found .
|
||||
Standard_EXPORT OSD_Directory Values();
|
||||
|
||||
//! Returns TRUE if an error occurs
|
||||
Standard_EXPORT Standard_Boolean Failed() const;
|
||||
|
||||
//! Resets error counter to zero
|
||||
Standard_EXPORT void Reset();
|
||||
|
||||
//! Raises OSD_Error
|
||||
Standard_EXPORT void Perror();
|
||||
|
||||
//! Returns error number if 'Failed' is TRUE.
|
||||
Standard_EXPORT Standard_Integer Error() const;
|
||||
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
OSD_Directory TheIterator;
|
||||
Standard_Integer myFlag;
|
||||
TCollection_AsciiString myMask;
|
||||
TCollection_AsciiString myPlace;
|
||||
Standard_Address myDescr;
|
||||
Standard_Address myEntry;
|
||||
Standard_Integer myInit;
|
||||
OSD_Error myError;
|
||||
Standard_Address myHandle;
|
||||
Standard_Address myData;
|
||||
Standard_Boolean myFirstCall;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _OSD_DirectoryIterator_HeaderFile
|
@@ -1,105 +0,0 @@
|
||||
-- Created on: 1992-05-27
|
||||
-- Created by: Stephan GARNAUD (ARM)
|
||||
-- Copyright (c) 1992-1999 Matra Datavision
|
||||
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
--
|
||||
-- This file is part of Open CASCADE Technology software library.
|
||||
--
|
||||
-- This library is free software; you can redistribute it and/or modify it under
|
||||
-- the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
-- by the Free Software Foundation, with special exception defined in the file
|
||||
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
-- distribution for complete text of the license and disclaimer of any warranty.
|
||||
--
|
||||
-- Alternatively, this file may be used under the terms of Open CASCADE
|
||||
-- commercial license or contractual agreement.
|
||||
|
||||
class Disk from OSD
|
||||
|
||||
---Purpose: Disk management (a set of disk oriented tools)
|
||||
|
||||
|
||||
uses Error, Path, CString from Standard, AsciiString from TCollection
|
||||
raises OSDError
|
||||
|
||||
|
||||
is
|
||||
Create returns Disk;
|
||||
---Purpose: Creates a disk object.
|
||||
-- This is used only when a class contains a Disk field.
|
||||
-- By default, its name is initialized to current working disk.
|
||||
---Level: Public
|
||||
|
||||
Create (Name : Path) returns Disk;
|
||||
---Purpose: Initializes the object Disk with the disk name
|
||||
-- associated to the OSD_Path.
|
||||
---Level: Public
|
||||
|
||||
Create (PathName : CString) returns Disk;
|
||||
---Purpose: Initializes the object Disk with <PathName>.
|
||||
-- <PathName> specifies any file within the mounted
|
||||
-- file system.
|
||||
-- Example : OSD_Disk myDisk ("/tmp")
|
||||
-- Initializes a disk object with the mounted
|
||||
-- file associated to /tmp.
|
||||
---Level: Public
|
||||
|
||||
Name (me ) returns Path is static;
|
||||
---Purpose: Returns disk name of <me>.
|
||||
---Level: Public
|
||||
|
||||
SetName (me : in out; Name : Path) is static ;
|
||||
---Purpose: Instantiates <me> with <Name>.
|
||||
---Level: Public
|
||||
|
||||
DiskSize(me : in out) returns Integer is static ;
|
||||
---Purpose: Returns total disk capacity in 512 bytes blocks.
|
||||
---Level: Advanced
|
||||
|
||||
DiskFree(me : in out) returns Integer is static ;
|
||||
---Purpose: Returns free available 512 bytes blocks on disk.
|
||||
---Level: Advanced
|
||||
|
||||
DiskQuota(me : in out) returns Integer is static ;
|
||||
---Purpose: Returns user's disk quota (in Bytes).
|
||||
---Level: Advanced
|
||||
|
||||
SetDiskQuota(me : in out; QuotaSize : Integer) is static ;
|
||||
---Purpose: Sets user's disk quota (in Bytes).
|
||||
-- Warning: Needs system administrator privilege.
|
||||
---Level: Advanced
|
||||
|
||||
SetQuotaOn(me : in out) is static;
|
||||
---Purpose: Activates user's disk quota
|
||||
-- Warning: Needs system administrator privilege.
|
||||
---Level: Advanced
|
||||
|
||||
SetQuotaOff(me : in out) is static;
|
||||
---Purpose: Deactivates user's disk quota
|
||||
-- Warning: Needs system administrator privilege.
|
||||
---Level: Advanced
|
||||
|
||||
Failed (me) returns Boolean is static ;
|
||||
---Purpose: Returns TRUE if an error occurs
|
||||
---Level: Public
|
||||
|
||||
Reset (me : in out) is static ;
|
||||
---Purpose: Resets error counter to zero
|
||||
---Level: Public
|
||||
|
||||
Perror (me : in out)
|
||||
---Purpose: Raises OSD_Error
|
||||
---Level: Public
|
||||
raises OSDError is static ;
|
||||
|
||||
Error (me) returns Integer is static;
|
||||
---Purpose: Returns error number if 'Failed' is TRUE.
|
||||
---Level: Public
|
||||
|
||||
fields
|
||||
DiskName : AsciiString;
|
||||
myQuotaSize: Integer;
|
||||
myError : Error;
|
||||
end Disk from OSD;
|
||||
|
||||
|
@@ -14,7 +14,10 @@
|
||||
|
||||
#ifndef _WIN32
|
||||
|
||||
#include <OSD_Disk.ixx>
|
||||
|
||||
#include <OSD_Disk.hxx>
|
||||
#include <OSD_OSDError.hxx>
|
||||
#include <OSD_Path.hxx>
|
||||
#include <OSD_WhoAmI.hxx>
|
||||
|
||||
const OSD_WhoAmI Iam = OSD_WDisk;
|
||||
@@ -154,7 +157,11 @@ Standard_Integer OSD_Disk::Error()const{
|
||||
//-------------------------------------------------------------------------------
|
||||
|
||||
#define STRICT
|
||||
#include <OSD_Disk.ixx>
|
||||
|
||||
|
||||
#include <OSD_Disk.hxx>
|
||||
#include <OSD_OSDError.hxx>
|
||||
#include <OSD_Path.hxx>
|
||||
#include <Standard_ProgramError.hxx>
|
||||
|
||||
#include <windows.h>
|
||||
|
123
src/OSD/OSD_Disk.hxx
Normal file
123
src/OSD/OSD_Disk.hxx
Normal file
@@ -0,0 +1,123 @@
|
||||
// Created on: 1992-05-27
|
||||
// Created by: Stephan GARNAUD (ARM)
|
||||
// Copyright (c) 1992-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _OSD_Disk_HeaderFile
|
||||
#define _OSD_Disk_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
#include <Standard_Handle.hxx>
|
||||
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <OSD_Error.hxx>
|
||||
#include <Standard_CString.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
class OSD_OSDError;
|
||||
class OSD_Path;
|
||||
|
||||
|
||||
//! Disk management (a set of disk oriented tools)
|
||||
class OSD_Disk
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
//! Creates a disk object.
|
||||
//! This is used only when a class contains a Disk field.
|
||||
//! By default, its name is initialized to current working disk.
|
||||
Standard_EXPORT OSD_Disk();
|
||||
|
||||
//! Initializes the object Disk with the disk name
|
||||
//! associated to the OSD_Path.
|
||||
Standard_EXPORT OSD_Disk(const OSD_Path& Name);
|
||||
|
||||
//! Initializes the object Disk with <PathName>.
|
||||
//! <PathName> specifies any file within the mounted
|
||||
//! file system.
|
||||
//! Example : OSD_Disk myDisk ("/tmp")
|
||||
//! Initializes a disk object with the mounted
|
||||
//! file associated to /tmp.
|
||||
Standard_EXPORT OSD_Disk(const Standard_CString PathName);
|
||||
|
||||
//! Returns disk name of <me>.
|
||||
Standard_EXPORT OSD_Path Name() const;
|
||||
|
||||
//! Instantiates <me> with <Name>.
|
||||
Standard_EXPORT void SetName (const OSD_Path& Name);
|
||||
|
||||
//! Returns total disk capacity in 512 bytes blocks.
|
||||
Standard_EXPORT Standard_Integer DiskSize();
|
||||
|
||||
//! Returns free available 512 bytes blocks on disk.
|
||||
Standard_EXPORT Standard_Integer DiskFree();
|
||||
|
||||
//! Returns user's disk quota (in Bytes).
|
||||
Standard_EXPORT Standard_Integer DiskQuota();
|
||||
|
||||
//! Sets user's disk quota (in Bytes).
|
||||
//! Warning: Needs system administrator privilege.
|
||||
Standard_EXPORT void SetDiskQuota (const Standard_Integer QuotaSize);
|
||||
|
||||
//! Activates user's disk quota
|
||||
//! Warning: Needs system administrator privilege.
|
||||
Standard_EXPORT void SetQuotaOn();
|
||||
|
||||
//! Deactivates user's disk quota
|
||||
//! Warning: Needs system administrator privilege.
|
||||
Standard_EXPORT void SetQuotaOff();
|
||||
|
||||
//! Returns TRUE if an error occurs
|
||||
Standard_EXPORT Standard_Boolean Failed() const;
|
||||
|
||||
//! Resets error counter to zero
|
||||
Standard_EXPORT void Reset();
|
||||
|
||||
//! Raises OSD_Error
|
||||
Standard_EXPORT void Perror();
|
||||
|
||||
//! Returns error number if 'Failed' is TRUE.
|
||||
Standard_EXPORT Standard_Integer Error() const;
|
||||
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
TCollection_AsciiString DiskName;
|
||||
Standard_Integer myQuotaSize;
|
||||
OSD_Error myError;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _OSD_Disk_HeaderFile
|
@@ -1,103 +0,0 @@
|
||||
-- Created on: 2018-03-15
|
||||
-- Created by: Stephan GARNAUD (ARM)
|
||||
-- Copyright (c) 1998-1999 Matra Datavision
|
||||
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
--
|
||||
-- This file is part of Open CASCADE Technology software library.
|
||||
--
|
||||
-- This library is free software; you can redistribute it and/or modify it under
|
||||
-- the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
-- by the Free Software Foundation, with special exception defined in the file
|
||||
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
-- distribution for complete text of the license and disclaimer of any warranty.
|
||||
--
|
||||
-- Alternatively, this file may be used under the terms of Open CASCADE
|
||||
-- commercial license or contractual agreement.
|
||||
|
||||
class Environment from OSD
|
||||
|
||||
---Purpose: Management of system environment variables
|
||||
-- An environment variable is composed of a variable name
|
||||
-- and its value.
|
||||
--
|
||||
-- To be portable among various systems, environment variables
|
||||
-- are local to a process.
|
||||
|
||||
uses Protection, Error, AsciiString from TCollection
|
||||
raises ConstructionError, NullObject, OSDError
|
||||
|
||||
is
|
||||
Create returns Environment;
|
||||
---Purpose: Creates the object Environment.
|
||||
---Level: Public
|
||||
|
||||
Create (Name : AsciiString) returns Environment
|
||||
---Purpose: Creates an Environment variable initialized with value
|
||||
-- set to an empty AsciiString.
|
||||
---Level: Public
|
||||
raises ConstructionError;
|
||||
|
||||
Create (Name, Value : AsciiString) returns Environment
|
||||
---Purpose: Creates an Environment variable initialized with Value.
|
||||
raises ConstructionError, NullObject;
|
||||
-- ConstructionError is raised when invalid character is encountered.
|
||||
---Level: Public
|
||||
|
||||
SetValue (me : in out; Value : AsciiString)
|
||||
---Purpose: Changes environment variable value.
|
||||
-- Raises ConstructionError either if the string contains
|
||||
-- characters not in range of ' '...'~' or if the string
|
||||
-- contains the character '$' which is forbiden.
|
||||
---Level: Public
|
||||
raises ConstructionError is static;
|
||||
|
||||
Value (me : in out) returns AsciiString is static ;
|
||||
---Purpose: Gets the value of an environment variable
|
||||
---Level: Public
|
||||
|
||||
SetName (me : in out; name : AsciiString)
|
||||
---Purpose: Changes environment variable name.
|
||||
-- Raises ConstructionError either if the string contains
|
||||
-- characters not in range of ' '...'~' or if the string
|
||||
-- contains the character '$' which is forbiden.
|
||||
---Level: Public
|
||||
raises ConstructionError is static;
|
||||
|
||||
Name (me ) returns AsciiString is static;
|
||||
---Purpose: Gets the name of <me>.
|
||||
---Level: Public
|
||||
|
||||
Build (me : in out) is static ;
|
||||
---Purpose: Sets the value of an environment variable
|
||||
-- into system (physically).
|
||||
---Level: Public
|
||||
|
||||
Remove(me : in out) is static ;
|
||||
---Purpose: Removes (physically) an environment variable
|
||||
---Level: Public
|
||||
|
||||
Failed (me) returns Boolean is static ;
|
||||
---Purpose: Returns TRUE if an error occurs
|
||||
---Level: Public
|
||||
|
||||
Reset (me : in out) is static ;
|
||||
---Purpose: Resets error counter to zero
|
||||
---Level: Public
|
||||
|
||||
Perror (me : in out)
|
||||
---Purpose: Raises OSD_Error
|
||||
---Level: Public
|
||||
raises OSDError is static ;
|
||||
|
||||
Error (me) returns Integer is static ;
|
||||
---Purpose: Returns error number if 'Failed' is TRUE.
|
||||
---Level: Publi
|
||||
|
||||
fields
|
||||
myName : AsciiString; --- Name of the variable
|
||||
myValue : AsciiString;
|
||||
myError : Error;
|
||||
end Environment from OSD;
|
||||
|
||||
|
||||
|
@@ -14,19 +14,20 @@
|
||||
|
||||
#ifndef WNT
|
||||
|
||||
#include <Standard_NullObject.hxx>
|
||||
|
||||
#include <OSD_Environment.hxx>
|
||||
#include <OSD_OSDError.hxx>
|
||||
#include <OSD_WhoAmI.hxx>
|
||||
#include <Standard_ConstructionError.hxx>
|
||||
#include <Standard_Failure.hxx>
|
||||
#include <Standard_Mutex.hxx>
|
||||
#include <OSD_Environment.ixx>
|
||||
#include <OSD_WhoAmI.hxx>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <Standard_NullObject.hxx>
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
static const OSD_WhoAmI Iam = OSD_WEnvironment;
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
120
src/OSD/OSD_Environment.hxx
Normal file
120
src/OSD/OSD_Environment.hxx
Normal file
@@ -0,0 +1,120 @@
|
||||
// Created on: 2018-03-15
|
||||
// Created by: Stephan GARNAUD (ARM)
|
||||
// Copyright (c) 1998-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _OSD_Environment_HeaderFile
|
||||
#define _OSD_Environment_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
#include <Standard_Handle.hxx>
|
||||
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
#include <OSD_Error.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
class Standard_ConstructionError;
|
||||
class Standard_NullObject;
|
||||
class OSD_OSDError;
|
||||
class TCollection_AsciiString;
|
||||
|
||||
|
||||
//! Management of system environment variables
|
||||
//! An environment variable is composed of a variable name
|
||||
//! and its value.
|
||||
//!
|
||||
//! To be portable among various systems, environment variables
|
||||
//! are local to a process.
|
||||
class OSD_Environment
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
//! Creates the object Environment.
|
||||
Standard_EXPORT OSD_Environment();
|
||||
|
||||
//! Creates an Environment variable initialized with value
|
||||
//! set to an empty AsciiString.
|
||||
Standard_EXPORT OSD_Environment(const TCollection_AsciiString& Name);
|
||||
|
||||
//! Creates an Environment variable initialized with Value.
|
||||
Standard_EXPORT OSD_Environment(const TCollection_AsciiString& Name, const TCollection_AsciiString& Value);
|
||||
|
||||
//! Changes environment variable value.
|
||||
//! Raises ConstructionError either if the string contains
|
||||
//! characters not in range of ' '...'~' or if the string
|
||||
//! contains the character '$' which is forbiden.
|
||||
Standard_EXPORT void SetValue (const TCollection_AsciiString& Value);
|
||||
|
||||
//! Gets the value of an environment variable
|
||||
Standard_EXPORT TCollection_AsciiString Value();
|
||||
|
||||
//! Changes environment variable name.
|
||||
//! Raises ConstructionError either if the string contains
|
||||
//! characters not in range of ' '...'~' or if the string
|
||||
//! contains the character '$' which is forbiden.
|
||||
Standard_EXPORT void SetName (const TCollection_AsciiString& name);
|
||||
|
||||
//! Gets the name of <me>.
|
||||
Standard_EXPORT TCollection_AsciiString Name() const;
|
||||
|
||||
//! Sets the value of an environment variable
|
||||
//! into system (physically).
|
||||
Standard_EXPORT void Build();
|
||||
|
||||
//! Removes (physically) an environment variable
|
||||
Standard_EXPORT void Remove();
|
||||
|
||||
//! Returns TRUE if an error occurs
|
||||
Standard_EXPORT Standard_Boolean Failed() const;
|
||||
|
||||
//! Resets error counter to zero
|
||||
Standard_EXPORT void Reset();
|
||||
|
||||
//! Raises OSD_Error
|
||||
Standard_EXPORT void Perror();
|
||||
|
||||
//! Returns error number if 'Failed' is TRUE.
|
||||
Standard_EXPORT Standard_Integer Error() const;
|
||||
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
TCollection_AsciiString myName;
|
||||
TCollection_AsciiString myValue;
|
||||
OSD_Error myError;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _OSD_Environment_HeaderFile
|
@@ -1,70 +0,0 @@
|
||||
-- Created on: 1992-09-11
|
||||
-- Created by: Stephan GARNAUD
|
||||
-- Copyright (c) 1992-1999 Matra Datavision
|
||||
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
--
|
||||
-- This file is part of Open CASCADE Technology software library.
|
||||
--
|
||||
-- This library is free software; you can redistribute it and/or modify it under
|
||||
-- the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
-- by the Free Software Foundation, with special exception defined in the file
|
||||
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
-- distribution for complete text of the license and disclaimer of any warranty.
|
||||
--
|
||||
-- Alternatively, this file may be used under the terms of Open CASCADE
|
||||
-- commercial license or contractual agreement.
|
||||
|
||||
class EnvironmentIterator from OSD
|
||||
|
||||
---Purpose: This allows consultation of every environment variable.
|
||||
-- There is no specific order of results.
|
||||
|
||||
uses Environment, Error, AsciiString from TCollection
|
||||
raises OSDError
|
||||
|
||||
is
|
||||
Create returns EnvironmentIterator;
|
||||
---Purpose: Instantiates Object as Iterator;
|
||||
---Level: Public
|
||||
|
||||
Destroy ( me : out );
|
||||
---C++: alias ~
|
||||
-- Only implemented on Windows NT system
|
||||
|
||||
More (me : in out) returns Boolean is static;
|
||||
---Purpose: Returns TRUE if there are other environment variables.
|
||||
---Level: Public
|
||||
|
||||
Next (me : in out) is static;
|
||||
---Purpose: Sets the iterator to the next item.
|
||||
-- Returns the item value corresponding to the current
|
||||
-- position of the iterator.
|
||||
---Level: Public
|
||||
|
||||
Values (me : in out) returns Environment is static;
|
||||
---Purpose: Returns the next environment variable found.
|
||||
---Level: Public
|
||||
|
||||
Failed (me) returns Boolean is static;
|
||||
---Purpose: Returns TRUE if an error occurs
|
||||
---Level: Public
|
||||
|
||||
Reset (me : in out) is static;
|
||||
---Purpose: Resets error counter to zero
|
||||
---Level: Public
|
||||
|
||||
Perror (me : in out)
|
||||
---Purpose: Raises OSD_Error
|
||||
---Level: Public
|
||||
raises OSDError is static ;
|
||||
|
||||
Error (me) returns Integer is static ;
|
||||
---Purpose: Returns error number if 'Failed' is TRUE.
|
||||
---Level: Public
|
||||
|
||||
fields
|
||||
myEnv : Address; -- Windows NT specific
|
||||
myCount : Integer; -- Count in list of variables
|
||||
myError : Error;
|
||||
end EnvironmentIterator from OSD;
|
||||
|
@@ -16,7 +16,9 @@
|
||||
|
||||
//---------- All Systems except windowsNT : ----------------------------------
|
||||
|
||||
#include <OSD_EnvironmentIterator.ixx>
|
||||
#include <OSD_Environment.hxx>
|
||||
#include <OSD_EnvironmentIterator.hxx>
|
||||
#include <OSD_OSDError.hxx>
|
||||
#include <OSD_WhoAmI.hxx>
|
||||
|
||||
//const OSD_WhoAmI Iam = OSD_WEnvironmentIterator;
|
||||
@@ -97,7 +99,10 @@ Standard_Integer OSD_EnvironmentIterator::Error()const{
|
||||
#define STRICT
|
||||
#include <windows.h>
|
||||
|
||||
#include <OSD_EnvironmentIterator.ixx>
|
||||
|
||||
#include <OSD_Environment.hxx>
|
||||
#include <OSD_EnvironmentIterator.hxx>
|
||||
#include <OSD_OSDError.hxx>
|
||||
|
||||
OSD_EnvironmentIterator :: OSD_EnvironmentIterator () {
|
||||
|
||||
|
99
src/OSD/OSD_EnvironmentIterator.hxx
Normal file
99
src/OSD/OSD_EnvironmentIterator.hxx
Normal file
@@ -0,0 +1,99 @@
|
||||
// Created on: 1992-09-11
|
||||
// Created by: Stephan GARNAUD
|
||||
// Copyright (c) 1992-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _OSD_EnvironmentIterator_HeaderFile
|
||||
#define _OSD_EnvironmentIterator_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
#include <Standard_Handle.hxx>
|
||||
|
||||
#include <Standard_Address.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <OSD_Error.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
class OSD_OSDError;
|
||||
class OSD_Environment;
|
||||
|
||||
|
||||
//! This allows consultation of every environment variable.
|
||||
//! There is no specific order of results.
|
||||
class OSD_EnvironmentIterator
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
//! Instantiates Object as Iterator;
|
||||
Standard_EXPORT OSD_EnvironmentIterator();
|
||||
|
||||
Standard_EXPORT void Destroy();
|
||||
~OSD_EnvironmentIterator()
|
||||
{
|
||||
Destroy();
|
||||
}
|
||||
|
||||
//! Returns TRUE if there are other environment variables.
|
||||
Standard_EXPORT Standard_Boolean More();
|
||||
|
||||
//! Sets the iterator to the next item.
|
||||
//! Returns the item value corresponding to the current
|
||||
//! position of the iterator.
|
||||
Standard_EXPORT void Next();
|
||||
|
||||
//! Returns the next environment variable found.
|
||||
Standard_EXPORT OSD_Environment Values();
|
||||
|
||||
//! Returns TRUE if an error occurs
|
||||
Standard_EXPORT Standard_Boolean Failed() const;
|
||||
|
||||
//! Resets error counter to zero
|
||||
Standard_EXPORT void Reset();
|
||||
|
||||
//! Raises OSD_Error
|
||||
Standard_EXPORT void Perror();
|
||||
|
||||
//! Returns error number if 'Failed' is TRUE.
|
||||
Standard_EXPORT Standard_Integer Error() const;
|
||||
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
Standard_Address myEnv;
|
||||
Standard_Integer myCount;
|
||||
OSD_Error myError;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _OSD_EnvironmentIterator_HeaderFile
|
@@ -1,85 +0,0 @@
|
||||
-- Created on: 1992-05-18
|
||||
-- Created by: Stephan GARNAUD (ARM)
|
||||
-- Copyright (c) 1992-1999 Matra Datavision
|
||||
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
--
|
||||
-- This file is part of Open CASCADE Technology software library.
|
||||
--
|
||||
-- This library is free software; you can redistribute it and/or modify it under
|
||||
-- the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
-- by the Free Software Foundation, with special exception defined in the file
|
||||
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
-- distribution for complete text of the license and disclaimer of any warranty.
|
||||
--
|
||||
-- Alternatively, this file may be used under the terms of Open CASCADE
|
||||
-- commercial license or contractual agreement.
|
||||
|
||||
class Error from OSD
|
||||
|
||||
---Purpose: Accurate management of OSD specific errors.
|
||||
|
||||
-- Each method can be error tested with object.Failed().
|
||||
-- To manage an occuring error, just use object.Perror();
|
||||
--
|
||||
-- It is possible to reset the error counter to zero.
|
||||
-- To do this use the 'Reset' method .
|
||||
|
||||
|
||||
-- Only 4 methods are usable for programmer :
|
||||
-- Failed to see whether an error occured or not.
|
||||
-- Value to get system independent error code.
|
||||
-- (See annexe for a complete list of error code).
|
||||
-- Reset to reset error code to zero (no error).
|
||||
-- Perror to raise OSDError and print a self explanatory error
|
||||
-- message. This message says why an error occurs and
|
||||
-- explains what to do to correct it.
|
||||
|
||||
uses
|
||||
WhoAmI, AsciiString from TCollection
|
||||
|
||||
raises
|
||||
OSDError
|
||||
|
||||
is
|
||||
Create returns Error;
|
||||
---Purpose: Initializes Error to be without any Error.
|
||||
-- This is only used by OSD, not by programmer.
|
||||
---Level: Public
|
||||
|
||||
Perror (me : in out)
|
||||
---Purpose: Raises OSD_Error with accurate error message.
|
||||
raises OSDError is static;
|
||||
---Level: Public
|
||||
|
||||
SetValue (me : in out; Errcode : Integer; From : Integer; Message : AsciiString) is static;
|
||||
---Purpose: Instantiates error
|
||||
-- This is only used by OSD methods to instantiates an error code.
|
||||
-- No description is done for the programmer.
|
||||
---Level: Public
|
||||
|
||||
Error (me) returns Integer is static;
|
||||
---Purpose: Returns an accurate error code.
|
||||
-- To test these values, you must include "OSD_ErrorList.hxx"
|
||||
---Level: Public
|
||||
|
||||
|
||||
Failed (me) returns Boolean is static;
|
||||
---Purpose: Returns TRUE if an error occurs
|
||||
-- This is a way to test if a system call succeeded or not.
|
||||
---Level: Public
|
||||
|
||||
Reset (me : in out) is static;
|
||||
---Purpose: Resets error counter to zero
|
||||
-- This allows the user to ignore an error (WARNING).
|
||||
---Level: Public
|
||||
|
||||
fields
|
||||
myMessage : AsciiString; -- Internal error message
|
||||
myErrno : Integer; -- UNIX/VMS error used by OSD only
|
||||
myCode : WhoAmI; -- Accuracy code in error for OSD only
|
||||
extCode : Integer; -- Error type decoded for user
|
||||
end Error from OSD;
|
||||
|
||||
|
||||
|
||||
|
@@ -14,12 +14,14 @@
|
||||
|
||||
#ifndef WNT
|
||||
|
||||
#include <OSD_Error.ixx>
|
||||
|
||||
#include <OSD_Error.hxx>
|
||||
#include <OSD_ErrorList.hxx>
|
||||
#include <OSD_OSDError.hxx>
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
/* Created by Stephan GARNAUD (ARM) 1992 for Matra Datavision */
|
||||
|
||||
OSD_Error::OSD_Error(){
|
||||
myErrno = 0;
|
||||
}
|
||||
|
91
src/OSD/OSD_Error.hxx
Normal file
91
src/OSD/OSD_Error.hxx
Normal file
@@ -0,0 +1,91 @@
|
||||
// Created on: 1992-05-18
|
||||
// Created by: Stephan GARNAUD (ARM)
|
||||
// Copyright (c) 1992-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _OSD_Error_HeaderFile
|
||||
#define _OSD_Error_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
#include <Standard_Handle.hxx>
|
||||
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <OSD_WhoAmI.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
class OSD_OSDError;
|
||||
class TCollection_AsciiString;
|
||||
|
||||
|
||||
//! Accurate management of OSD specific errors.
|
||||
class OSD_Error
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
//! Initializes Error to be without any Error.
|
||||
//! This is only used by OSD, not by programmer.
|
||||
Standard_EXPORT OSD_Error();
|
||||
|
||||
//! Raises OSD_Error with accurate error message.
|
||||
Standard_EXPORT void Perror();
|
||||
|
||||
//! Instantiates error
|
||||
//! This is only used by OSD methods to instantiates an error code.
|
||||
//! No description is done for the programmer.
|
||||
Standard_EXPORT void SetValue (const Standard_Integer Errcode, const Standard_Integer From, const TCollection_AsciiString& Message);
|
||||
|
||||
//! Returns an accurate error code.
|
||||
//! To test these values, you must include "OSD_ErrorList.hxx"
|
||||
Standard_EXPORT Standard_Integer Error() const;
|
||||
|
||||
//! Returns TRUE if an error occurs
|
||||
//! This is a way to test if a system call succeeded or not.
|
||||
Standard_EXPORT Standard_Boolean Failed() const;
|
||||
|
||||
//! Resets error counter to zero
|
||||
//! This allows the user to ignore an error (WARNING).
|
||||
Standard_EXPORT void Reset();
|
||||
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
TCollection_AsciiString myMessage;
|
||||
Standard_Integer myErrno;
|
||||
OSD_WhoAmI myCode;
|
||||
Standard_Integer extCode;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _OSD_Error_HeaderFile
|
35
src/OSD/OSD_Exception.hxx
Normal file
35
src/OSD/OSD_Exception.hxx
Normal file
@@ -0,0 +1,35 @@
|
||||
// Copyright (c) 1992-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _OSD_Exception_HeaderFile
|
||||
#define _OSD_Exception_HeaderFile
|
||||
|
||||
#include <Standard_Type.hxx>
|
||||
#include <Standard_DefineException.hxx>
|
||||
#include <Standard_SStream.hxx>
|
||||
#include <Standard_Failure.hxx>
|
||||
|
||||
class OSD_Exception;
|
||||
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);
|
||||
#else
|
||||
#define OSD_Exception_Raise_if(CONDITION, MESSAGE)
|
||||
#endif
|
||||
|
||||
DEFINE_STANDARD_EXCEPTION(OSD_Exception, Standard_Failure)
|
||||
|
||||
#endif // _OSD_Exception_HeaderFile
|
35
src/OSD/OSD_Exception_ACCESS_VIOLATION.hxx
Normal file
35
src/OSD/OSD_Exception_ACCESS_VIOLATION.hxx
Normal file
@@ -0,0 +1,35 @@
|
||||
// Copyright (c) 1992-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _OSD_Exception_ACCESS_VIOLATION_HeaderFile
|
||||
#define _OSD_Exception_ACCESS_VIOLATION_HeaderFile
|
||||
|
||||
#include <Standard_Type.hxx>
|
||||
#include <Standard_DefineException.hxx>
|
||||
#include <Standard_SStream.hxx>
|
||||
#include <OSD_Exception.hxx>
|
||||
|
||||
class OSD_Exception_ACCESS_VIOLATION;
|
||||
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);
|
||||
#else
|
||||
#define OSD_Exception_ACCESS_VIOLATION_Raise_if(CONDITION, MESSAGE)
|
||||
#endif
|
||||
|
||||
DEFINE_STANDARD_EXCEPTION(OSD_Exception_ACCESS_VIOLATION, OSD_Exception)
|
||||
|
||||
#endif // _OSD_Exception_ACCESS_VIOLATION_HeaderFile
|
35
src/OSD/OSD_Exception_ARRAY_BOUNDS_EXCEEDED.hxx
Normal file
35
src/OSD/OSD_Exception_ARRAY_BOUNDS_EXCEEDED.hxx
Normal file
@@ -0,0 +1,35 @@
|
||||
// Copyright (c) 1992-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _OSD_Exception_ARRAY_BOUNDS_EXCEEDED_HeaderFile
|
||||
#define _OSD_Exception_ARRAY_BOUNDS_EXCEEDED_HeaderFile
|
||||
|
||||
#include <Standard_Type.hxx>
|
||||
#include <Standard_DefineException.hxx>
|
||||
#include <Standard_SStream.hxx>
|
||||
#include <OSD_Exception.hxx>
|
||||
|
||||
class OSD_Exception_ARRAY_BOUNDS_EXCEEDED;
|
||||
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);
|
||||
#else
|
||||
#define OSD_Exception_ARRAY_BOUNDS_EXCEEDED_Raise_if(CONDITION, MESSAGE)
|
||||
#endif
|
||||
|
||||
DEFINE_STANDARD_EXCEPTION(OSD_Exception_ARRAY_BOUNDS_EXCEEDED, OSD_Exception)
|
||||
|
||||
#endif // _OSD_Exception_ARRAY_BOUNDS_EXCEEDED_HeaderFile
|
35
src/OSD/OSD_Exception_CTRL_BREAK.hxx
Normal file
35
src/OSD/OSD_Exception_CTRL_BREAK.hxx
Normal file
@@ -0,0 +1,35 @@
|
||||
// Copyright (c) 1992-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _OSD_Exception_CTRL_BREAK_HeaderFile
|
||||
#define _OSD_Exception_CTRL_BREAK_HeaderFile
|
||||
|
||||
#include <Standard_Type.hxx>
|
||||
#include <Standard_DefineException.hxx>
|
||||
#include <Standard_SStream.hxx>
|
||||
#include <OSD_Exception.hxx>
|
||||
|
||||
class OSD_Exception_CTRL_BREAK;
|
||||
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);
|
||||
#else
|
||||
#define OSD_Exception_CTRL_BREAK_Raise_if(CONDITION, MESSAGE)
|
||||
#endif
|
||||
|
||||
DEFINE_STANDARD_EXCEPTION(OSD_Exception_CTRL_BREAK, OSD_Exception)
|
||||
|
||||
#endif // _OSD_Exception_CTRL_BREAK_HeaderFile
|
35
src/OSD/OSD_Exception_FLT_DENORMAL_OPERAND.hxx
Normal file
35
src/OSD/OSD_Exception_FLT_DENORMAL_OPERAND.hxx
Normal file
@@ -0,0 +1,35 @@
|
||||
// Copyright (c) 1992-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _OSD_Exception_FLT_DENORMAL_OPERAND_HeaderFile
|
||||
#define _OSD_Exception_FLT_DENORMAL_OPERAND_HeaderFile
|
||||
|
||||
#include <Standard_Type.hxx>
|
||||
#include <Standard_DefineException.hxx>
|
||||
#include <Standard_SStream.hxx>
|
||||
#include <OSD_Exception.hxx>
|
||||
|
||||
class OSD_Exception_FLT_DENORMAL_OPERAND;
|
||||
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);
|
||||
#else
|
||||
#define OSD_Exception_FLT_DENORMAL_OPERAND_Raise_if(CONDITION, MESSAGE)
|
||||
#endif
|
||||
|
||||
DEFINE_STANDARD_EXCEPTION(OSD_Exception_FLT_DENORMAL_OPERAND, OSD_Exception)
|
||||
|
||||
#endif // _OSD_Exception_FLT_DENORMAL_OPERAND_HeaderFile
|
35
src/OSD/OSD_Exception_FLT_DIVIDE_BY_ZERO.hxx
Normal file
35
src/OSD/OSD_Exception_FLT_DIVIDE_BY_ZERO.hxx
Normal file
@@ -0,0 +1,35 @@
|
||||
// Copyright (c) 1992-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _OSD_Exception_FLT_DIVIDE_BY_ZERO_HeaderFile
|
||||
#define _OSD_Exception_FLT_DIVIDE_BY_ZERO_HeaderFile
|
||||
|
||||
#include <Standard_Type.hxx>
|
||||
#include <Standard_DefineException.hxx>
|
||||
#include <Standard_SStream.hxx>
|
||||
#include <OSD_Exception.hxx>
|
||||
|
||||
class OSD_Exception_FLT_DIVIDE_BY_ZERO;
|
||||
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);
|
||||
#else
|
||||
#define OSD_Exception_FLT_DIVIDE_BY_ZERO_Raise_if(CONDITION, MESSAGE)
|
||||
#endif
|
||||
|
||||
DEFINE_STANDARD_EXCEPTION(OSD_Exception_FLT_DIVIDE_BY_ZERO, OSD_Exception)
|
||||
|
||||
#endif // _OSD_Exception_FLT_DIVIDE_BY_ZERO_HeaderFile
|
35
src/OSD/OSD_Exception_FLT_INEXACT_RESULT.hxx
Normal file
35
src/OSD/OSD_Exception_FLT_INEXACT_RESULT.hxx
Normal file
@@ -0,0 +1,35 @@
|
||||
// Copyright (c) 1992-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _OSD_Exception_FLT_INEXACT_RESULT_HeaderFile
|
||||
#define _OSD_Exception_FLT_INEXACT_RESULT_HeaderFile
|
||||
|
||||
#include <Standard_Type.hxx>
|
||||
#include <Standard_DefineException.hxx>
|
||||
#include <Standard_SStream.hxx>
|
||||
#include <OSD_Exception.hxx>
|
||||
|
||||
class OSD_Exception_FLT_INEXACT_RESULT;
|
||||
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);
|
||||
#else
|
||||
#define OSD_Exception_FLT_INEXACT_RESULT_Raise_if(CONDITION, MESSAGE)
|
||||
#endif
|
||||
|
||||
DEFINE_STANDARD_EXCEPTION(OSD_Exception_FLT_INEXACT_RESULT, OSD_Exception)
|
||||
|
||||
#endif // _OSD_Exception_FLT_INEXACT_RESULT_HeaderFile
|
35
src/OSD/OSD_Exception_FLT_INVALID_OPERATION.hxx
Normal file
35
src/OSD/OSD_Exception_FLT_INVALID_OPERATION.hxx
Normal file
@@ -0,0 +1,35 @@
|
||||
// Copyright (c) 1992-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _OSD_Exception_FLT_INVALID_OPERATION_HeaderFile
|
||||
#define _OSD_Exception_FLT_INVALID_OPERATION_HeaderFile
|
||||
|
||||
#include <Standard_Type.hxx>
|
||||
#include <Standard_DefineException.hxx>
|
||||
#include <Standard_SStream.hxx>
|
||||
#include <OSD_Exception.hxx>
|
||||
|
||||
class OSD_Exception_FLT_INVALID_OPERATION;
|
||||
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);
|
||||
#else
|
||||
#define OSD_Exception_FLT_INVALID_OPERATION_Raise_if(CONDITION, MESSAGE)
|
||||
#endif
|
||||
|
||||
DEFINE_STANDARD_EXCEPTION(OSD_Exception_FLT_INVALID_OPERATION, OSD_Exception)
|
||||
|
||||
#endif // _OSD_Exception_FLT_INVALID_OPERATION_HeaderFile
|
35
src/OSD/OSD_Exception_FLT_OVERFLOW.hxx
Normal file
35
src/OSD/OSD_Exception_FLT_OVERFLOW.hxx
Normal file
@@ -0,0 +1,35 @@
|
||||
// Copyright (c) 1992-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _OSD_Exception_FLT_OVERFLOW_HeaderFile
|
||||
#define _OSD_Exception_FLT_OVERFLOW_HeaderFile
|
||||
|
||||
#include <Standard_Type.hxx>
|
||||
#include <Standard_DefineException.hxx>
|
||||
#include <Standard_SStream.hxx>
|
||||
#include <OSD_Exception.hxx>
|
||||
|
||||
class OSD_Exception_FLT_OVERFLOW;
|
||||
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);
|
||||
#else
|
||||
#define OSD_Exception_FLT_OVERFLOW_Raise_if(CONDITION, MESSAGE)
|
||||
#endif
|
||||
|
||||
DEFINE_STANDARD_EXCEPTION(OSD_Exception_FLT_OVERFLOW, OSD_Exception)
|
||||
|
||||
#endif // _OSD_Exception_FLT_OVERFLOW_HeaderFile
|
35
src/OSD/OSD_Exception_FLT_STACK_CHECK.hxx
Normal file
35
src/OSD/OSD_Exception_FLT_STACK_CHECK.hxx
Normal file
@@ -0,0 +1,35 @@
|
||||
// Copyright (c) 1992-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _OSD_Exception_FLT_STACK_CHECK_HeaderFile
|
||||
#define _OSD_Exception_FLT_STACK_CHECK_HeaderFile
|
||||
|
||||
#include <Standard_Type.hxx>
|
||||
#include <Standard_DefineException.hxx>
|
||||
#include <Standard_SStream.hxx>
|
||||
#include <OSD_Exception.hxx>
|
||||
|
||||
class OSD_Exception_FLT_STACK_CHECK;
|
||||
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);
|
||||
#else
|
||||
#define OSD_Exception_FLT_STACK_CHECK_Raise_if(CONDITION, MESSAGE)
|
||||
#endif
|
||||
|
||||
DEFINE_STANDARD_EXCEPTION(OSD_Exception_FLT_STACK_CHECK, OSD_Exception)
|
||||
|
||||
#endif // _OSD_Exception_FLT_STACK_CHECK_HeaderFile
|
35
src/OSD/OSD_Exception_FLT_UNDERFLOW.hxx
Normal file
35
src/OSD/OSD_Exception_FLT_UNDERFLOW.hxx
Normal file
@@ -0,0 +1,35 @@
|
||||
// Copyright (c) 1992-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _OSD_Exception_FLT_UNDERFLOW_HeaderFile
|
||||
#define _OSD_Exception_FLT_UNDERFLOW_HeaderFile
|
||||
|
||||
#include <Standard_Type.hxx>
|
||||
#include <Standard_DefineException.hxx>
|
||||
#include <Standard_SStream.hxx>
|
||||
#include <OSD_Exception.hxx>
|
||||
|
||||
class OSD_Exception_FLT_UNDERFLOW;
|
||||
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);
|
||||
#else
|
||||
#define OSD_Exception_FLT_UNDERFLOW_Raise_if(CONDITION, MESSAGE)
|
||||
#endif
|
||||
|
||||
DEFINE_STANDARD_EXCEPTION(OSD_Exception_FLT_UNDERFLOW, OSD_Exception)
|
||||
|
||||
#endif // _OSD_Exception_FLT_UNDERFLOW_HeaderFile
|
35
src/OSD/OSD_Exception_ILLEGAL_INSTRUCTION.hxx
Normal file
35
src/OSD/OSD_Exception_ILLEGAL_INSTRUCTION.hxx
Normal file
@@ -0,0 +1,35 @@
|
||||
// Copyright (c) 1992-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _OSD_Exception_ILLEGAL_INSTRUCTION_HeaderFile
|
||||
#define _OSD_Exception_ILLEGAL_INSTRUCTION_HeaderFile
|
||||
|
||||
#include <Standard_Type.hxx>
|
||||
#include <Standard_DefineException.hxx>
|
||||
#include <Standard_SStream.hxx>
|
||||
#include <OSD_Exception.hxx>
|
||||
|
||||
class OSD_Exception_ILLEGAL_INSTRUCTION;
|
||||
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);
|
||||
#else
|
||||
#define OSD_Exception_ILLEGAL_INSTRUCTION_Raise_if(CONDITION, MESSAGE)
|
||||
#endif
|
||||
|
||||
DEFINE_STANDARD_EXCEPTION(OSD_Exception_ILLEGAL_INSTRUCTION, OSD_Exception)
|
||||
|
||||
#endif // _OSD_Exception_ILLEGAL_INSTRUCTION_HeaderFile
|
35
src/OSD/OSD_Exception_INT_DIVIDE_BY_ZERO.hxx
Normal file
35
src/OSD/OSD_Exception_INT_DIVIDE_BY_ZERO.hxx
Normal file
@@ -0,0 +1,35 @@
|
||||
// Copyright (c) 1992-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _OSD_Exception_INT_DIVIDE_BY_ZERO_HeaderFile
|
||||
#define _OSD_Exception_INT_DIVIDE_BY_ZERO_HeaderFile
|
||||
|
||||
#include <Standard_Type.hxx>
|
||||
#include <Standard_DefineException.hxx>
|
||||
#include <Standard_SStream.hxx>
|
||||
#include <OSD_Exception.hxx>
|
||||
|
||||
class OSD_Exception_INT_DIVIDE_BY_ZERO;
|
||||
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);
|
||||
#else
|
||||
#define OSD_Exception_INT_DIVIDE_BY_ZERO_Raise_if(CONDITION, MESSAGE)
|
||||
#endif
|
||||
|
||||
DEFINE_STANDARD_EXCEPTION(OSD_Exception_INT_DIVIDE_BY_ZERO, OSD_Exception)
|
||||
|
||||
#endif // _OSD_Exception_INT_DIVIDE_BY_ZERO_HeaderFile
|
35
src/OSD/OSD_Exception_INT_OVERFLOW.hxx
Normal file
35
src/OSD/OSD_Exception_INT_OVERFLOW.hxx
Normal file
@@ -0,0 +1,35 @@
|
||||
// Copyright (c) 1992-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _OSD_Exception_INT_OVERFLOW_HeaderFile
|
||||
#define _OSD_Exception_INT_OVERFLOW_HeaderFile
|
||||
|
||||
#include <Standard_Type.hxx>
|
||||
#include <Standard_DefineException.hxx>
|
||||
#include <Standard_SStream.hxx>
|
||||
#include <OSD_Exception.hxx>
|
||||
|
||||
class OSD_Exception_INT_OVERFLOW;
|
||||
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);
|
||||
#else
|
||||
#define OSD_Exception_INT_OVERFLOW_Raise_if(CONDITION, MESSAGE)
|
||||
#endif
|
||||
|
||||
DEFINE_STANDARD_EXCEPTION(OSD_Exception_INT_OVERFLOW, OSD_Exception)
|
||||
|
||||
#endif // _OSD_Exception_INT_OVERFLOW_HeaderFile
|
35
src/OSD/OSD_Exception_INVALID_DISPOSITION.hxx
Normal file
35
src/OSD/OSD_Exception_INVALID_DISPOSITION.hxx
Normal file
@@ -0,0 +1,35 @@
|
||||
// Copyright (c) 1992-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _OSD_Exception_INVALID_DISPOSITION_HeaderFile
|
||||
#define _OSD_Exception_INVALID_DISPOSITION_HeaderFile
|
||||
|
||||
#include <Standard_Type.hxx>
|
||||
#include <Standard_DefineException.hxx>
|
||||
#include <Standard_SStream.hxx>
|
||||
#include <OSD_Exception.hxx>
|
||||
|
||||
class OSD_Exception_INVALID_DISPOSITION;
|
||||
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);
|
||||
#else
|
||||
#define OSD_Exception_INVALID_DISPOSITION_Raise_if(CONDITION, MESSAGE)
|
||||
#endif
|
||||
|
||||
DEFINE_STANDARD_EXCEPTION(OSD_Exception_INVALID_DISPOSITION, OSD_Exception)
|
||||
|
||||
#endif // _OSD_Exception_INVALID_DISPOSITION_HeaderFile
|
35
src/OSD/OSD_Exception_IN_PAGE_ERROR.hxx
Normal file
35
src/OSD/OSD_Exception_IN_PAGE_ERROR.hxx
Normal file
@@ -0,0 +1,35 @@
|
||||
// Copyright (c) 1992-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _OSD_Exception_IN_PAGE_ERROR_HeaderFile
|
||||
#define _OSD_Exception_IN_PAGE_ERROR_HeaderFile
|
||||
|
||||
#include <Standard_Type.hxx>
|
||||
#include <Standard_DefineException.hxx>
|
||||
#include <Standard_SStream.hxx>
|
||||
#include <OSD_Exception.hxx>
|
||||
|
||||
class OSD_Exception_IN_PAGE_ERROR;
|
||||
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);
|
||||
#else
|
||||
#define OSD_Exception_IN_PAGE_ERROR_Raise_if(CONDITION, MESSAGE)
|
||||
#endif
|
||||
|
||||
DEFINE_STANDARD_EXCEPTION(OSD_Exception_IN_PAGE_ERROR, OSD_Exception)
|
||||
|
||||
#endif // _OSD_Exception_IN_PAGE_ERROR_HeaderFile
|
35
src/OSD/OSD_Exception_NONCONTINUABLE_EXCEPTION.hxx
Normal file
35
src/OSD/OSD_Exception_NONCONTINUABLE_EXCEPTION.hxx
Normal file
@@ -0,0 +1,35 @@
|
||||
// Copyright (c) 1992-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _OSD_Exception_NONCONTINUABLE_EXCEPTION_HeaderFile
|
||||
#define _OSD_Exception_NONCONTINUABLE_EXCEPTION_HeaderFile
|
||||
|
||||
#include <Standard_Type.hxx>
|
||||
#include <Standard_DefineException.hxx>
|
||||
#include <Standard_SStream.hxx>
|
||||
#include <OSD_Exception.hxx>
|
||||
|
||||
class OSD_Exception_NONCONTINUABLE_EXCEPTION;
|
||||
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);
|
||||
#else
|
||||
#define OSD_Exception_NONCONTINUABLE_EXCEPTION_Raise_if(CONDITION, MESSAGE)
|
||||
#endif
|
||||
|
||||
DEFINE_STANDARD_EXCEPTION(OSD_Exception_NONCONTINUABLE_EXCEPTION, OSD_Exception)
|
||||
|
||||
#endif // _OSD_Exception_NONCONTINUABLE_EXCEPTION_HeaderFile
|
35
src/OSD/OSD_Exception_PRIV_INSTRUCTION.hxx
Normal file
35
src/OSD/OSD_Exception_PRIV_INSTRUCTION.hxx
Normal file
@@ -0,0 +1,35 @@
|
||||
// Copyright (c) 1992-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _OSD_Exception_PRIV_INSTRUCTION_HeaderFile
|
||||
#define _OSD_Exception_PRIV_INSTRUCTION_HeaderFile
|
||||
|
||||
#include <Standard_Type.hxx>
|
||||
#include <Standard_DefineException.hxx>
|
||||
#include <Standard_SStream.hxx>
|
||||
#include <OSD_Exception.hxx>
|
||||
|
||||
class OSD_Exception_PRIV_INSTRUCTION;
|
||||
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);
|
||||
#else
|
||||
#define OSD_Exception_PRIV_INSTRUCTION_Raise_if(CONDITION, MESSAGE)
|
||||
#endif
|
||||
|
||||
DEFINE_STANDARD_EXCEPTION(OSD_Exception_PRIV_INSTRUCTION, OSD_Exception)
|
||||
|
||||
#endif // _OSD_Exception_PRIV_INSTRUCTION_HeaderFile
|
35
src/OSD/OSD_Exception_STACK_OVERFLOW.hxx
Normal file
35
src/OSD/OSD_Exception_STACK_OVERFLOW.hxx
Normal file
@@ -0,0 +1,35 @@
|
||||
// Copyright (c) 1992-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _OSD_Exception_STACK_OVERFLOW_HeaderFile
|
||||
#define _OSD_Exception_STACK_OVERFLOW_HeaderFile
|
||||
|
||||
#include <Standard_Type.hxx>
|
||||
#include <Standard_DefineException.hxx>
|
||||
#include <Standard_SStream.hxx>
|
||||
#include <OSD_Exception.hxx>
|
||||
|
||||
class OSD_Exception_STACK_OVERFLOW;
|
||||
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);
|
||||
#else
|
||||
#define OSD_Exception_STACK_OVERFLOW_Raise_if(CONDITION, MESSAGE)
|
||||
#endif
|
||||
|
||||
DEFINE_STANDARD_EXCEPTION(OSD_Exception_STACK_OVERFLOW, OSD_Exception)
|
||||
|
||||
#endif // _OSD_Exception_STACK_OVERFLOW_HeaderFile
|
35
src/OSD/OSD_Exception_STATUS_NO_MEMORY.hxx
Normal file
35
src/OSD/OSD_Exception_STATUS_NO_MEMORY.hxx
Normal file
@@ -0,0 +1,35 @@
|
||||
// Copyright (c) 1992-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _OSD_Exception_STATUS_NO_MEMORY_HeaderFile
|
||||
#define _OSD_Exception_STATUS_NO_MEMORY_HeaderFile
|
||||
|
||||
#include <Standard_Type.hxx>
|
||||
#include <Standard_DefineException.hxx>
|
||||
#include <Standard_SStream.hxx>
|
||||
#include <OSD_Exception.hxx>
|
||||
|
||||
class OSD_Exception_STATUS_NO_MEMORY;
|
||||
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);
|
||||
#else
|
||||
#define OSD_Exception_STATUS_NO_MEMORY_Raise_if(CONDITION, MESSAGE)
|
||||
#endif
|
||||
|
||||
DEFINE_STANDARD_EXCEPTION(OSD_Exception_STATUS_NO_MEMORY, OSD_Exception)
|
||||
|
||||
#endif // _OSD_Exception_STATUS_NO_MEMORY_HeaderFile
|
@@ -1,234 +0,0 @@
|
||||
-- Created on: 1992-02-17
|
||||
-- Created by: Stephan GARNAUD
|
||||
-- Copyright (c) 1992-1999 Matra Datavision
|
||||
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
--
|
||||
-- This file is part of Open CASCADE Technology software library.
|
||||
--
|
||||
-- This library is free software; you can redistribute it and/or modify it under
|
||||
-- the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
-- by the Free Software Foundation, with special exception defined in the file
|
||||
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
-- distribution for complete text of the license and disclaimer of any warranty.
|
||||
--
|
||||
-- Alternatively, this file may be used under the terms of Open CASCADE
|
||||
-- commercial license or contractual agreement.
|
||||
|
||||
-- Updated by: J.P. TIRAULT September,1 1993
|
||||
-- The methods Read and Write have been overloaded. Now they
|
||||
-- accept as input/output buffer both an AsciiString and an
|
||||
-- address to a structure.
|
||||
-- Updated by: J.P. TIRAULT January, 15 1995
|
||||
-- The method Read has been overloaded to read a line up to
|
||||
-- character LF (LineFeed)
|
||||
-- Updated by: J.P. TIRAULT June, 15 1995
|
||||
-- Adds a data member for FILE* associated to the file
|
||||
-- Updated by: E. PLOTNIKOV October 21 1999
|
||||
-- Set access method for myFILE field as 'protected' to
|
||||
-- use it in sub-classes
|
||||
|
||||
|
||||
class File from OSD inherits FileNode
|
||||
|
||||
---Purpose: Basic tools to manage files
|
||||
-- Warning: 'ProgramError' is raised when somebody wants to use the methods
|
||||
-- Read, Write, Seek, Close when File is not open.
|
||||
|
||||
uses
|
||||
Address from Standard,
|
||||
LockType from OSD,
|
||||
Protection from OSD,
|
||||
Path from OSD,
|
||||
Printer from OSD,
|
||||
OpenMode from OSD,
|
||||
FromWhere from OSD,
|
||||
KindFile from OSD,
|
||||
AsciiString from TCollection
|
||||
|
||||
raises ProgramError
|
||||
|
||||
is
|
||||
Create returns File;
|
||||
---Purpose: Creates File object.
|
||||
---Level: Public
|
||||
|
||||
Create (Name : Path) returns File;
|
||||
---Purpose: Instantiates the object file, storing its name
|
||||
---Level: Public
|
||||
|
||||
Build (me : in out; Mode : OpenMode; Protect : Protection)
|
||||
---Purpose: CREATES a file if it doesn't already exists or empties
|
||||
-- an existing file.
|
||||
-- After 'Build', the file is open.
|
||||
-- If no name was given, ProgramError is raised.
|
||||
---Level: Public
|
||||
raises ProgramError is static;
|
||||
|
||||
Open (me : in out; Mode : OpenMode ; Protect : Protection)
|
||||
---Purpose: Opens a File with specific attributes
|
||||
-- This works only on already existing file.
|
||||
-- If no name was given, ProgramError is raised.
|
||||
---Level: Public
|
||||
raises ProgramError is static;
|
||||
|
||||
Append (me : in out; Mode : OpenMode; Protect : Protection)
|
||||
---Purpose: Appends data to an existing file.
|
||||
-- If file doesn't exist, creates it first.
|
||||
-- After 'Append', the file is open.
|
||||
-- If no name was given, ProgramError is raised.
|
||||
---Level: Public
|
||||
raises ProgramError is static;
|
||||
|
||||
Read (me : in out; Buffer : out AsciiString ; Nbyte : Integer)
|
||||
---Purpose: Attempts to read Nbyte bytes from the file associated with
|
||||
-- the object file.
|
||||
-- Upon successful completion, Read returns the number of
|
||||
-- bytes actually read and placed in the Buffer. This number
|
||||
-- may be less than Nbyte if the number of bytes left in the file
|
||||
-- is less than Nbyte bytes. In this case only number of read
|
||||
-- bytes will be placed in the buffer.
|
||||
---Level: Public
|
||||
|
||||
raises ProgramError is static;
|
||||
|
||||
|
||||
ReadLine (me : in out; Buffer : out AsciiString ; NByte : Integer;
|
||||
NbyteRead : out Integer)
|
||||
---Purpose: Reads bytes from the data pointed to by the object file
|
||||
-- into the buffer <Buffer>.
|
||||
-- Data is read until <NByte-1> bytes have been read,
|
||||
-- until a newline character is read and transferred into
|
||||
-- <Buffer>, or until an EOF (End-of-File) condition is
|
||||
-- encountered.
|
||||
-- Upon successful completion, Read returns the number of
|
||||
-- bytes actually read into <NByteRead> and placed into the
|
||||
-- Buffer <Buffer>.
|
||||
---Level: Public
|
||||
|
||||
raises ProgramError is static;
|
||||
|
||||
Read (me : in out; Buffer : out Address ; Nbyte : Integer ;
|
||||
Readbyte : out Integer )
|
||||
---Purpose: Attempts to read Nbyte bytes from the files associated with
|
||||
-- the object File.
|
||||
-- Upon successful completion, Read returns the number of
|
||||
-- bytes actually read and placed in the Buffer. This number
|
||||
-- may be less than Nbyte if the number of bytes left in the file
|
||||
-- is less than Nbyte bytes. For this reason the output
|
||||
-- parameter Readbyte will contain the number of read bytes.
|
||||
---Level: Public
|
||||
|
||||
raises ProgramError is static;
|
||||
|
||||
Write (me : in out; Buffer: AsciiString ; Nbyte: Integer )
|
||||
---Purpose: Attempts to write Nbyte bytes from the AsciiString to the file
|
||||
-- associated to the object File.
|
||||
---Level: Public
|
||||
|
||||
raises ProgramError is static;
|
||||
|
||||
Write (me : in out; Buffer: Address ; Nbyte: Integer )
|
||||
---Purpose: Attempts to write Nbyte bytes from the buffer pointed
|
||||
-- to by Buffer to the file associated to the object File.
|
||||
---Level: Public
|
||||
raises ProgramError is static;
|
||||
|
||||
|
||||
Seek (me : in out; Offset : Integer ; Whence: FromWhere )
|
||||
---Purpose: Sets the seek pointer associated with the open file
|
||||
---Warning: This is very slow on VMS.
|
||||
---Level: Public
|
||||
raises ProgramError is static;
|
||||
|
||||
Close (me : in out)
|
||||
---Purpose: Closes the file (and deletes a descriptor)
|
||||
---Level: Public
|
||||
raises ProgramError is static;
|
||||
|
||||
IsAtEnd (me : in out) returns Boolean
|
||||
---Purpose: Returns TRUE if the seek pointer is at end of file.
|
||||
---Level: Public
|
||||
raises ProgramError is static;
|
||||
|
||||
KindOfFile (me) returns KindFile;
|
||||
---Purpose: Returns the kind of file. A file can be a
|
||||
-- file, a directory or a link.
|
||||
|
||||
BuildTemporary (myclass) returns File;
|
||||
---Purpose: Makes a temporary File
|
||||
-- This returned file is already open !
|
||||
-- This file is non-persistent and will be automatically
|
||||
-- removed when its process finishes.
|
||||
---Level: Public
|
||||
|
||||
SetLock (me : in out ; Lock : LockType)
|
||||
---Purpose: Locks current file
|
||||
---Level: Public
|
||||
raises ProgramError is static;
|
||||
|
||||
UnLock (me : in out)
|
||||
---Purpose: Unlocks current file
|
||||
---Level: Public
|
||||
raises ProgramError is static;
|
||||
|
||||
GetLock (me : in out) returns LockType
|
||||
---Purpose: Returns the current lock state
|
||||
---Level: Public
|
||||
raises ProgramError is static;
|
||||
|
||||
IsLocked (me : in out) returns Boolean
|
||||
---Purpose: Returns TRUE if this file is locked.
|
||||
---Level: Public
|
||||
raises ProgramError is static;
|
||||
|
||||
Size (me: out) returns Size
|
||||
---Purpose: Returns actual number of bytes of <me>.
|
||||
---Level: Public
|
||||
raises ProgramError is static;
|
||||
|
||||
Print (me : in out; WhichPrinter : Printer)
|
||||
---Purpose: Prints a file on selected printer.
|
||||
---Level: Public
|
||||
raises ProgramError is static;
|
||||
|
||||
IsOpen (me) returns Boolean
|
||||
---Purpose: Returns TRUE if <me> is open.
|
||||
---Level: Public
|
||||
raises ProgramError is static;
|
||||
|
||||
IsReadable (me : in out) returns Boolean from Standard ;
|
||||
---Purpose: returns TRUE if the file exists and if the user
|
||||
-- has the autorization to read it.
|
||||
|
||||
IsWriteable(me : in out) returns Boolean from Standard ;
|
||||
---Purpose: returns TRUE if the file can be read and overwritten.
|
||||
|
||||
IsExecutable(me : in out) returns Boolean from Standard ;
|
||||
---Purpose: returns TRUE if the file can be executed.
|
||||
|
||||
ReadLastLine (me: in out; aLine: out AsciiString ; aDelay: in Integer ;
|
||||
aNbTries: in Integer) returns Boolean
|
||||
---Purpose: Enables to emulate unix "tail -f" command.
|
||||
-- If a line is available in the file <me> returns it.
|
||||
-- Otherwise attemps to read again aNbTries times in the file
|
||||
-- waiting aDelay seconds between each read.
|
||||
-- If meanwhile the file increases returns the next line, otherwise
|
||||
-- returns FALSE.
|
||||
raises ProgramError is static;
|
||||
|
||||
Edit(me: in out)
|
||||
returns Boolean from Standard;
|
||||
---Purpose: find an editor on the system and edit the given file
|
||||
---Level: Public
|
||||
|
||||
fields
|
||||
ImperativeFlag : Boolean; -- Says if lock is imperative or not
|
||||
myLock : LockType;
|
||||
myMode : OpenMode;
|
||||
myIO : Integer is protected; -- Stores peculiar I/O informations
|
||||
myFILE : Address is protected;
|
||||
myFileChannel : Integer is protected; -- file descriptor, Unix/Linux only
|
||||
myFileHandle : Address is protected; -- file handle, Windows only
|
||||
end File from OSD;
|
||||
|
||||
|
@@ -18,13 +18,17 @@
|
||||
|
||||
#ifndef _WIN32
|
||||
|
||||
#include <Standard_ProgramError.hxx>
|
||||
#include <OSD_OSDError.hxx>
|
||||
#include <OSD_WhoAmI.hxx>
|
||||
#include <OSD_FromWhere.hxx>
|
||||
#include <OSD_File.ixx>
|
||||
|
||||
#include <OSD_File.hxx>
|
||||
#include <OSD_FromWhere.hxx>
|
||||
#include <OSD_OSDError.hxx>
|
||||
#include <OSD_Path.hxx>
|
||||
#include <OSD_Printer.hxx>
|
||||
#include <OSD_Protection.hxx>
|
||||
#include <OSD_WhoAmI.hxx>
|
||||
#include <Standard_PCharacter.hxx>
|
||||
#include <Standard_ProgramError.hxx>
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
|
||||
const OSD_WhoAmI Iam = OSD_WFile;
|
||||
|
||||
|
201
src/OSD/OSD_File.hxx
Normal file
201
src/OSD/OSD_File.hxx
Normal file
@@ -0,0 +1,201 @@
|
||||
// Created on: 1992-02-17
|
||||
// Created by: Stephan GARNAUD
|
||||
// Copyright (c) 1992-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _OSD_File_HeaderFile
|
||||
#define _OSD_File_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
#include <Standard_Handle.hxx>
|
||||
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <OSD_LockType.hxx>
|
||||
#include <OSD_OpenMode.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <Standard_Address.hxx>
|
||||
#include <OSD_FileNode.hxx>
|
||||
#include <OSD_FromWhere.hxx>
|
||||
#include <OSD_KindFile.hxx>
|
||||
#include <Standard_Size.hxx>
|
||||
class Standard_ProgramError;
|
||||
class OSD_Path;
|
||||
class OSD_Protection;
|
||||
class TCollection_AsciiString;
|
||||
class OSD_Printer;
|
||||
|
||||
|
||||
//! Basic tools to manage files
|
||||
//! Warning: 'ProgramError' is raised when somebody wants to use the methods
|
||||
//! Read, Write, Seek, Close when File is not open.
|
||||
class OSD_File : public OSD_FileNode
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
//! Creates File object.
|
||||
Standard_EXPORT OSD_File();
|
||||
|
||||
//! Instantiates the object file, storing its name
|
||||
Standard_EXPORT OSD_File(const OSD_Path& Name);
|
||||
|
||||
//! CREATES a file if it doesn't already exists or empties
|
||||
//! an existing file.
|
||||
//! After 'Build', the file is open.
|
||||
//! If no name was given, ProgramError is raised.
|
||||
Standard_EXPORT void Build (const OSD_OpenMode Mode, const OSD_Protection& Protect);
|
||||
|
||||
//! Opens a File with specific attributes
|
||||
//! This works only on already existing file.
|
||||
//! If no name was given, ProgramError is raised.
|
||||
Standard_EXPORT void Open (const OSD_OpenMode Mode, const OSD_Protection& Protect);
|
||||
|
||||
//! Appends data to an existing file.
|
||||
//! If file doesn't exist, creates it first.
|
||||
//! After 'Append', the file is open.
|
||||
//! If no name was given, ProgramError is raised.
|
||||
Standard_EXPORT void Append (const OSD_OpenMode Mode, const OSD_Protection& Protect);
|
||||
|
||||
//! Attempts to read Nbyte bytes from the file associated with
|
||||
//! the object file.
|
||||
//! Upon successful completion, Read returns the number of
|
||||
//! bytes actually read and placed in the Buffer. This number
|
||||
//! may be less than Nbyte if the number of bytes left in the file
|
||||
//! is less than Nbyte bytes. In this case only number of read
|
||||
//! bytes will be placed in the buffer.
|
||||
Standard_EXPORT void Read (TCollection_AsciiString& Buffer, const Standard_Integer Nbyte);
|
||||
|
||||
//! Reads bytes from the data pointed to by the object file
|
||||
//! into the buffer <Buffer>.
|
||||
//! Data is read until <NByte-1> bytes have been read,
|
||||
//! until a newline character is read and transferred into
|
||||
//! <Buffer>, or until an EOF (End-of-File) condition is
|
||||
//! encountered.
|
||||
//! Upon successful completion, Read returns the number of
|
||||
//! bytes actually read into <NByteRead> and placed into the
|
||||
//! Buffer <Buffer>.
|
||||
Standard_EXPORT void ReadLine (TCollection_AsciiString& Buffer, const Standard_Integer NByte, Standard_Integer& NbyteRead);
|
||||
|
||||
//! Attempts to read Nbyte bytes from the files associated with
|
||||
//! the object File.
|
||||
//! Upon successful completion, Read returns the number of
|
||||
//! bytes actually read and placed in the Buffer. This number
|
||||
//! may be less than Nbyte if the number of bytes left in the file
|
||||
//! is less than Nbyte bytes. For this reason the output
|
||||
//! parameter Readbyte will contain the number of read bytes.
|
||||
Standard_EXPORT void Read (Standard_Address& Buffer, const Standard_Integer Nbyte, Standard_Integer& Readbyte);
|
||||
|
||||
//! Attempts to write Nbyte bytes from the AsciiString to the file
|
||||
//! associated to the object File.
|
||||
Standard_EXPORT void Write (const TCollection_AsciiString& Buffer, const Standard_Integer Nbyte);
|
||||
|
||||
//! Attempts to write Nbyte bytes from the buffer pointed
|
||||
//! to by Buffer to the file associated to the object File.
|
||||
Standard_EXPORT void Write (const Standard_Address Buffer, const Standard_Integer Nbyte);
|
||||
|
||||
//! Sets the seek pointer associated with the open file
|
||||
Standard_EXPORT void Seek (const Standard_Integer Offset, const OSD_FromWhere Whence);
|
||||
|
||||
//! Closes the file (and deletes a descriptor)
|
||||
Standard_EXPORT void Close();
|
||||
|
||||
//! Returns TRUE if the seek pointer is at end of file.
|
||||
Standard_EXPORT Standard_Boolean IsAtEnd();
|
||||
|
||||
//! Returns the kind of file. A file can be a
|
||||
//! file, a directory or a link.
|
||||
Standard_EXPORT OSD_KindFile KindOfFile() const;
|
||||
|
||||
//! Makes a temporary File
|
||||
//! This returned file is already open !
|
||||
//! This file is non-persistent and will be automatically
|
||||
//! removed when its process finishes.
|
||||
Standard_EXPORT static OSD_File BuildTemporary();
|
||||
|
||||
//! Locks current file
|
||||
Standard_EXPORT void SetLock (const OSD_LockType Lock);
|
||||
|
||||
//! Unlocks current file
|
||||
Standard_EXPORT void UnLock();
|
||||
|
||||
//! Returns the current lock state
|
||||
Standard_EXPORT OSD_LockType GetLock();
|
||||
|
||||
//! Returns TRUE if this file is locked.
|
||||
Standard_EXPORT Standard_Boolean IsLocked();
|
||||
|
||||
//! Returns actual number of bytes of <me>.
|
||||
Standard_EXPORT Standard_Size Size();
|
||||
|
||||
//! Prints a file on selected printer.
|
||||
Standard_EXPORT void Print (const OSD_Printer& WhichPrinter);
|
||||
|
||||
//! Returns TRUE if <me> is open.
|
||||
Standard_EXPORT Standard_Boolean IsOpen() const;
|
||||
|
||||
//! returns TRUE if the file exists and if the user
|
||||
//! has the autorization to read it.
|
||||
Standard_EXPORT Standard_Boolean IsReadable();
|
||||
|
||||
//! returns TRUE if the file can be read and overwritten.
|
||||
Standard_EXPORT Standard_Boolean IsWriteable();
|
||||
|
||||
//! returns TRUE if the file can be executed.
|
||||
Standard_EXPORT Standard_Boolean IsExecutable();
|
||||
|
||||
//! Enables to emulate unix "tail -f" command.
|
||||
//! If a line is available in the file <me> returns it.
|
||||
//! Otherwise attemps to read again aNbTries times in the file
|
||||
//! waiting aDelay seconds between each read.
|
||||
//! If meanwhile the file increases returns the next line, otherwise
|
||||
//! returns FALSE.
|
||||
Standard_EXPORT Standard_Boolean ReadLastLine (TCollection_AsciiString& aLine, const Standard_Integer aDelay, const Standard_Integer aNbTries);
|
||||
|
||||
//! find an editor on the system and edit the given file
|
||||
Standard_EXPORT Standard_Boolean Edit();
|
||||
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
Standard_Integer myIO;
|
||||
Standard_Address myFILE;
|
||||
Standard_Integer myFileChannel;
|
||||
Standard_Address myFileHandle;
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
Standard_Boolean ImperativeFlag;
|
||||
OSD_LockType myLock;
|
||||
OSD_OpenMode myMode;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _OSD_File_HeaderFile
|
@@ -1,95 +0,0 @@
|
||||
-- Created on: 1992-03-18
|
||||
-- Created by: Stephan GARNAUD
|
||||
-- Copyright (c) 1992-1999 Matra Datavision
|
||||
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
--
|
||||
-- This file is part of Open CASCADE Technology software library.
|
||||
--
|
||||
-- This library is free software; you can redistribute it and/or modify it under
|
||||
-- the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
-- by the Free Software Foundation, with special exception defined in the file
|
||||
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
-- distribution for complete text of the license and disclaimer of any warranty.
|
||||
--
|
||||
-- Alternatively, this file may be used under the terms of Open CASCADE
|
||||
-- commercial license or contractual agreement.
|
||||
|
||||
class FileIterator from OSD
|
||||
|
||||
---Purpose: Manages a breadth-only search for files in the specified
|
||||
-- Path.
|
||||
-- There is no specific order of results.
|
||||
|
||||
uses File, Path, Error, AsciiString from TCollection
|
||||
raises OSDError
|
||||
|
||||
|
||||
is
|
||||
|
||||
Create returns FileIterator ;
|
||||
---WARNING : This method is not implemented on Windows NT System
|
||||
---Purpose: Instantiates Object as empty Iterator;
|
||||
---Level: Public
|
||||
|
||||
Create (where : Path ; Mask : AsciiString) returns FileIterator;
|
||||
---Purpose: Instantiates Object as Iterator;
|
||||
-- Wild-card "*" can be used in Mask the same way it
|
||||
-- is used by unix shell for file names
|
||||
---Level: Public
|
||||
|
||||
Destroy ( me : out );
|
||||
---C++: alias ~
|
||||
-- Only implemented on Windows NT
|
||||
|
||||
Initialize (me : in out ; where : Path ; Mask : AsciiString) is static;
|
||||
---WARNING : This method is not implemented on Windows NT System
|
||||
---Purpose: Initializes the current File Iterator
|
||||
---Level: Public
|
||||
|
||||
More (me : in out) returns Boolean is static;
|
||||
---Purpose: Returns TRUE if there are other items using the 'Tree'
|
||||
-- method.
|
||||
---Level: Public
|
||||
|
||||
Next (me : in out) is static;
|
||||
---Purpose: Sets the iterator to the next item.
|
||||
-- Returns the item value corresponding to the current
|
||||
-- position of the iterator.
|
||||
---Level: Public
|
||||
|
||||
Values (me : in out) returns File is static;
|
||||
---Purpose: Returns the next file found .
|
||||
---Level: Public
|
||||
|
||||
Failed (me) returns Boolean is static;
|
||||
---Purpose: Returns TRUE if an error occurs
|
||||
---Level: Public
|
||||
|
||||
Reset (me : in out) is static;
|
||||
---Purpose: Resets error counter to zero
|
||||
---Level: Public
|
||||
|
||||
|
||||
Perror (me : in out)
|
||||
---Purpose: Raises OSD_Error
|
||||
---Level: Public
|
||||
raises OSDError is static;
|
||||
|
||||
Error (me) returns Integer is static;
|
||||
---Purpose: Returns error number if 'Failed' is TRUE.
|
||||
---Level: Public
|
||||
|
||||
fields
|
||||
TheIterator : File; -- The iterator item
|
||||
myFlag : Integer;
|
||||
myMask : AsciiString;
|
||||
myPlace : AsciiString;
|
||||
myDescr : Address ; -- unused by Windows NT code
|
||||
myEntry : Address ; -- unused by Windows NT code
|
||||
myInit : Integer ; -- unused by Windows NT code
|
||||
myError : Error;
|
||||
myHandle : Address; -- Windows NT specific
|
||||
myData : Address; -- Windows NT specific
|
||||
myFirstCall : Boolean; -- Windows NT specific
|
||||
end FileIterator from OSD;
|
||||
|
@@ -14,14 +14,18 @@
|
||||
|
||||
#ifndef WNT
|
||||
|
||||
#include <OSD_FileIterator.ixx>
|
||||
|
||||
#include <OSD_File.hxx>
|
||||
#include <OSD_FileIterator.hxx>
|
||||
#include <OSD_OSDError.hxx>
|
||||
#include <OSD_Path.hxx>
|
||||
#include <OSD_WhoAmI.hxx>
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
|
||||
#include <dirent.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
# include <dirent.h>
|
||||
#include <sys/types.h>
|
||||
# define NAMLEN(dirent) strlen((dirent)->d_name)
|
||||
# ifdef VMS
|
||||
extern char *vmsify PARAMS ((char *name, int type));
|
||||
@@ -254,7 +258,12 @@ Standard_Integer OSD_FileIterator::Error()const{
|
||||
#define STRICT
|
||||
#include <windows.h>
|
||||
|
||||
#include <OSD_FileIterator.ixx>
|
||||
|
||||
#include <OSD_File.hxx>
|
||||
#include <OSD_FileIterator.hxx>
|
||||
#include <OSD_OSDError.hxx>
|
||||
#include <OSD_Path.hxx>
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
#include <TCollection_ExtendedString.hxx>
|
||||
|
||||
#define _FD ( ( PWIN32_FIND_DATAW )myData )
|
||||
|
121
src/OSD/OSD_FileIterator.hxx
Normal file
121
src/OSD/OSD_FileIterator.hxx
Normal file
@@ -0,0 +1,121 @@
|
||||
// Created on: 1992-03-18
|
||||
// Created by: Stephan GARNAUD
|
||||
// Copyright (c) 1992-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _OSD_FileIterator_HeaderFile
|
||||
#define _OSD_FileIterator_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
#include <Standard_Handle.hxx>
|
||||
|
||||
#include <OSD_File.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
#include <Standard_Address.hxx>
|
||||
#include <OSD_Error.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
class OSD_OSDError;
|
||||
class OSD_Path;
|
||||
class TCollection_AsciiString;
|
||||
class OSD_File;
|
||||
|
||||
|
||||
//! Manages a breadth-only search for files in the specified
|
||||
//! Path.
|
||||
//! There is no specific order of results.
|
||||
class OSD_FileIterator
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
//! Instantiates Object as empty Iterator;
|
||||
Standard_EXPORT OSD_FileIterator();
|
||||
|
||||
//! Instantiates Object as Iterator;
|
||||
//! Wild-card "*" can be used in Mask the same way it
|
||||
//! is used by unix shell for file names
|
||||
Standard_EXPORT OSD_FileIterator(const OSD_Path& where, const TCollection_AsciiString& Mask);
|
||||
|
||||
Standard_EXPORT void Destroy();
|
||||
~OSD_FileIterator()
|
||||
{
|
||||
Destroy();
|
||||
}
|
||||
|
||||
//! Initializes the current File Iterator
|
||||
Standard_EXPORT void Initialize (const OSD_Path& where, const TCollection_AsciiString& Mask);
|
||||
|
||||
//! Returns TRUE if there are other items using the 'Tree'
|
||||
//! method.
|
||||
Standard_EXPORT Standard_Boolean More();
|
||||
|
||||
//! Sets the iterator to the next item.
|
||||
//! Returns the item value corresponding to the current
|
||||
//! position of the iterator.
|
||||
Standard_EXPORT void Next();
|
||||
|
||||
//! Returns the next file found .
|
||||
Standard_EXPORT OSD_File Values();
|
||||
|
||||
//! Returns TRUE if an error occurs
|
||||
Standard_EXPORT Standard_Boolean Failed() const;
|
||||
|
||||
//! Resets error counter to zero
|
||||
Standard_EXPORT void Reset();
|
||||
|
||||
//! Raises OSD_Error
|
||||
Standard_EXPORT void Perror();
|
||||
|
||||
//! Returns error number if 'Failed' is TRUE.
|
||||
Standard_EXPORT Standard_Integer Error() const;
|
||||
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
OSD_File TheIterator;
|
||||
Standard_Integer myFlag;
|
||||
TCollection_AsciiString myMask;
|
||||
TCollection_AsciiString myPlace;
|
||||
Standard_Address myDescr;
|
||||
Standard_Address myEntry;
|
||||
Standard_Integer myInit;
|
||||
OSD_Error myError;
|
||||
Standard_Address myHandle;
|
||||
Standard_Address myData;
|
||||
Standard_Boolean myFirstCall;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _OSD_FileIterator_HeaderFile
|
@@ -1,129 +0,0 @@
|
||||
-- Created on: 2024-03-15
|
||||
-- Created by: Stephan GARNAUD (ARM)
|
||||
-- Copyright (c) 1998-1999 Matra Datavision
|
||||
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
--
|
||||
-- This file is part of Open CASCADE Technology software library.
|
||||
--
|
||||
-- This library is free software; you can redistribute it and/or modify it under
|
||||
-- the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
-- by the Free Software Foundation, with special exception defined in the file
|
||||
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
-- distribution for complete text of the license and disclaimer of any warranty.
|
||||
--
|
||||
-- Alternatively, this file may be used under the terms of Open CASCADE
|
||||
-- commercial license or contractual agreement.
|
||||
|
||||
deferred class FileNode from OSD
|
||||
|
||||
---Purpose: A class for 'File' and 'Directory' grouping common
|
||||
-- methods (file/directory manipulation tools).
|
||||
-- The "file oriented" name means files or directories which are
|
||||
-- in fact hard coded as files.
|
||||
|
||||
uses Protection, Date, Path, OpenMode, Error, AsciiString from TCollection
|
||||
raises OSDError, ProgramError
|
||||
|
||||
|
||||
is
|
||||
Initialize;
|
||||
---Purpose: Creates FileNode object
|
||||
-- This is to be used with SetPath .
|
||||
-- Allocate space for the file name and initializes this
|
||||
-- name to an empty name.
|
||||
---Level: Internal
|
||||
|
||||
Initialize (Name : Path )
|
||||
---Purpose: Instantiates the object FileNode storing its name.
|
||||
-- If a name is not found, it raises a program error.
|
||||
---Level: Internal
|
||||
raises ProgramError;
|
||||
|
||||
Path(me ; Name : out Path) is static;
|
||||
---Purpose: Gets file name and path.
|
||||
---Level: Public
|
||||
|
||||
SetPath(me : in out; Name : Path)
|
||||
---Purpose: Sets file name and path.
|
||||
-- If a name is not found, it raises a program error.
|
||||
---Level: Public
|
||||
raises ProgramError is static;
|
||||
|
||||
Exists ( me : in out ) returns Boolean
|
||||
---Purpose: Returns TRUE if <me> exists.
|
||||
---Level: Public
|
||||
raises ProgramError is static;
|
||||
|
||||
Remove (me : in out)
|
||||
---Purpose: Erases the FileNode from directory
|
||||
---Level: Public
|
||||
raises ProgramError is static;
|
||||
|
||||
Move (me : in out; NewPath : Path)
|
||||
---Purpose: Moves <me> into another directory
|
||||
---Level: Public
|
||||
raises ProgramError is static;
|
||||
|
||||
Copy (me : in out; ToPath : Path )
|
||||
---Purpose: Copies <me> to another FileNode
|
||||
---Level: Public
|
||||
raises ProgramError is static;
|
||||
|
||||
Protection (me : in out) returns Protection
|
||||
---Purpose: Returns access mode of <me>.
|
||||
---Level: Public
|
||||
raises ProgramError is static;
|
||||
|
||||
SetProtection (me : out; Prot : Protection)
|
||||
---Purpose: Changes protection of the FileNode
|
||||
---Level: Public
|
||||
raises ProgramError is static;
|
||||
|
||||
AccessMoment (me : in out) returns Date
|
||||
---Purpose: Returns last write access.
|
||||
-- On UNIX, AccessMoment and CreationMoment return the
|
||||
-- same value.
|
||||
---Level: Public
|
||||
raises ProgramError is static;
|
||||
|
||||
CreationMoment (me : in out) returns Date
|
||||
---Purpose: Returns creation date.
|
||||
-- On UNIX, AccessMoment and CreationMoment return the
|
||||
-- same value.
|
||||
---Level: Public
|
||||
raises ProgramError is static;
|
||||
|
||||
UserId (me : in out) returns Integer
|
||||
---Purpose: Returns User Identification.
|
||||
---Level: Public
|
||||
raises ProgramError is static;
|
||||
|
||||
GroupId (me : in out) returns Integer
|
||||
---Purpose: Returns Group Identification.
|
||||
---Level: Public
|
||||
raises ProgramError is static;
|
||||
|
||||
Failed (me) returns Boolean is static;
|
||||
---Purpose: Returns TRUE if an error occurs
|
||||
---Level: Public
|
||||
|
||||
Reset (me : in out) is static;
|
||||
---Purpose: Resets error counter to zero
|
||||
---Level: Public
|
||||
|
||||
Perror (me : in out)
|
||||
---Purpose: Raises OSD_Error
|
||||
---Level: Public
|
||||
raises OSDError is static;
|
||||
|
||||
Error (me) returns Integer is static;
|
||||
---Purpose: Returns error number if 'Failed' is TRUE.
|
||||
---Level: Public
|
||||
|
||||
fields
|
||||
myPath : Path is protected; -- system independent path name
|
||||
myError : Error is protected;
|
||||
end FileNode from OSD;
|
||||
|
||||
|
||||
|
@@ -18,22 +18,22 @@
|
||||
//------------------- Linux Sources of OSD_FileNode --------------------------
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
#include <Standard_ProgramError.hxx>
|
||||
#include <OSD_FileNode.hxx>
|
||||
#include <OSD_OSDError.hxx>
|
||||
#include <Standard_NullObject.hxx>
|
||||
#include <OSD_Path.hxx>
|
||||
#include <OSD_Protection.hxx>
|
||||
#include <OSD_WhoAmI.hxx>
|
||||
#include <OSD_FileNode.ixx>
|
||||
#include <Quantity_Date.hxx>
|
||||
#include <Standard_NullObject.hxx>
|
||||
#include <Standard_ProgramError.hxx>
|
||||
|
||||
#include <stdlib.h> // For "system"
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include <unistd.h>
|
||||
// For "system"
|
||||
const OSD_WhoAmI Iam = OSD_WFileNode;
|
||||
|
||||
|
||||
|
134
src/OSD/OSD_FileNode.hxx
Normal file
134
src/OSD/OSD_FileNode.hxx
Normal file
@@ -0,0 +1,134 @@
|
||||
// Created on: 2024-03-15
|
||||
// Created by: Stephan GARNAUD (ARM)
|
||||
// Copyright (c) 1998-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _OSD_FileNode_HeaderFile
|
||||
#define _OSD_FileNode_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
#include <Standard_Handle.hxx>
|
||||
|
||||
#include <OSD_Path.hxx>
|
||||
#include <OSD_Error.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
class OSD_OSDError;
|
||||
class Standard_ProgramError;
|
||||
class OSD_Path;
|
||||
class OSD_Protection;
|
||||
class Quantity_Date;
|
||||
|
||||
|
||||
//! A class for 'File' and 'Directory' grouping common
|
||||
//! methods (file/directory manipulation tools).
|
||||
//! The "file oriented" name means files or directories which are
|
||||
//! in fact hard coded as files.
|
||||
class OSD_FileNode
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
//! Gets file name and path.
|
||||
Standard_EXPORT void Path (OSD_Path& Name) const;
|
||||
|
||||
//! Sets file name and path.
|
||||
//! If a name is not found, it raises a program error.
|
||||
Standard_EXPORT void SetPath (const OSD_Path& Name);
|
||||
|
||||
//! Returns TRUE if <me> exists.
|
||||
Standard_EXPORT Standard_Boolean Exists();
|
||||
|
||||
//! Erases the FileNode from directory
|
||||
Standard_EXPORT void Remove();
|
||||
|
||||
//! Moves <me> into another directory
|
||||
Standard_EXPORT void Move (const OSD_Path& NewPath);
|
||||
|
||||
//! Copies <me> to another FileNode
|
||||
Standard_EXPORT void Copy (const OSD_Path& ToPath);
|
||||
|
||||
//! Returns access mode of <me>.
|
||||
Standard_EXPORT OSD_Protection Protection();
|
||||
|
||||
//! Changes protection of the FileNode
|
||||
Standard_EXPORT void SetProtection (const OSD_Protection& Prot);
|
||||
|
||||
//! Returns last write access.
|
||||
//! On UNIX, AccessMoment and CreationMoment return the
|
||||
//! same value.
|
||||
Standard_EXPORT Quantity_Date AccessMoment();
|
||||
|
||||
//! Returns creation date.
|
||||
//! On UNIX, AccessMoment and CreationMoment return the
|
||||
//! same value.
|
||||
Standard_EXPORT Quantity_Date CreationMoment();
|
||||
|
||||
//! Returns User Identification.
|
||||
Standard_EXPORT Standard_Integer UserId();
|
||||
|
||||
//! Returns Group Identification.
|
||||
Standard_EXPORT Standard_Integer GroupId();
|
||||
|
||||
//! Returns TRUE if an error occurs
|
||||
Standard_EXPORT Standard_Boolean Failed() const;
|
||||
|
||||
//! Resets error counter to zero
|
||||
Standard_EXPORT void Reset();
|
||||
|
||||
//! Raises OSD_Error
|
||||
Standard_EXPORT void Perror();
|
||||
|
||||
//! Returns error number if 'Failed' is TRUE.
|
||||
Standard_EXPORT Standard_Integer Error() const;
|
||||
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
//! Creates FileNode object
|
||||
//! This is to be used with SetPath .
|
||||
//! Allocate space for the file name and initializes this
|
||||
//! name to an empty name.
|
||||
Standard_EXPORT OSD_FileNode();
|
||||
|
||||
//! Instantiates the object FileNode storing its name.
|
||||
//! If a name is not found, it raises a program error.
|
||||
Standard_EXPORT OSD_FileNode(const OSD_Path& Name);
|
||||
|
||||
|
||||
OSD_Path myPath;
|
||||
OSD_Error myError;
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _OSD_FileNode_HeaderFile
|
26
src/OSD/OSD_FromWhere.hxx
Normal file
26
src/OSD/OSD_FromWhere.hxx
Normal file
@@ -0,0 +1,26 @@
|
||||
// Copyright (c) 1992-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _OSD_FromWhere_HeaderFile
|
||||
#define _OSD_FromWhere_HeaderFile
|
||||
|
||||
//! Used by OSD_File in the method Seek.
|
||||
enum OSD_FromWhere
|
||||
{
|
||||
OSD_FromBeginning,
|
||||
OSD_FromHere,
|
||||
OSD_FromEnd
|
||||
};
|
||||
|
||||
#endif // _OSD_FromWhere_HeaderFile
|
@@ -1,78 +0,0 @@
|
||||
-- Created on: 2018-03-15
|
||||
-- Created by: Stephan GARNAUD (ARM)
|
||||
-- Copyright (c) 1998-1999 Matra Datavision
|
||||
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
--
|
||||
-- This file is part of Open CASCADE Technology software library.
|
||||
--
|
||||
-- This library is free software; you can redistribute it and/or modify it under
|
||||
-- the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
-- by the Free Software Foundation, with special exception defined in the file
|
||||
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
-- distribution for complete text of the license and disclaimer of any warranty.
|
||||
--
|
||||
-- Alternatively, this file may be used under the terms of Open CASCADE
|
||||
-- commercial license or contractual agreement.
|
||||
|
||||
class Host from OSD
|
||||
|
||||
---Purpose: Carries information about a Host
|
||||
-- System version ,host name, nodename ...
|
||||
|
||||
|
||||
uses SysType, OEMType, Error, AsciiString from TCollection
|
||||
raises ConstructionError, NullObject, OSDError
|
||||
|
||||
is
|
||||
|
||||
Create returns Host;
|
||||
---Purpose: Initializes current host by default.
|
||||
---Level: Advanced
|
||||
|
||||
SystemVersion (me : in out) returns AsciiString is static;
|
||||
---Purpose: Returns system name and version
|
||||
---Level: Advanced
|
||||
|
||||
SystemId (me) returns SysType is static;
|
||||
---Purpose: Returns the system type (UNIX System V, UNIX BSD, MS-DOS...)
|
||||
---Level: Advanced
|
||||
|
||||
HostName (me : in out) returns AsciiString is static;
|
||||
---Purpose: Returns host name.
|
||||
---Level: Advanced
|
||||
|
||||
AvailableMemory (me : in out) returns Integer is static;
|
||||
---Purpose: Returns available memory in Kilobytes.
|
||||
---Level: Obsolete syntax. Will be removed in next version
|
||||
|
||||
InternetAddress (me : in out) returns AsciiString is static;
|
||||
---Purpose: Returns Internet address of current host.
|
||||
---Level: Advanced
|
||||
|
||||
MachineType (me : in out) returns OEMType is static;
|
||||
---Purpose: Returns type of current machine.
|
||||
---Level: Advanced
|
||||
|
||||
Failed (me) returns Boolean is static;
|
||||
---Purpose: Returns TRUE if an error occurs
|
||||
---Level: Advanced
|
||||
|
||||
Reset (me : in out) is static;
|
||||
---Purpose: Resets error counter to zero
|
||||
---Level: Advanced
|
||||
|
||||
Perror (me : in out)
|
||||
---Purpose: Raises OSD_Error
|
||||
---Level: Advanced
|
||||
raises OSDError is static;
|
||||
|
||||
Error (me) returns Integer is static;
|
||||
---Purpose: Returns error number if 'Failed' is TRUE.
|
||||
---Level: Advanced
|
||||
|
||||
fields
|
||||
myName : AsciiString;
|
||||
myError : Error;
|
||||
end Host from OSD;
|
||||
|
||||
|
@@ -14,10 +14,13 @@
|
||||
|
||||
#ifndef WNT
|
||||
|
||||
#include <Standard_NullObject.hxx>
|
||||
#include <Standard_ConstructionError.hxx>
|
||||
#include <OSD_Host.ixx>
|
||||
|
||||
#include <OSD_Host.hxx>
|
||||
#include <OSD_OSDError.hxx>
|
||||
#include <OSD_WhoAmI.hxx>
|
||||
#include <Standard_ConstructionError.hxx>
|
||||
#include <Standard_NullObject.hxx>
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
|
||||
const OSD_WhoAmI Iam = OSD_WHost;
|
||||
|
||||
|
103
src/OSD/OSD_Host.hxx
Normal file
103
src/OSD/OSD_Host.hxx
Normal file
@@ -0,0 +1,103 @@
|
||||
// Created on: 2018-03-15
|
||||
// Created by: Stephan GARNAUD (ARM)
|
||||
// Copyright (c) 1998-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _OSD_Host_HeaderFile
|
||||
#define _OSD_Host_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
#include <Standard_Handle.hxx>
|
||||
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
#include <OSD_Error.hxx>
|
||||
#include <OSD_SysType.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <OSD_OEMType.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
class Standard_ConstructionError;
|
||||
class Standard_NullObject;
|
||||
class OSD_OSDError;
|
||||
class TCollection_AsciiString;
|
||||
|
||||
|
||||
//! Carries information about a Host
|
||||
//! System version ,host name, nodename ...
|
||||
class OSD_Host
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
//! Initializes current host by default.
|
||||
Standard_EXPORT OSD_Host();
|
||||
|
||||
//! Returns system name and version
|
||||
Standard_EXPORT TCollection_AsciiString SystemVersion();
|
||||
|
||||
//! Returns the system type (UNIX System V, UNIX BSD, MS-DOS...)
|
||||
Standard_EXPORT OSD_SysType SystemId() const;
|
||||
|
||||
//! Returns host name.
|
||||
Standard_EXPORT TCollection_AsciiString HostName();
|
||||
|
||||
//! Returns available memory in Kilobytes.
|
||||
Standard_EXPORT Standard_Integer AvailableMemory();
|
||||
|
||||
//! Returns Internet address of current host.
|
||||
Standard_EXPORT TCollection_AsciiString InternetAddress();
|
||||
|
||||
//! Returns type of current machine.
|
||||
Standard_EXPORT OSD_OEMType MachineType();
|
||||
|
||||
//! Returns TRUE if an error occurs
|
||||
Standard_EXPORT Standard_Boolean Failed() const;
|
||||
|
||||
//! Resets error counter to zero
|
||||
Standard_EXPORT void Reset();
|
||||
|
||||
//! Raises OSD_Error
|
||||
Standard_EXPORT void Perror();
|
||||
|
||||
//! Returns error number if 'Failed' is TRUE.
|
||||
Standard_EXPORT Standard_Integer Error() const;
|
||||
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
TCollection_AsciiString myName;
|
||||
OSD_Error myError;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _OSD_Host_HeaderFile
|
28
src/OSD/OSD_KindFile.hxx
Normal file
28
src/OSD/OSD_KindFile.hxx
Normal file
@@ -0,0 +1,28 @@
|
||||
// Copyright (c) 1992-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _OSD_KindFile_HeaderFile
|
||||
#define _OSD_KindFile_HeaderFile
|
||||
|
||||
//! Specifies the type of files.
|
||||
enum OSD_KindFile
|
||||
{
|
||||
OSD_FILE,
|
||||
OSD_DIRECTORY,
|
||||
OSD_LINK,
|
||||
OSD_SOCKET,
|
||||
OSD_UNKNOWN
|
||||
};
|
||||
|
||||
#endif // _OSD_KindFile_HeaderFile
|
25
src/OSD/OSD_LoadMode.hxx
Normal file
25
src/OSD/OSD_LoadMode.hxx
Normal file
@@ -0,0 +1,25 @@
|
||||
// Copyright (c) 1992-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _OSD_LoadMode_HeaderFile
|
||||
#define _OSD_LoadMode_HeaderFile
|
||||
|
||||
//! This enumeration is used to load shareable libraries.
|
||||
enum OSD_LoadMode
|
||||
{
|
||||
OSD_RTLD_LAZY,
|
||||
OSD_RTLD_NOW
|
||||
};
|
||||
|
||||
#endif // _OSD_LoadMode_HeaderFile
|
38
src/OSD/OSD_LockType.hxx
Normal file
38
src/OSD/OSD_LockType.hxx
Normal file
@@ -0,0 +1,38 @@
|
||||
// Copyright (c) 1992-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _OSD_LockType_HeaderFile
|
||||
#define _OSD_LockType_HeaderFile
|
||||
|
||||
//! locks for files.
|
||||
//! NoLock is the default value when opening a file.
|
||||
//!
|
||||
//! ReadLock allows only one reading of the file at a time.
|
||||
//!
|
||||
//! WriteLock prevents others writing into a file(excepted the user
|
||||
//! who puts the lock)but allows everybody to read.
|
||||
//!
|
||||
//! ExclusiveLock prevents reading and writing except for the
|
||||
//! current user of the file.
|
||||
//! So ExclusiveLock means only one user on the file and this
|
||||
//! user is the one who puts the lock.
|
||||
enum OSD_LockType
|
||||
{
|
||||
OSD_NoLock,
|
||||
OSD_ReadLock,
|
||||
OSD_WriteLock,
|
||||
OSD_ExclusiveLock
|
||||
};
|
||||
|
||||
#endif // _OSD_LockType_HeaderFile
|
36
src/OSD/OSD_OEMType.hxx
Normal file
36
src/OSD/OSD_OEMType.hxx
Normal file
@@ -0,0 +1,36 @@
|
||||
// Copyright (c) 1992-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _OSD_OEMType_HeaderFile
|
||||
#define _OSD_OEMType_HeaderFile
|
||||
|
||||
//! This is set of possible machine types
|
||||
//! used in OSD_Host::MachineType
|
||||
enum OSD_OEMType
|
||||
{
|
||||
OSD_Unavailable,
|
||||
OSD_SUN,
|
||||
OSD_DEC,
|
||||
OSD_SGI,
|
||||
OSD_NEC,
|
||||
OSD_MAC,
|
||||
OSD_PC,
|
||||
OSD_HP,
|
||||
OSD_IBM,
|
||||
OSD_VAX,
|
||||
OSD_LIN,
|
||||
OSD_AIX
|
||||
};
|
||||
|
||||
#endif // _OSD_OEMType_HeaderFile
|
35
src/OSD/OSD_OSDError.hxx
Normal file
35
src/OSD/OSD_OSDError.hxx
Normal file
@@ -0,0 +1,35 @@
|
||||
// Copyright (c) 1992-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _OSD_OSDError_HeaderFile
|
||||
#define _OSD_OSDError_HeaderFile
|
||||
|
||||
#include <Standard_Type.hxx>
|
||||
#include <Standard_DefineException.hxx>
|
||||
#include <Standard_SStream.hxx>
|
||||
#include <Standard_Failure.hxx>
|
||||
|
||||
class OSD_OSDError;
|
||||
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);
|
||||
#else
|
||||
#define OSD_OSDError_Raise_if(CONDITION, MESSAGE)
|
||||
#endif
|
||||
|
||||
DEFINE_STANDARD_EXCEPTION(OSD_OSDError, Standard_Failure)
|
||||
|
||||
#endif // _OSD_OSDError_HeaderFile
|
26
src/OSD/OSD_OpenMode.hxx
Normal file
26
src/OSD/OSD_OpenMode.hxx
Normal file
@@ -0,0 +1,26 @@
|
||||
// Copyright (c) 1992-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _OSD_OpenMode_HeaderFile
|
||||
#define _OSD_OpenMode_HeaderFile
|
||||
|
||||
//! Specifies the file open mode.
|
||||
enum OSD_OpenMode
|
||||
{
|
||||
OSD_ReadOnly,
|
||||
OSD_WriteOnly,
|
||||
OSD_ReadWrite
|
||||
};
|
||||
|
||||
#endif // _OSD_OpenMode_HeaderFile
|
@@ -1,284 +0,0 @@
|
||||
-- Created on: 1992-02-18
|
||||
-- Created by: Stephan GARNAUD (ARM)
|
||||
-- Copyright (c) 1992-1999 Matra Datavision
|
||||
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
--
|
||||
-- This file is part of Open CASCADE Technology software library.
|
||||
--
|
||||
-- This library is free software; you can redistribute it and/or modify it under
|
||||
-- the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
-- by the Free Software Foundation, with special exception defined in the file
|
||||
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
-- distribution for complete text of the license and disclaimer of any warranty.
|
||||
--
|
||||
-- Alternatively, this file may be used under the terms of Open CASCADE
|
||||
-- commercial license or contractual agreement.
|
||||
|
||||
-- Modified by LD on Dec 15 1995
|
||||
-- Methode SetSystemName added
|
||||
|
||||
|
||||
|
||||
class Path from OSD
|
||||
|
||||
--Purpose: Manage a system independent path.
|
||||
-- It is possible to give this object a complete
|
||||
-- path including VMS possibilities such as
|
||||
-- Node"Username Password"::Disk:[path1.path2]
|
||||
-- This system dependent syntax is avoided with the
|
||||
-- SetValues method.
|
||||
|
||||
uses Environment, SysType, Error, AsciiString from TCollection
|
||||
raises ConstructionError, NullObject, OSDError, NumericError, ProgramError
|
||||
|
||||
is
|
||||
Create returns Path;
|
||||
---Purpose: Creates a Path object initialized to an empty string.
|
||||
-- i.e. current directory.
|
||||
---Level: Public
|
||||
|
||||
Create (aDependentName : AsciiString; aSysType : SysType=OSD_Default) returns Path
|
||||
---Purpose: Creates a Path object initialized by dependant path.
|
||||
-- ex: OSD_Path me ("/usr/bin/myprog.sh",OSD_UnixBSD);
|
||||
--
|
||||
-- OSD_Path me ("sys$common:[syslib]cc.exe",OSD_OSF) will
|
||||
-- raise a ProgramError due to invalid name for this
|
||||
-- type of system.
|
||||
-- In order to avoid a 'ProgramError' , use IsValid(...)
|
||||
-- to ensure you the validity of <aDependentName>.
|
||||
-- Raises ConstructionError when the path is either null
|
||||
-- or contains characters not in range of ' '...'~'.
|
||||
---Level: Public
|
||||
raises ConstructionError;
|
||||
|
||||
Create (aNode,aUsername,aPassword,aDisk,aTrek,aName,anExtension: in AsciiString) returns Path;
|
||||
---Purpose: Initializes a system independent path.
|
||||
-- By default , the Path conversion will be assumed using
|
||||
-- currently used system.
|
||||
-- A special syntax is used to specify a "aTrek" in an
|
||||
-- independent manner :
|
||||
-- a "|" represents directory separator
|
||||
-- a "^" means directory above (father)
|
||||
-- examples:
|
||||
-- "|usr|bin" - On UNIX -> "/usr/bin"
|
||||
-- - On VMS -> "[usr.bin]"
|
||||
-- - On MSDOS-> "\usr\bin"
|
||||
-- - On MacOs-> ": usr : bin"
|
||||
--
|
||||
-- "^|rep" - On UNIX -> "../rep"
|
||||
-- - On VMS -> "[-.rep]"
|
||||
-- - On MSDOS -> "..\rep"
|
||||
-- - On MacOS-> ":: rep"
|
||||
--
|
||||
-- "subdir|" - On UNIX -> "subdir/"
|
||||
-- - On VMS -> "[.subdir.]"
|
||||
|
||||
---Example: Create("amelix", "sga", "toto", "dk$22", "|bin|usr",myFile,"")
|
||||
-- will give internaly
|
||||
-- On MS-DOS/OS2 \DK22\BIN\USR\MYFILE
|
||||
-- On UNIX sga"toto"@amelix:/dk22/bin/usr/myFile
|
||||
-- On VMS AMELIX"SGA TOTO"::DK$22:[BIN.USR]MYFILE
|
||||
-- On MacOs dk$22 : bin : usr : myFile
|
||||
--
|
||||
-- As you can see, "aDisk" is used under UNIX.
|
||||
-- This is possible when one 'mounts' a directory from another system.
|
||||
-- However, the syntax of <aDisk> can slightly change on several systems.
|
||||
-- So "DK$22" on VMS becomes "dk22" on UNIX and Windows NT.
|
||||
-- for instance when you mount a VMS directory under UNIX this gives:
|
||||
--
|
||||
-- lucide:/dk22/mydirectory mounted on /vms/mydirectory
|
||||
---Level: Public
|
||||
|
||||
|
||||
Values (me ; aNode,aUsername,aPassword,aDisk,aTrek,aName,anExtension :
|
||||
out AsciiString) is static;
|
||||
---Purpose: Gets each component of a path.
|
||||
---Level: Public
|
||||
|
||||
SetValues (me : in out;
|
||||
aNode,aUsername,aPassword,aDisk,aTrek,aName,anExtension : in AsciiString)
|
||||
---Purpose: Sets each component of a path.
|
||||
---Level: Public
|
||||
raises ConstructionError is static;
|
||||
|
||||
SystemName(me ; FullName : out AsciiString ; aType : SysType=OSD_Default)
|
||||
is static;
|
||||
---Purpose: Returns system dependent path
|
||||
-- <aType> is one among Unix,VMS ...
|
||||
-- This function is not private because you may need to
|
||||
-- display system dependent path on a front-end.
|
||||
-- It can be useful when communicating with another system.
|
||||
-- For instance when you want to communicate between VMS and Unix
|
||||
-- to transfer files, or to do a remote procedure call
|
||||
-- using files.
|
||||
-- example :
|
||||
-- OSD_Path myPath ("sparc4", "sga", "secret_passwd",
|
||||
-- "$5$dkb100","|users|examples");
|
||||
-- Internal ( Dependent_name );
|
||||
-- On UNIX sga"secret_passwd"@sparc4:/users/examples
|
||||
-- On VMS sparc4"sga secret_passwd"::$5$dkb100:[users.examples]
|
||||
---Level: Public
|
||||
|
||||
-- SetSystemName(me : in out ; aDependentName : AsciiString; aSysType : SysType=OSD_Default)
|
||||
---Purpose: Sets each component of a Path giving its system dependent name.
|
||||
---Level: Public
|
||||
-- raises ConstructionError is static;
|
||||
|
||||
ExpandedName(me : in out; aName : out AsciiString)
|
||||
is static;
|
||||
---Purpose: Returns system dependent path resolving logical symbols.
|
||||
|
||||
IsValid (myclass ; theDependentName : AsciiString; theSysType : SysType = OSD_Default)
|
||||
returns Boolean;
|
||||
---Purpose: Returns TRUE if <theDependentName> is valid for this SysType.
|
||||
---Level: Public
|
||||
|
||||
UpTrek (me : in out) is static;
|
||||
---Purpose: This removes the last directory name in <aTrek>
|
||||
-- and returns result.
|
||||
-- ex: me = "|usr|bin|todo.sh"
|
||||
-- me.UpTrek() gives me = "|usr|todo.sh"
|
||||
-- if <me> contains "|", me.UpTrek() will give again "|"
|
||||
-- without any error.
|
||||
---Level: Public
|
||||
|
||||
DownTrek(me : in out; aName : AsciiString) is static;
|
||||
---Purpose: This appends a directory name into the Trek.
|
||||
-- ex: me = "|usr|todo.sh"
|
||||
-- me.DownTrek("bin") gives me = "|usr|bin|todo.sh".
|
||||
---Level: Public
|
||||
|
||||
TrekLength(me) returns Integer is static;
|
||||
---Purpose: Returns number of components in Trek of <me>.
|
||||
-- ex: me = "|usr|sys|etc|bin"
|
||||
-- me.TrekLength() returns 4.
|
||||
---Level: Public
|
||||
|
||||
RemoveATrek(me : in out; where : Integer)
|
||||
---Purpose: This removes a component of Trek in <me> at position <where>.
|
||||
-- The first component of Trek is numbered 1.
|
||||
-- ex: me = "|usr|bin|"
|
||||
-- me.RemoveATrek(1) gives me = "|bin|"
|
||||
-- To avoid a 'NumericError' because of a bad <where>, use
|
||||
-- TrekLength() to know number of components of Trek in <me>.
|
||||
---Level: Public
|
||||
raises NumericError is static;
|
||||
|
||||
RemoveATrek(me : in out; aName : AsciiString) is static;
|
||||
---Purpose: This removes <aName> from <me> in Trek.
|
||||
-- No error is raised if <aName> is not in <me>.
|
||||
-- ex: me = "|usr|sys|etc|doc"
|
||||
-- me.RemoveATrek("sys") gives me = "|usr|etc|doc".
|
||||
---Level: Public
|
||||
|
||||
TrekValue(me ; where : Integer) returns AsciiString
|
||||
---Purpose: Returns component of Trek in <me> at position <where>.
|
||||
-- ex: me = "|usr|bin|sys|"
|
||||
-- me.TrekValue(2) returns "bin"
|
||||
raises NumericError is static;
|
||||
---Level: Public
|
||||
|
||||
InsertATrek(me : in out; aName : AsciiString; where : Integer)
|
||||
---Purpose: This inserts <aName> at position <where> into Trek of <me>.
|
||||
-- ex: me = "|usr|etc|"
|
||||
-- me.InsertATrek("sys",2) gives me = "|usr|sys|etc"
|
||||
raises NumericError is static;
|
||||
---Level: Public
|
||||
|
||||
Node (me) returns AsciiString is static;
|
||||
---Purpose: Returns Node of <me>.
|
||||
---Level: Public
|
||||
|
||||
UserName (me) returns AsciiString is static;
|
||||
---Purpose: Returns UserName of <me>.
|
||||
---Level: Public
|
||||
|
||||
Password (me) returns AsciiString is static;
|
||||
---Purpose: Returns Password of <me>.
|
||||
---Level: Public
|
||||
|
||||
Disk(me) returns AsciiString is static;
|
||||
---Purpose: Returns Disk of <me>.
|
||||
---Level: Public
|
||||
|
||||
Trek(me) returns AsciiString is static;
|
||||
---Purpose: Returns Trek of <me>.
|
||||
---Level: Public
|
||||
|
||||
Name (me) returns AsciiString is static;
|
||||
---Purpose: Returns file name of <me>.
|
||||
-- If <me> hasn't been initialized, it returns an empty AsciiString.
|
||||
---Level: Public
|
||||
|
||||
Extension (me) returns AsciiString is static;
|
||||
---Purpose: Returns my extension name.
|
||||
-- This returns an empty string if path contains no file name.
|
||||
---Level: Public
|
||||
|
||||
SetNode (me : in out; aName : AsciiString) is static;
|
||||
---Purpose: Sets Node of <me>.
|
||||
---Level: Public
|
||||
|
||||
SetUserName (me : in out; aName : AsciiString) is static;
|
||||
---Purpose: Sets UserName of <me>.
|
||||
---Level: Public
|
||||
|
||||
SetPassword (me : in out; aName : AsciiString) is static;
|
||||
---Purpose: Sets Password of <me>.
|
||||
---Level: Public
|
||||
|
||||
SetDisk(me : in out; aName : AsciiString) is static;
|
||||
---Purpose: Sets Disk of <me>.
|
||||
---Level: Public
|
||||
|
||||
SetTrek(me : in out; aName : AsciiString) is static;
|
||||
---Purpose: Sets Trek of <me>.
|
||||
---Level: Public
|
||||
|
||||
SetName (me : in out; aName : AsciiString) is static;
|
||||
---Purpose: Sets file name of <me>.
|
||||
-- If <me> hasn't been initialized, it returns an empty AsciiString.
|
||||
---Level: Public
|
||||
|
||||
SetExtension (me : in out; aName : AsciiString) is static;
|
||||
---Purpose: Sets my extension name.
|
||||
---Level: Public
|
||||
|
||||
LocateExecFile(me : in out; aPath: out Path from OSD )
|
||||
returns Boolean from Standard ;
|
||||
---Purpose: Finds the full path of an executable file, like the
|
||||
-- "which" Unix utility. Uses the path environment variable.
|
||||
-- Returns False if executable file not found.
|
||||
---Level: Public
|
||||
|
||||
RelativePath(myclass; DirPath, AbsFilePath : AsciiString from TCollection)
|
||||
returns AsciiString from TCollection ;
|
||||
---Purpose: Returns the relative file path between the absolute directory
|
||||
--- path <DirPath> and the absolute file path <AbsFilePath>.
|
||||
--- If <DirPath> starts with "/", pathes are handled as
|
||||
--- on Unix, if it starts with a letter followed by ":", as on
|
||||
--- WNT. In particular on WNT directory names are not key sensitive.
|
||||
--- If handling fails, an empty string is returned.
|
||||
---Level: Public
|
||||
|
||||
|
||||
AbsolutePath(myclass; DirPath, RelFilePath : AsciiString from TCollection)
|
||||
returns AsciiString from TCollection ;
|
||||
---Purpose: Returns the absolute file path from the absolute directory path
|
||||
--- <DirPath> and the relative file path returned by RelativePath().
|
||||
--- If the RelFilePath is an absolute path, it is returned and the
|
||||
--- directory path is ignored.
|
||||
--- If handling fails, an empty string is returned.
|
||||
|
||||
|
||||
fields
|
||||
myNode : AsciiString;
|
||||
myUserName : AsciiString;
|
||||
myPassword : AsciiString;
|
||||
myDisk : AsciiString;
|
||||
myTrek : AsciiString;
|
||||
myName : AsciiString;
|
||||
myExtension : AsciiString;
|
||||
myUNCFlag : Boolean ;
|
||||
mySysDep : SysType; -- To allow system specific use
|
||||
end Path from OSD;
|
@@ -12,7 +12,14 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#include <OSD_Path.ixx>
|
||||
|
||||
#include <OSD_OSDError.hxx>
|
||||
#include <OSD_Path.hxx>
|
||||
#include <Standard_ConstructionError.hxx>
|
||||
#include <Standard_NullObject.hxx>
|
||||
#include <Standard_NumericError.hxx>
|
||||
#include <Standard_ProgramError.hxx>
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
|
||||
static OSD_SysType whereAmI(){
|
||||
#if defined(__digital__) || defined(__FreeBSD__) || defined(SUNOS) || defined(__APPLE__)
|
||||
|
250
src/OSD/OSD_Path.hxx
Normal file
250
src/OSD/OSD_Path.hxx
Normal file
@@ -0,0 +1,250 @@
|
||||
// Created on: 1992-02-18
|
||||
// Created by: Stephan GARNAUD (ARM)
|
||||
// Copyright (c) 1992-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _OSD_Path_HeaderFile
|
||||
#define _OSD_Path_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
#include <Standard_Handle.hxx>
|
||||
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <OSD_SysType.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
class Standard_ConstructionError;
|
||||
class Standard_NullObject;
|
||||
class OSD_OSDError;
|
||||
class Standard_NumericError;
|
||||
class Standard_ProgramError;
|
||||
class TCollection_AsciiString;
|
||||
|
||||
|
||||
|
||||
class OSD_Path
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
//! Creates a Path object initialized to an empty string.
|
||||
//! i.e. current directory.
|
||||
Standard_EXPORT OSD_Path();
|
||||
|
||||
//! Creates a Path object initialized by dependant path.
|
||||
//! ex: OSD_Path me ("/usr/bin/myprog.sh",OSD_UnixBSD);
|
||||
//!
|
||||
//! OSD_Path me ("sys$common:[syslib]cc.exe",OSD_OSF) will
|
||||
//! raise a ProgramError due to invalid name for this
|
||||
//! type of system.
|
||||
//! In order to avoid a 'ProgramError' , use IsValid(...)
|
||||
//! to ensure you the validity of <aDependentName>.
|
||||
//! Raises ConstructionError when the path is either null
|
||||
//! or contains characters not in range of ' '...'~'.
|
||||
Standard_EXPORT OSD_Path(const TCollection_AsciiString& aDependentName, const OSD_SysType aSysType = OSD_Default);
|
||||
|
||||
//! Initializes a system independent path.
|
||||
//! By default , the Path conversion will be assumed using
|
||||
//! currently used system.
|
||||
//! A special syntax is used to specify a "aTrek" in an
|
||||
//! independent manner :
|
||||
//! a "|" represents directory separator
|
||||
//! a "^" means directory above (father)
|
||||
//! examples:
|
||||
//! "|usr|bin" - On UNIX -> "/usr/bin"
|
||||
//! - On VMS -> "[usr.bin]"
|
||||
//! - On MSDOS-> "\usr\bin"
|
||||
//! - On MacOs-> ": usr : bin"
|
||||
//!
|
||||
//! "^|rep" - On UNIX -> "../rep"
|
||||
//! - On VMS -> "[-.rep]"
|
||||
//! - On MSDOS -> "..\rep"
|
||||
//! - On MacOS-> ":: rep"
|
||||
//!
|
||||
//! "subdir|" - On UNIX -> "subdir/"
|
||||
//! - On VMS -> "[.subdir.]"
|
||||
Standard_EXPORT OSD_Path(const TCollection_AsciiString& aNode, const TCollection_AsciiString& aUsername, const TCollection_AsciiString& aPassword, const TCollection_AsciiString& aDisk, const TCollection_AsciiString& aTrek, const TCollection_AsciiString& aName, const TCollection_AsciiString& anExtension);
|
||||
|
||||
//! Gets each component of a path.
|
||||
Standard_EXPORT void Values (TCollection_AsciiString& aNode, TCollection_AsciiString& aUsername, TCollection_AsciiString& aPassword, TCollection_AsciiString& aDisk, TCollection_AsciiString& aTrek, TCollection_AsciiString& aName, TCollection_AsciiString& anExtension) const;
|
||||
|
||||
//! Sets each component of a path.
|
||||
Standard_EXPORT void SetValues (const TCollection_AsciiString& aNode, const TCollection_AsciiString& aUsername, const TCollection_AsciiString& aPassword, const TCollection_AsciiString& aDisk, const TCollection_AsciiString& aTrek, const TCollection_AsciiString& aName, const TCollection_AsciiString& anExtension);
|
||||
|
||||
//! Returns system dependent path
|
||||
//! <aType> is one among Unix,VMS ...
|
||||
//! This function is not private because you may need to
|
||||
//! display system dependent path on a front-end.
|
||||
//! It can be useful when communicating with another system.
|
||||
//! For instance when you want to communicate between VMS and Unix
|
||||
//! to transfer files, or to do a remote procedure call
|
||||
//! using files.
|
||||
//! example :
|
||||
//! OSD_Path myPath ("sparc4", "sga", "secret_passwd",
|
||||
//! "$5$dkb100","|users|examples");
|
||||
//! Internal ( Dependent_name );
|
||||
//! On UNIX sga"secret_passwd"@sparc4:/users/examples
|
||||
//! On VMS sparc4"sga secret_passwd"::$5$dkb100:[users.examples]
|
||||
//! Sets each component of a Path giving its system dependent name.
|
||||
Standard_EXPORT void SystemName (TCollection_AsciiString& FullName, const OSD_SysType aType = OSD_Default) const;
|
||||
|
||||
//! Returns system dependent path resolving logical symbols.
|
||||
Standard_EXPORT void ExpandedName (TCollection_AsciiString& aName);
|
||||
|
||||
//! Returns TRUE if <theDependentName> is valid for this SysType.
|
||||
Standard_EXPORT static Standard_Boolean IsValid (const TCollection_AsciiString& theDependentName, const OSD_SysType theSysType = OSD_Default);
|
||||
|
||||
//! This removes the last directory name in <aTrek>
|
||||
//! and returns result.
|
||||
//! ex: me = "|usr|bin|todo.sh"
|
||||
//! me.UpTrek() gives me = "|usr|todo.sh"
|
||||
//! if <me> contains "|", me.UpTrek() will give again "|"
|
||||
//! without any error.
|
||||
Standard_EXPORT void UpTrek();
|
||||
|
||||
//! This appends a directory name into the Trek.
|
||||
//! ex: me = "|usr|todo.sh"
|
||||
//! me.DownTrek("bin") gives me = "|usr|bin|todo.sh".
|
||||
Standard_EXPORT void DownTrek (const TCollection_AsciiString& aName);
|
||||
|
||||
//! Returns number of components in Trek of <me>.
|
||||
//! ex: me = "|usr|sys|etc|bin"
|
||||
//! me.TrekLength() returns 4.
|
||||
Standard_EXPORT Standard_Integer TrekLength() const;
|
||||
|
||||
//! This removes a component of Trek in <me> at position <where>.
|
||||
//! The first component of Trek is numbered 1.
|
||||
//! ex: me = "|usr|bin|"
|
||||
//! me.RemoveATrek(1) gives me = "|bin|"
|
||||
//! To avoid a 'NumericError' because of a bad <where>, use
|
||||
//! TrekLength() to know number of components of Trek in <me>.
|
||||
Standard_EXPORT void RemoveATrek (const Standard_Integer where);
|
||||
|
||||
//! This removes <aName> from <me> in Trek.
|
||||
//! No error is raised if <aName> is not in <me>.
|
||||
//! ex: me = "|usr|sys|etc|doc"
|
||||
//! me.RemoveATrek("sys") gives me = "|usr|etc|doc".
|
||||
Standard_EXPORT void RemoveATrek (const TCollection_AsciiString& aName);
|
||||
|
||||
//! Returns component of Trek in <me> at position <where>.
|
||||
//! ex: me = "|usr|bin|sys|"
|
||||
//! me.TrekValue(2) returns "bin"
|
||||
Standard_EXPORT TCollection_AsciiString TrekValue (const Standard_Integer where) const;
|
||||
|
||||
//! This inserts <aName> at position <where> into Trek of <me>.
|
||||
//! ex: me = "|usr|etc|"
|
||||
//! me.InsertATrek("sys",2) gives me = "|usr|sys|etc"
|
||||
Standard_EXPORT void InsertATrek (const TCollection_AsciiString& aName, const Standard_Integer where);
|
||||
|
||||
//! Returns Node of <me>.
|
||||
Standard_EXPORT TCollection_AsciiString Node() const;
|
||||
|
||||
//! Returns UserName of <me>.
|
||||
Standard_EXPORT TCollection_AsciiString UserName() const;
|
||||
|
||||
//! Returns Password of <me>.
|
||||
Standard_EXPORT TCollection_AsciiString Password() const;
|
||||
|
||||
//! Returns Disk of <me>.
|
||||
Standard_EXPORT TCollection_AsciiString Disk() const;
|
||||
|
||||
//! Returns Trek of <me>.
|
||||
Standard_EXPORT TCollection_AsciiString Trek() const;
|
||||
|
||||
//! Returns file name of <me>.
|
||||
//! If <me> hasn't been initialized, it returns an empty AsciiString.
|
||||
Standard_EXPORT TCollection_AsciiString Name() const;
|
||||
|
||||
//! Returns my extension name.
|
||||
//! This returns an empty string if path contains no file name.
|
||||
Standard_EXPORT TCollection_AsciiString Extension() const;
|
||||
|
||||
//! Sets Node of <me>.
|
||||
Standard_EXPORT void SetNode (const TCollection_AsciiString& aName);
|
||||
|
||||
//! Sets UserName of <me>.
|
||||
Standard_EXPORT void SetUserName (const TCollection_AsciiString& aName);
|
||||
|
||||
//! Sets Password of <me>.
|
||||
Standard_EXPORT void SetPassword (const TCollection_AsciiString& aName);
|
||||
|
||||
//! Sets Disk of <me>.
|
||||
Standard_EXPORT void SetDisk (const TCollection_AsciiString& aName);
|
||||
|
||||
//! Sets Trek of <me>.
|
||||
Standard_EXPORT void SetTrek (const TCollection_AsciiString& aName);
|
||||
|
||||
//! Sets file name of <me>.
|
||||
//! If <me> hasn't been initialized, it returns an empty AsciiString.
|
||||
Standard_EXPORT void SetName (const TCollection_AsciiString& aName);
|
||||
|
||||
//! Sets my extension name.
|
||||
Standard_EXPORT void SetExtension (const TCollection_AsciiString& aName);
|
||||
|
||||
//! Finds the full path of an executable file, like the
|
||||
//! "which" Unix utility. Uses the path environment variable.
|
||||
//! Returns False if executable file not found.
|
||||
Standard_EXPORT Standard_Boolean LocateExecFile (OSD_Path& aPath);
|
||||
|
||||
//! Returns the relative file path between the absolute directory
|
||||
//! path <DirPath> and the absolute file path <AbsFilePath>.
|
||||
//! If <DirPath> starts with "/", pathes are handled as
|
||||
//! on Unix, if it starts with a letter followed by ":", as on
|
||||
//! WNT. In particular on WNT directory names are not key sensitive.
|
||||
//! If handling fails, an empty string is returned.
|
||||
Standard_EXPORT static TCollection_AsciiString RelativePath (const TCollection_AsciiString& DirPath, const TCollection_AsciiString& AbsFilePath);
|
||||
|
||||
//! Returns the absolute file path from the absolute directory path
|
||||
//! <DirPath> and the relative file path returned by RelativePath().
|
||||
//! If the RelFilePath is an absolute path, it is returned and the
|
||||
//! directory path is ignored.
|
||||
//! If handling fails, an empty string is returned.
|
||||
Standard_EXPORT static TCollection_AsciiString AbsolutePath (const TCollection_AsciiString& DirPath, const TCollection_AsciiString& RelFilePath);
|
||||
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
TCollection_AsciiString myNode;
|
||||
TCollection_AsciiString myUserName;
|
||||
TCollection_AsciiString myPassword;
|
||||
TCollection_AsciiString myDisk;
|
||||
TCollection_AsciiString myTrek;
|
||||
TCollection_AsciiString myName;
|
||||
TCollection_AsciiString myExtension;
|
||||
Standard_Boolean myUNCFlag;
|
||||
OSD_SysType mySysDep;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _OSD_Path_HeaderFile
|
@@ -1,66 +0,0 @@
|
||||
-- Created on: 2018-03-15
|
||||
-- Created by: Stephan GARNAUD (ARM)
|
||||
-- Copyright (c) 1998-1999 Matra Datavision
|
||||
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
--
|
||||
-- This file is part of Open CASCADE Technology software library.
|
||||
--
|
||||
-- This library is free software; you can redistribute it and/or modify it under
|
||||
-- the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
-- by the Free Software Foundation, with special exception defined in the file
|
||||
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
-- distribution for complete text of the license and disclaimer of any warranty.
|
||||
--
|
||||
-- Alternatively, this file may be used under the terms of Open CASCADE
|
||||
-- commercial license or contractual agreement.
|
||||
|
||||
class Printer from OSD
|
||||
|
||||
---Purpose: Selects a printer (used by File).
|
||||
|
||||
uses Error, AsciiString from TCollection
|
||||
raises ConstructionError, NullObject, OSDError
|
||||
|
||||
is
|
||||
Create (Name : AsciiString) returns Printer
|
||||
---Purpose: Initializes printer to use with its name.
|
||||
-- The string must contain only ASCII characters
|
||||
-- between ' ' and '~'; this means no control character
|
||||
-- and no extended ASCII code. If it is not the case the
|
||||
-- exception ConstructionError is raised.
|
||||
---Level: Advanced
|
||||
raises ConstructionError;
|
||||
|
||||
SetName (me : in out; Name : AsciiString)
|
||||
---Purpose: Changes name of printer to use.
|
||||
---Level: Advanced
|
||||
raises ConstructionError, NullObject is static;
|
||||
|
||||
Name (me ;Name : out AsciiString) is static;
|
||||
---Purpose: Returns name of current printer
|
||||
---Level: Advanced
|
||||
|
||||
Failed (me) returns Boolean is static;
|
||||
---Purpose: Returns TRUE if an error occurs
|
||||
---Level: Advanced
|
||||
|
||||
Reset (me : in out) is static;
|
||||
---Purpose: Resets error counter to zero
|
||||
---Level: Advanced
|
||||
|
||||
Perror (me : in out)
|
||||
---Level: Advanced
|
||||
---Purpose: Raises OSD_Error
|
||||
raises OSDError is static;
|
||||
|
||||
Error (me) returns Integer is static;
|
||||
---Purpose: Returns error number if 'Failed' is TRUE.
|
||||
---Level: Advanced
|
||||
|
||||
fields
|
||||
|
||||
myName : AsciiString;
|
||||
myError : Error;
|
||||
end Printer from OSD;
|
||||
|
||||
|
@@ -14,14 +14,16 @@
|
||||
|
||||
#ifndef WNT
|
||||
|
||||
#include <Standard_ConstructionError.hxx>
|
||||
#include <OSD_Printer.ixx>
|
||||
#include <OSD_WhoAmI.hxx>
|
||||
|
||||
//const OSD_WhoAmI Iam = OSD_WPrinter;
|
||||
#include <OSD_OSDError.hxx>
|
||||
#include <OSD_Printer.hxx>
|
||||
#include <OSD_WhoAmI.hxx>
|
||||
#include <Standard_ConstructionError.hxx>
|
||||
#include <Standard_NullObject.hxx>
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
//const OSD_WhoAmI Iam = OSD_WPrinter;
|
||||
// -------------------------------------------------------------
|
||||
// -------------------------------------------------------------
|
||||
OSD_Printer::OSD_Printer (const TCollection_AsciiString& Name){
|
||||
@@ -77,7 +79,11 @@ Standard_Integer OSD_Printer::Error()const{
|
||||
//------------------- Windows NT sources for OSD_Printer ----------------
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
#include <OSD_Printer.ixx>
|
||||
#include <OSD_OSDError.hxx>
|
||||
#include <OSD_Printer.hxx>
|
||||
#include <Standard_ConstructionError.hxx>
|
||||
#include <Standard_NullObject.hxx>
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
|
||||
OSD_Printer :: OSD_Printer ( const TCollection_AsciiString& Name ) {
|
||||
|
||||
|
92
src/OSD/OSD_Printer.hxx
Normal file
92
src/OSD/OSD_Printer.hxx
Normal file
@@ -0,0 +1,92 @@
|
||||
// Created on: 2018-03-15
|
||||
// Created by: Stephan GARNAUD (ARM)
|
||||
// Copyright (c) 1998-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _OSD_Printer_HeaderFile
|
||||
#define _OSD_Printer_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
#include <Standard_Handle.hxx>
|
||||
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
#include <OSD_Error.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
class Standard_ConstructionError;
|
||||
class Standard_NullObject;
|
||||
class OSD_OSDError;
|
||||
class TCollection_AsciiString;
|
||||
|
||||
|
||||
//! Selects a printer (used by File).
|
||||
class OSD_Printer
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
//! Initializes printer to use with its name.
|
||||
//! The string must contain only ASCII characters
|
||||
//! between ' ' and '~'; this means no control character
|
||||
//! and no extended ASCII code. If it is not the case the
|
||||
//! exception ConstructionError is raised.
|
||||
Standard_EXPORT OSD_Printer(const TCollection_AsciiString& Name);
|
||||
|
||||
//! Changes name of printer to use.
|
||||
Standard_EXPORT void SetName (const TCollection_AsciiString& Name);
|
||||
|
||||
//! Returns name of current printer
|
||||
Standard_EXPORT void Name (TCollection_AsciiString& Name) const;
|
||||
|
||||
//! Returns TRUE if an error occurs
|
||||
Standard_EXPORT Standard_Boolean Failed() const;
|
||||
|
||||
//! Resets error counter to zero
|
||||
Standard_EXPORT void Reset();
|
||||
|
||||
//! Raises OSD_Error
|
||||
Standard_EXPORT void Perror();
|
||||
|
||||
//! Returns error number if 'Failed' is TRUE.
|
||||
Standard_EXPORT Standard_Integer Error() const;
|
||||
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
TCollection_AsciiString myName;
|
||||
OSD_Error myError;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _OSD_Printer_HeaderFile
|
@@ -1,94 +0,0 @@
|
||||
-- Created on: 2018-03-15
|
||||
-- Created by: Stephan GARNAUD (ARM)
|
||||
-- Copyright (c) 1998-1999 Matra Datavision
|
||||
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
--
|
||||
-- This file is part of Open CASCADE Technology software library.
|
||||
--
|
||||
-- This library is free software; you can redistribute it and/or modify it under
|
||||
-- the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
-- by the Free Software Foundation, with special exception defined in the file
|
||||
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
-- distribution for complete text of the license and disclaimer of any warranty.
|
||||
--
|
||||
-- Alternatively, this file may be used under the terms of Open CASCADE
|
||||
-- commercial license or contractual agreement.
|
||||
|
||||
-- Modified:
|
||||
--- Stephane Routelous ( stephane.routelous@altavista.net ) :
|
||||
-- add ShowWindow flag to allow show/hide of the window ( only used on WNT )
|
||||
|
||||
|
||||
class Process from OSD
|
||||
|
||||
---Purpose: A set of system process tools
|
||||
|
||||
uses Date from Quantity, Error, Path, File, AsciiString from TCollection
|
||||
raises OSDError
|
||||
|
||||
is
|
||||
|
||||
Create returns Process;
|
||||
---Purpose: Initializes the object and prepare for a possible dump
|
||||
---Level: Advanced
|
||||
|
||||
Spawn (me : in out; cmd : AsciiString; ShowWindow : Boolean from Standard = Standard_True) is static;
|
||||
---Purpose: Issues a shell command
|
||||
--- ShowWindow : flag to allow show/hide of the window ( only used on WNT )
|
||||
---Level: Advanced
|
||||
|
||||
TerminalType (me : in out; Name : out AsciiString) is static;
|
||||
---Purpose: Returns the terminal used (vt100, vt200 ,sun-cmd ...)
|
||||
---Level: Advanced
|
||||
|
||||
SystemDate (me : out) returns Date is static;
|
||||
---Purpose: Gets system date.
|
||||
---Level: Advanced
|
||||
|
||||
UserId (me : in out) returns Integer is static;
|
||||
---Purpose: Returns the 'User Id'.
|
||||
---Level: Advanced
|
||||
|
||||
UserName (me : in out) returns AsciiString is static;
|
||||
---Purpose: Returns the user name.
|
||||
---Level: Advanced
|
||||
|
||||
IsSuperUser (me: in out) returns Boolean is static;
|
||||
---Purpose: Returns True if the process user is the super-user.
|
||||
---Level: Advanced
|
||||
|
||||
ProcessId ( me : in out ) returns Integer is static;
|
||||
---Purpose: Returns the 'Process Id'
|
||||
---Level: Advanced
|
||||
|
||||
CurrentDirectory (me : in out) returns Path is static;
|
||||
---Purpose: Returns the current path where the process is.
|
||||
---Level: Advanced
|
||||
|
||||
SetCurrentDirectory (me : in out; where : Path) is static;
|
||||
---Purpose: Changes the current process directory.
|
||||
---Level: Advanced
|
||||
|
||||
Failed (me) returns Boolean is static;
|
||||
---Purpose: Returns TRUE if an error occurs
|
||||
---Level: Advanced
|
||||
|
||||
Reset (me : in out) is static;
|
||||
---Purpose: Resets error counter to zero
|
||||
---Level: Advanced
|
||||
|
||||
Perror (me : in out)
|
||||
---Purpose: Raises OSD_Error
|
||||
---Level: Advanced
|
||||
raises OSDError is static;
|
||||
|
||||
Error (me) returns Integer is static;
|
||||
---Purpose: Returns error number if 'Failed' is TRUE.
|
||||
---Level: Advanced
|
||||
|
||||
fields
|
||||
|
||||
myError : Error;
|
||||
end Process from OSD;
|
||||
|
||||
|
@@ -14,9 +14,14 @@
|
||||
|
||||
#ifndef WNT
|
||||
|
||||
#include <OSD_Process.ixx>
|
||||
#include <OSD_WhoAmI.hxx>
|
||||
|
||||
#include <OSD_Environment.hxx>
|
||||
#include <OSD_OSDError.hxx>
|
||||
#include <OSD_Path.hxx>
|
||||
#include <OSD_Process.hxx>
|
||||
#include <OSD_WhoAmI.hxx>
|
||||
#include <Quantity_Date.hxx>
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
|
||||
const OSD_WhoAmI Iam = OSD_WProcess;
|
||||
|
||||
|
108
src/OSD/OSD_Process.hxx
Normal file
108
src/OSD/OSD_Process.hxx
Normal file
@@ -0,0 +1,108 @@
|
||||
// Created on: 2018-03-15
|
||||
// Created by: Stephan GARNAUD (ARM)
|
||||
// Copyright (c) 1998-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _OSD_Process_HeaderFile
|
||||
#define _OSD_Process_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
#include <Standard_Handle.hxx>
|
||||
|
||||
#include <OSD_Error.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
class OSD_OSDError;
|
||||
class TCollection_AsciiString;
|
||||
class Quantity_Date;
|
||||
class OSD_Path;
|
||||
|
||||
|
||||
//! A set of system process tools
|
||||
class OSD_Process
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
//! Initializes the object and prepare for a possible dump
|
||||
Standard_EXPORT OSD_Process();
|
||||
|
||||
//! Issues a shell command
|
||||
//! ShowWindow : flag to allow show/hide of the window ( only used on WNT )
|
||||
Standard_EXPORT void Spawn (const TCollection_AsciiString& cmd, const Standard_Boolean ShowWindow = Standard_True);
|
||||
|
||||
//! Returns the terminal used (vt100, vt200 ,sun-cmd ...)
|
||||
Standard_EXPORT void TerminalType (TCollection_AsciiString& Name);
|
||||
|
||||
//! Gets system date.
|
||||
Standard_EXPORT Quantity_Date SystemDate();
|
||||
|
||||
//! Returns the 'User Id'.
|
||||
Standard_EXPORT Standard_Integer UserId();
|
||||
|
||||
//! Returns the user name.
|
||||
Standard_EXPORT TCollection_AsciiString UserName();
|
||||
|
||||
//! Returns True if the process user is the super-user.
|
||||
Standard_EXPORT Standard_Boolean IsSuperUser();
|
||||
|
||||
//! Returns the 'Process Id'
|
||||
Standard_EXPORT Standard_Integer ProcessId();
|
||||
|
||||
//! Returns the current path where the process is.
|
||||
Standard_EXPORT OSD_Path CurrentDirectory();
|
||||
|
||||
//! Changes the current process directory.
|
||||
Standard_EXPORT void SetCurrentDirectory (const OSD_Path& where);
|
||||
|
||||
//! Returns TRUE if an error occurs
|
||||
Standard_EXPORT Standard_Boolean Failed() const;
|
||||
|
||||
//! Resets error counter to zero
|
||||
Standard_EXPORT void Reset();
|
||||
|
||||
//! Raises OSD_Error
|
||||
Standard_EXPORT void Perror();
|
||||
|
||||
//! Returns error number if 'Failed' is TRUE.
|
||||
Standard_EXPORT Standard_Integer Error() const;
|
||||
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
OSD_Error myError;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _OSD_Process_HeaderFile
|
@@ -1,131 +0,0 @@
|
||||
-- Created on: 2018-03-15
|
||||
-- Created by: Stephan GARNAUD (ARM)
|
||||
-- Copyright (c) 1998-1999 Matra Datavision
|
||||
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
--
|
||||
-- This file is part of Open CASCADE Technology software library.
|
||||
--
|
||||
-- This library is free software; you can redistribute it and/or modify it under
|
||||
-- the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
-- by the Free Software Foundation, with special exception defined in the file
|
||||
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
-- distribution for complete text of the license and disclaimer of any warranty.
|
||||
--
|
||||
-- Alternatively, this file may be used under the terms of Open CASCADE
|
||||
-- commercial license or contractual agreement.
|
||||
|
||||
class Protection from OSD
|
||||
|
||||
---Purpose: This class provides data to manage file protection
|
||||
-- Example:These rights are treated in a system dependent manner :
|
||||
-- On UNIX you have User,Group and Other rights
|
||||
-- On VMS you have Owner,Group,World and System rights
|
||||
-- An automatic conversion is done between OSD and UNIX/VMS.
|
||||
--
|
||||
-- OSD VMS UNIX
|
||||
-- User Owner User
|
||||
-- Group Group Group
|
||||
-- World World Other
|
||||
-- System System (combined with Other)
|
||||
--
|
||||
-- When you use System protection on UNIX you must know that
|
||||
-- Other rights and System rights are inclusively "ORed".
|
||||
-- So Other with only READ access and System with WRITE access
|
||||
-- will produce on UNIX Other with READ and WRITE access.
|
||||
--
|
||||
-- This choice comes from the fact that ROOT can't be considered
|
||||
-- as member of the group nor as user. So it is considered as Other.
|
||||
|
||||
|
||||
uses SingleProtection, AsciiString from TCollection
|
||||
|
||||
|
||||
is
|
||||
Create returns Protection;
|
||||
---Purpose: Initializes global access rights as follows
|
||||
--
|
||||
-- User : Read Write
|
||||
-- System : Read Write
|
||||
-- Group : Read
|
||||
-- World : Read
|
||||
---Level: Public
|
||||
|
||||
Create (System ,
|
||||
User , Group , World : SingleProtection) returns Protection;
|
||||
---Purpose: Sets values of fields
|
||||
---Level: Public
|
||||
|
||||
Values (me : in out;
|
||||
System , User , Group , World : out SingleProtection) is static;
|
||||
---Purpose: Retrieves values of fields
|
||||
---Level: Public
|
||||
|
||||
SetValues (me : in out;
|
||||
System , User , Group , World : SingleProtection) is static;
|
||||
---Purpose: Sets values of fields
|
||||
---Level: Public
|
||||
|
||||
SetSystem(me : in out; priv : SingleProtection) is static;
|
||||
---Purpose: Sets protection of 'System'
|
||||
---Level: Public
|
||||
|
||||
SetUser(me : in out; priv : SingleProtection) is static;
|
||||
---Purpose: Sets protection of 'User'
|
||||
---Level: Public
|
||||
|
||||
SetGroup(me : in out; priv : SingleProtection) is static;
|
||||
---Purpose: Sets protection of 'Group'
|
||||
---Level: Public
|
||||
|
||||
SetWorld(me : in out; priv : SingleProtection) is static;
|
||||
---Purpose: Sets protection of 'World'
|
||||
---Level: Public
|
||||
|
||||
System(me ) returns SingleProtection is static;
|
||||
---Purpose: Gets protection of 'System'
|
||||
---Level: Public
|
||||
|
||||
User(me ) returns SingleProtection is static;
|
||||
---Purpose: Gets protection of 'User'
|
||||
---Level: Public
|
||||
|
||||
Group(me ) returns SingleProtection is static;
|
||||
---Purpose: Gets protection of 'Group'
|
||||
---Level: Public
|
||||
|
||||
World(me ) returns SingleProtection is static;
|
||||
---Purpose: Gets protection of 'World'
|
||||
---Level: Public
|
||||
|
||||
Internal (me) returns Integer is static private;
|
||||
---Purpose: Returns System dependent access rights
|
||||
-- this is a private method.
|
||||
---Level: Public
|
||||
|
||||
Add (me : in out ;
|
||||
aProt : in out SingleProtection ;aRight : SingleProtection) is static;
|
||||
---Purpose: Add a right to a single protection.
|
||||
-- ex: aProt = RWD
|
||||
-- me.Add(aProt,X) -> aProt = RWXD
|
||||
---Level: Public
|
||||
|
||||
Sub (me : in out ;
|
||||
aProt : in out SingleProtection ;aRight : SingleProtection) is static;
|
||||
---Purpose: Subtract a right to a single protection.
|
||||
-- ex: aProt = RWD
|
||||
-- me.Sub(aProt,RW) -> aProt = D
|
||||
-- But me.Sub(aProt,RWX) is also valid and gives same result.
|
||||
---Level: Public
|
||||
|
||||
|
||||
fields
|
||||
s : SingleProtection; -- System right
|
||||
u : SingleProtection; -- User right
|
||||
g : SingleProtection; -- Group right
|
||||
w : SingleProtection; -- World right
|
||||
|
||||
friends class FileNode, class File, class Directory
|
||||
|
||||
end Protection from OSD;
|
||||
|
||||
|
@@ -14,8 +14,12 @@
|
||||
|
||||
#ifndef WNT
|
||||
|
||||
|
||||
#include <OSD_Directory.hxx>
|
||||
#include <OSD_File.hxx>
|
||||
#include <OSD_FileNode.hxx>
|
||||
#include <OSD_Protection.hxx>
|
||||
#include <OSD_WhoAmI.hxx>
|
||||
#include <OSD_Protection.ixx>
|
||||
|
||||
#include <sys/stat.h>
|
||||
// Ci-joint le tableau de gestion des protection (Ajout et Retrait). Les
|
||||
|
143
src/OSD/OSD_Protection.hxx
Normal file
143
src/OSD/OSD_Protection.hxx
Normal file
@@ -0,0 +1,143 @@
|
||||
// Created on: 2018-03-15
|
||||
// Created by: Stephan GARNAUD (ARM)
|
||||
// Copyright (c) 1998-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _OSD_Protection_HeaderFile
|
||||
#define _OSD_Protection_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
#include <Standard_Handle.hxx>
|
||||
|
||||
#include <OSD_SingleProtection.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
class OSD_FileNode;
|
||||
class OSD_File;
|
||||
class OSD_Directory;
|
||||
|
||||
|
||||
//! This class provides data to manage file protection
|
||||
//! Example:These rights are treated in a system dependent manner :
|
||||
//! On UNIX you have User,Group and Other rights
|
||||
//! On VMS you have Owner,Group,World and System rights
|
||||
//! An automatic conversion is done between OSD and UNIX/VMS.
|
||||
//!
|
||||
//! OSD VMS UNIX
|
||||
//! User Owner User
|
||||
//! Group Group Group
|
||||
//! World World Other
|
||||
//! System System (combined with Other)
|
||||
//!
|
||||
//! When you use System protection on UNIX you must know that
|
||||
//! Other rights and System rights are inclusively "ORed".
|
||||
//! So Other with only READ access and System with WRITE access
|
||||
//! will produce on UNIX Other with READ and WRITE access.
|
||||
//!
|
||||
//! This choice comes from the fact that ROOT can't be considered
|
||||
//! as member of the group nor as user. So it is considered as Other.
|
||||
class OSD_Protection
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
//! Initializes global access rights as follows
|
||||
//!
|
||||
//! User : Read Write
|
||||
//! System : Read Write
|
||||
//! Group : Read
|
||||
//! World : Read
|
||||
Standard_EXPORT OSD_Protection();
|
||||
|
||||
//! Sets values of fields
|
||||
Standard_EXPORT OSD_Protection(const OSD_SingleProtection System, const OSD_SingleProtection User, const OSD_SingleProtection Group, const OSD_SingleProtection World);
|
||||
|
||||
//! Retrieves values of fields
|
||||
Standard_EXPORT void Values (OSD_SingleProtection& System, OSD_SingleProtection& User, OSD_SingleProtection& Group, OSD_SingleProtection& World);
|
||||
|
||||
//! Sets values of fields
|
||||
Standard_EXPORT void SetValues (const OSD_SingleProtection System, const OSD_SingleProtection User, const OSD_SingleProtection Group, const OSD_SingleProtection World);
|
||||
|
||||
//! Sets protection of 'System'
|
||||
Standard_EXPORT void SetSystem (const OSD_SingleProtection priv);
|
||||
|
||||
//! Sets protection of 'User'
|
||||
Standard_EXPORT void SetUser (const OSD_SingleProtection priv);
|
||||
|
||||
//! Sets protection of 'Group'
|
||||
Standard_EXPORT void SetGroup (const OSD_SingleProtection priv);
|
||||
|
||||
//! Sets protection of 'World'
|
||||
Standard_EXPORT void SetWorld (const OSD_SingleProtection priv);
|
||||
|
||||
//! Gets protection of 'System'
|
||||
Standard_EXPORT OSD_SingleProtection System() const;
|
||||
|
||||
//! Gets protection of 'User'
|
||||
Standard_EXPORT OSD_SingleProtection User() const;
|
||||
|
||||
//! Gets protection of 'Group'
|
||||
Standard_EXPORT OSD_SingleProtection Group() const;
|
||||
|
||||
//! Gets protection of 'World'
|
||||
Standard_EXPORT OSD_SingleProtection World() const;
|
||||
|
||||
//! Add a right to a single protection.
|
||||
//! ex: aProt = RWD
|
||||
//! me.Add(aProt,X) -> aProt = RWXD
|
||||
Standard_EXPORT void Add (OSD_SingleProtection& aProt, const OSD_SingleProtection aRight);
|
||||
|
||||
//! Subtract a right to a single protection.
|
||||
//! ex: aProt = RWD
|
||||
//! me.Sub(aProt,RW) -> aProt = D
|
||||
//! But me.Sub(aProt,RWX) is also valid and gives same result.
|
||||
Standard_EXPORT void Sub (OSD_SingleProtection& aProt, const OSD_SingleProtection aRight);
|
||||
|
||||
|
||||
friend class OSD_FileNode;
|
||||
friend class OSD_File;
|
||||
friend class OSD_Directory;
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
//! Returns System dependent access rights
|
||||
//! this is a private method.
|
||||
Standard_EXPORT Standard_Integer Internal() const;
|
||||
|
||||
|
||||
OSD_SingleProtection s;
|
||||
OSD_SingleProtection u;
|
||||
OSD_SingleProtection g;
|
||||
OSD_SingleProtection w;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _OSD_Protection_HeaderFile
|
35
src/OSD/OSD_SIGBUS.hxx
Normal file
35
src/OSD/OSD_SIGBUS.hxx
Normal file
@@ -0,0 +1,35 @@
|
||||
// Copyright (c) 1992-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _OSD_SIGBUS_HeaderFile
|
||||
#define _OSD_SIGBUS_HeaderFile
|
||||
|
||||
#include <Standard_Type.hxx>
|
||||
#include <Standard_DefineException.hxx>
|
||||
#include <Standard_SStream.hxx>
|
||||
#include <OSD_Signal.hxx>
|
||||
|
||||
class OSD_SIGBUS;
|
||||
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);
|
||||
#else
|
||||
#define OSD_SIGBUS_Raise_if(CONDITION, MESSAGE)
|
||||
#endif
|
||||
|
||||
DEFINE_STANDARD_EXCEPTION(OSD_SIGBUS, OSD_Signal)
|
||||
|
||||
#endif // _OSD_SIGBUS_HeaderFile
|
35
src/OSD/OSD_SIGHUP.hxx
Normal file
35
src/OSD/OSD_SIGHUP.hxx
Normal file
@@ -0,0 +1,35 @@
|
||||
// Copyright (c) 1992-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _OSD_SIGHUP_HeaderFile
|
||||
#define _OSD_SIGHUP_HeaderFile
|
||||
|
||||
#include <Standard_Type.hxx>
|
||||
#include <Standard_DefineException.hxx>
|
||||
#include <Standard_SStream.hxx>
|
||||
#include <OSD_Signal.hxx>
|
||||
|
||||
class OSD_SIGHUP;
|
||||
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);
|
||||
#else
|
||||
#define OSD_SIGHUP_Raise_if(CONDITION, MESSAGE)
|
||||
#endif
|
||||
|
||||
DEFINE_STANDARD_EXCEPTION(OSD_SIGHUP, OSD_Signal)
|
||||
|
||||
#endif // _OSD_SIGHUP_HeaderFile
|
35
src/OSD/OSD_SIGILL.hxx
Normal file
35
src/OSD/OSD_SIGILL.hxx
Normal file
@@ -0,0 +1,35 @@
|
||||
// Copyright (c) 1992-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _OSD_SIGILL_HeaderFile
|
||||
#define _OSD_SIGILL_HeaderFile
|
||||
|
||||
#include <Standard_Type.hxx>
|
||||
#include <Standard_DefineException.hxx>
|
||||
#include <Standard_SStream.hxx>
|
||||
#include <OSD_Signal.hxx>
|
||||
|
||||
class OSD_SIGILL;
|
||||
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);
|
||||
#else
|
||||
#define OSD_SIGILL_Raise_if(CONDITION, MESSAGE)
|
||||
#endif
|
||||
|
||||
DEFINE_STANDARD_EXCEPTION(OSD_SIGILL, OSD_Signal)
|
||||
|
||||
#endif // _OSD_SIGILL_HeaderFile
|
35
src/OSD/OSD_SIGINT.hxx
Normal file
35
src/OSD/OSD_SIGINT.hxx
Normal file
@@ -0,0 +1,35 @@
|
||||
// Copyright (c) 1992-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _OSD_SIGINT_HeaderFile
|
||||
#define _OSD_SIGINT_HeaderFile
|
||||
|
||||
#include <Standard_Type.hxx>
|
||||
#include <Standard_DefineException.hxx>
|
||||
#include <Standard_SStream.hxx>
|
||||
#include <OSD_Signal.hxx>
|
||||
|
||||
class OSD_SIGINT;
|
||||
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);
|
||||
#else
|
||||
#define OSD_SIGINT_Raise_if(CONDITION, MESSAGE)
|
||||
#endif
|
||||
|
||||
DEFINE_STANDARD_EXCEPTION(OSD_SIGINT, OSD_Signal)
|
||||
|
||||
#endif // _OSD_SIGINT_HeaderFile
|
35
src/OSD/OSD_SIGKILL.hxx
Normal file
35
src/OSD/OSD_SIGKILL.hxx
Normal file
@@ -0,0 +1,35 @@
|
||||
// Copyright (c) 1992-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _OSD_SIGKILL_HeaderFile
|
||||
#define _OSD_SIGKILL_HeaderFile
|
||||
|
||||
#include <Standard_Type.hxx>
|
||||
#include <Standard_DefineException.hxx>
|
||||
#include <Standard_SStream.hxx>
|
||||
#include <OSD_Signal.hxx>
|
||||
|
||||
class OSD_SIGKILL;
|
||||
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);
|
||||
#else
|
||||
#define OSD_SIGKILL_Raise_if(CONDITION, MESSAGE)
|
||||
#endif
|
||||
|
||||
DEFINE_STANDARD_EXCEPTION(OSD_SIGKILL, OSD_Signal)
|
||||
|
||||
#endif // _OSD_SIGKILL_HeaderFile
|
35
src/OSD/OSD_SIGQUIT.hxx
Normal file
35
src/OSD/OSD_SIGQUIT.hxx
Normal file
@@ -0,0 +1,35 @@
|
||||
// Copyright (c) 1992-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _OSD_SIGQUIT_HeaderFile
|
||||
#define _OSD_SIGQUIT_HeaderFile
|
||||
|
||||
#include <Standard_Type.hxx>
|
||||
#include <Standard_DefineException.hxx>
|
||||
#include <Standard_SStream.hxx>
|
||||
#include <OSD_Signal.hxx>
|
||||
|
||||
class OSD_SIGQUIT;
|
||||
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);
|
||||
#else
|
||||
#define OSD_SIGQUIT_Raise_if(CONDITION, MESSAGE)
|
||||
#endif
|
||||
|
||||
DEFINE_STANDARD_EXCEPTION(OSD_SIGQUIT, OSD_Signal)
|
||||
|
||||
#endif // _OSD_SIGQUIT_HeaderFile
|
35
src/OSD/OSD_SIGSEGV.hxx
Normal file
35
src/OSD/OSD_SIGSEGV.hxx
Normal file
@@ -0,0 +1,35 @@
|
||||
// Copyright (c) 1992-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _OSD_SIGSEGV_HeaderFile
|
||||
#define _OSD_SIGSEGV_HeaderFile
|
||||
|
||||
#include <Standard_Type.hxx>
|
||||
#include <Standard_DefineException.hxx>
|
||||
#include <Standard_SStream.hxx>
|
||||
#include <OSD_Signal.hxx>
|
||||
|
||||
class OSD_SIGSEGV;
|
||||
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);
|
||||
#else
|
||||
#define OSD_SIGSEGV_Raise_if(CONDITION, MESSAGE)
|
||||
#endif
|
||||
|
||||
DEFINE_STANDARD_EXCEPTION(OSD_SIGSEGV, OSD_Signal)
|
||||
|
||||
#endif // _OSD_SIGSEGV_HeaderFile
|
35
src/OSD/OSD_SIGSYS.hxx
Normal file
35
src/OSD/OSD_SIGSYS.hxx
Normal file
@@ -0,0 +1,35 @@
|
||||
// Copyright (c) 1992-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _OSD_SIGSYS_HeaderFile
|
||||
#define _OSD_SIGSYS_HeaderFile
|
||||
|
||||
#include <Standard_Type.hxx>
|
||||
#include <Standard_DefineException.hxx>
|
||||
#include <Standard_SStream.hxx>
|
||||
#include <OSD_Signal.hxx>
|
||||
|
||||
class OSD_SIGSYS;
|
||||
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);
|
||||
#else
|
||||
#define OSD_SIGSYS_Raise_if(CONDITION, MESSAGE)
|
||||
#endif
|
||||
|
||||
DEFINE_STANDARD_EXCEPTION(OSD_SIGSYS, OSD_Signal)
|
||||
|
||||
#endif // _OSD_SIGSYS_HeaderFile
|
@@ -1,114 +0,0 @@
|
||||
-- Created on: 1994-08-30
|
||||
-- Created by: J.P. TIRAULT
|
||||
-- Copyright (c) 1994-1999 Matra Datavision
|
||||
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
--
|
||||
-- This file is part of Open CASCADE Technology software library.
|
||||
--
|
||||
-- This library is free software; you can redistribute it and/or modify it under
|
||||
-- the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
-- by the Free Software Foundation, with special exception defined in the file
|
||||
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
-- distribution for complete text of the license and disclaimer of any warranty.
|
||||
--
|
||||
-- Alternatively, this file may be used under the terms of Open CASCADE
|
||||
-- commercial license or contractual agreement.
|
||||
|
||||
-- SharedLibrary: OSD_SharedLibrary.cdl
|
||||
|
||||
class SharedLibrary from OSD
|
||||
|
||||
---Purpose: Interface to dynamic library loader.
|
||||
-- Provides tools to load a shared library
|
||||
-- and retrieve the address of an entry point.
|
||||
uses LoadMode,Function
|
||||
is
|
||||
|
||||
Create returns SharedLibrary;
|
||||
---Purpose: Creates a SharedLibrary object with name NULL.
|
||||
---Level: Public
|
||||
|
||||
Create (aFilename : CString) returns SharedLibrary;
|
||||
---Purpose: Creates a SharedLibrary object with name aFilename.
|
||||
---Level: Public
|
||||
|
||||
SetName (me : out ; aName : CString)
|
||||
---Purpose: Sets a name associated to the shared object.
|
||||
---Level: Public
|
||||
is static;
|
||||
|
||||
Name (me)
|
||||
---Purpose: Returns the name associated to the shared object.
|
||||
---Level: Public
|
||||
returns CString
|
||||
is static;
|
||||
|
||||
DlOpen (me : out ; Mode : LoadMode)
|
||||
---Purpose: The DlOpen method provides an interface to the
|
||||
-- dynamic library loader to allow shared libraries
|
||||
-- to be loaded and called at runtime. The DlOpen
|
||||
-- function attempts to load Filename, in the address
|
||||
-- space of the process, resolving symbols as appropriate.
|
||||
-- Any libraries that Filename depends upon are also loaded.
|
||||
-- If MODE is RTLD_LAZY, then the runtime loader
|
||||
-- does symbol resolution only as needed.
|
||||
-- Typically, this means that the first call to a function
|
||||
-- in the newly loaded library will cause the resolution of
|
||||
-- the address of that function to occur.
|
||||
-- If Mode is RTLD_NOW, then the runtime loader must do all
|
||||
-- symbol binding during the DlOpen call.
|
||||
-- The DlOpen method returns a handle that is used by DlSym
|
||||
-- or DlClose.
|
||||
-- If there is an error, Standard_False is returned,
|
||||
-- Standard_True otherwise.
|
||||
-- If a NULL Filename is specified, DlOpen returns a handle
|
||||
-- for the main executable, which allows access to dynamic
|
||||
-- symbols in the running program.
|
||||
---Level: Public
|
||||
|
||||
returns Boolean
|
||||
is static;
|
||||
|
||||
DlSymb (me; Name : CString)
|
||||
---Purpose: The dlsym function returns the address of the
|
||||
-- symbol name found in the shared library.
|
||||
-- If the symbol is not found, a NULL pointer is
|
||||
-- returned.
|
||||
---Level: Public
|
||||
|
||||
returns Function
|
||||
is static;
|
||||
|
||||
DlClose (me)
|
||||
---Purpose: Deallocates the address space for the library
|
||||
-- corresponding to the shared object.
|
||||
-- If any user function continues to call a symbol
|
||||
-- resolved in the address space of a library
|
||||
-- that has been since been deallocated by DlClose,
|
||||
-- the results are undefined.
|
||||
---Level: Public
|
||||
is static;
|
||||
|
||||
DlError (me)
|
||||
---Purpose: The dlerror function returns a string describing
|
||||
-- the last error that occurred from
|
||||
-- a call to DlOpen, DlClose or DlSym.
|
||||
---Level: Public
|
||||
returns CString
|
||||
is static;
|
||||
|
||||
Destroy (me : in out)
|
||||
---Level: Public
|
||||
---Purpose: Frees memory allocated.
|
||||
---C++: alias ~
|
||||
is static;
|
||||
|
||||
|
||||
fields
|
||||
|
||||
myHandle : Address;
|
||||
myName : PCharacter;
|
||||
|
||||
end SharedLibrary from OSD;
|
||||
|
||||
|
@@ -14,12 +14,12 @@
|
||||
|
||||
#ifndef WNT
|
||||
|
||||
#include <OSD_LoadMode.hxx>
|
||||
#include <OSD_SharedLibrary.ixx>
|
||||
|
||||
#include <OSD_Function.hxx>
|
||||
#include <OSD_LoadMode.hxx>
|
||||
#include <OSD_SharedLibrary.hxx>
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef __some_crappy_system__
|
||||
/*
|
||||
* Values for 'mode' argument in dlopen().
|
||||
@@ -187,13 +187,11 @@ void OSD_SharedLibrary::Destroy() {
|
||||
#endif
|
||||
#include <windows.h>
|
||||
|
||||
#include <OSD_SharedLibrary.ixx>
|
||||
|
||||
#include <OSD_Path.hxx>
|
||||
|
||||
#include <OSD_SharedLibrary.hxx>
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
|
||||
|
||||
static DWORD lastDLLError;
|
||||
static Standard_Character errMsg[ 1024 ];
|
||||
|
||||
|
127
src/OSD/OSD_SharedLibrary.hxx
Normal file
127
src/OSD/OSD_SharedLibrary.hxx
Normal file
@@ -0,0 +1,127 @@
|
||||
// Created on: 1994-08-30
|
||||
// Created by: J.P. TIRAULT
|
||||
// Copyright (c) 1994-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _OSD_SharedLibrary_HeaderFile
|
||||
#define _OSD_SharedLibrary_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
#include <Standard_Handle.hxx>
|
||||
|
||||
#include <Standard_Address.hxx>
|
||||
#include <Standard_PCharacter.hxx>
|
||||
#include <Standard_CString.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <OSD_LoadMode.hxx>
|
||||
#include <OSD_Function.hxx>
|
||||
|
||||
|
||||
//! Interface to dynamic library loader.
|
||||
//! Provides tools to load a shared library
|
||||
//! and retrieve the address of an entry point.
|
||||
class OSD_SharedLibrary
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
//! Creates a SharedLibrary object with name NULL.
|
||||
Standard_EXPORT OSD_SharedLibrary();
|
||||
|
||||
//! Creates a SharedLibrary object with name aFilename.
|
||||
Standard_EXPORT OSD_SharedLibrary(const Standard_CString aFilename);
|
||||
|
||||
//! Sets a name associated to the shared object.
|
||||
Standard_EXPORT void SetName (const Standard_CString aName);
|
||||
|
||||
//! Returns the name associated to the shared object.
|
||||
Standard_EXPORT Standard_CString Name() const;
|
||||
|
||||
//! The DlOpen method provides an interface to the
|
||||
//! dynamic library loader to allow shared libraries
|
||||
//! to be loaded and called at runtime. The DlOpen
|
||||
//! function attempts to load Filename, in the address
|
||||
//! space of the process, resolving symbols as appropriate.
|
||||
//! Any libraries that Filename depends upon are also loaded.
|
||||
//! If MODE is RTLD_LAZY, then the runtime loader
|
||||
//! does symbol resolution only as needed.
|
||||
//! Typically, this means that the first call to a function
|
||||
//! in the newly loaded library will cause the resolution of
|
||||
//! the address of that function to occur.
|
||||
//! If Mode is RTLD_NOW, then the runtime loader must do all
|
||||
//! symbol binding during the DlOpen call.
|
||||
//! The DlOpen method returns a handle that is used by DlSym
|
||||
//! or DlClose.
|
||||
//! If there is an error, Standard_False is returned,
|
||||
//! Standard_True otherwise.
|
||||
//! If a NULL Filename is specified, DlOpen returns a handle
|
||||
//! for the main executable, which allows access to dynamic
|
||||
//! symbols in the running program.
|
||||
Standard_EXPORT Standard_Boolean DlOpen (const OSD_LoadMode Mode);
|
||||
|
||||
//! The dlsym function returns the address of the
|
||||
//! symbol name found in the shared library.
|
||||
//! If the symbol is not found, a NULL pointer is
|
||||
//! returned.
|
||||
Standard_EXPORT OSD_Function DlSymb (const Standard_CString Name) const;
|
||||
|
||||
//! Deallocates the address space for the library
|
||||
//! corresponding to the shared object.
|
||||
//! If any user function continues to call a symbol
|
||||
//! resolved in the address space of a library
|
||||
//! that has been since been deallocated by DlClose,
|
||||
//! the results are undefined.
|
||||
Standard_EXPORT void DlClose() const;
|
||||
|
||||
//! The dlerror function returns a string describing
|
||||
//! the last error that occurred from
|
||||
//! a call to DlOpen, DlClose or DlSym.
|
||||
Standard_EXPORT Standard_CString DlError() const;
|
||||
|
||||
//! Frees memory allocated.
|
||||
Standard_EXPORT void Destroy();
|
||||
~OSD_SharedLibrary()
|
||||
{
|
||||
Destroy();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
Standard_Address myHandle;
|
||||
Standard_PCharacter myName;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _OSD_SharedLibrary_HeaderFile
|
35
src/OSD/OSD_Signal.hxx
Normal file
35
src/OSD/OSD_Signal.hxx
Normal file
@@ -0,0 +1,35 @@
|
||||
// Copyright (c) 1992-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _OSD_Signal_HeaderFile
|
||||
#define _OSD_Signal_HeaderFile
|
||||
|
||||
#include <Standard_Type.hxx>
|
||||
#include <Standard_DefineException.hxx>
|
||||
#include <Standard_SStream.hxx>
|
||||
#include <Standard_Failure.hxx>
|
||||
|
||||
class OSD_Signal;
|
||||
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);
|
||||
#else
|
||||
#define OSD_Signal_Raise_if(CONDITION, MESSAGE)
|
||||
#endif
|
||||
|
||||
DEFINE_STANDARD_EXCEPTION(OSD_Signal, Standard_Failure)
|
||||
|
||||
#endif // _OSD_Signal_HeaderFile
|
43
src/OSD/OSD_SingleProtection.hxx
Normal file
43
src/OSD/OSD_SingleProtection.hxx
Normal file
@@ -0,0 +1,43 @@
|
||||
// Copyright (c) 1992-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _OSD_SingleProtection_HeaderFile
|
||||
#define _OSD_SingleProtection_HeaderFile
|
||||
|
||||
//! Access rights for files.
|
||||
//! R means Read, W means Write, X means eXecute and D means Delete.
|
||||
//! On UNIX, the right to Delete is combined with Write access.
|
||||
//! So if "W"rite is not set and "D"elete is, "W"rite will be set
|
||||
//! and if "W" is set, "D" will be too.
|
||||
enum OSD_SingleProtection
|
||||
{
|
||||
OSD_None,
|
||||
OSD_R,
|
||||
OSD_W,
|
||||
OSD_RW,
|
||||
OSD_X,
|
||||
OSD_RX,
|
||||
OSD_WX,
|
||||
OSD_RWX,
|
||||
OSD_D,
|
||||
OSD_RD,
|
||||
OSD_WD,
|
||||
OSD_RWD,
|
||||
OSD_XD,
|
||||
OSD_RXD,
|
||||
OSD_WXD,
|
||||
OSD_RWXD
|
||||
};
|
||||
|
||||
#endif // _OSD_SingleProtection_HeaderFile
|
41
src/OSD/OSD_SysType.hxx
Normal file
41
src/OSD/OSD_SysType.hxx
Normal file
@@ -0,0 +1,41 @@
|
||||
// Copyright (c) 1992-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _OSD_SysType_HeaderFile
|
||||
#define _OSD_SysType_HeaderFile
|
||||
|
||||
//! Thisd is a set of possible system types.
|
||||
//! 'Default' means SysType of machine operating this process.
|
||||
//! This can be used with the Path class.
|
||||
//! All UNIX-like are grouped under "UnixBSD" or "UnixSystemV".
|
||||
//! Such systems are Solaris, NexTOS ...
|
||||
//! A category of systems accept MSDOS-like path such as
|
||||
//! WindowsNT and OS2.
|
||||
enum OSD_SysType
|
||||
{
|
||||
OSD_Unknown,
|
||||
OSD_Default,
|
||||
OSD_UnixBSD,
|
||||
OSD_UnixSystemV,
|
||||
OSD_VMS,
|
||||
OSD_OS2,
|
||||
OSD_OSF,
|
||||
OSD_MacOs,
|
||||
OSD_Taligent,
|
||||
OSD_WindowsNT,
|
||||
OSD_LinuxREDHAT,
|
||||
OSD_Aix
|
||||
};
|
||||
|
||||
#endif // _OSD_SysType_HeaderFile
|
@@ -1,108 +0,0 @@
|
||||
-- Created on: 2006-03-10
|
||||
-- Created by: data exchange team
|
||||
-- Copyright (c) 2006-2014 OPEN CASCADE SAS
|
||||
--
|
||||
-- This file is part of Open CASCADE Technology software library.
|
||||
--
|
||||
-- This library is free software; you can redistribute it and/or modify it under
|
||||
-- the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
-- by the Free Software Foundation, with special exception defined in the file
|
||||
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
-- distribution for complete text of the license and disclaimer of any warranty.
|
||||
--
|
||||
-- Alternatively, this file may be used under the terms of Open CASCADE
|
||||
-- commercial license or contractual agreement.
|
||||
|
||||
class Thread from OSD
|
||||
|
||||
---Purpose: A simple platform-intependent interface to execute
|
||||
-- and control threads.
|
||||
|
||||
uses
|
||||
Address from Standard,
|
||||
ThreadId from Standard,
|
||||
PThread from OSD,
|
||||
ThreadFunction from OSD
|
||||
is
|
||||
Create returns Thread;
|
||||
---Purpose: Empty constructor
|
||||
|
||||
Create (func: ThreadFunction) returns Thread;
|
||||
---Purpose: Initialize the tool by the thread function
|
||||
--
|
||||
-- Note: On Windows, you might have to take an address of the thread
|
||||
-- function explicitly to pass it to this constructor without compiler error
|
||||
|
||||
Create (other: Thread) returns Thread;
|
||||
---Purpose: Copy constructor
|
||||
|
||||
Assign (me: in out; other: Thread);
|
||||
---Purpose: Copy thread handle from other OSD_Thread object.
|
||||
---C++: alias operator =
|
||||
|
||||
Destroy (me: in out);
|
||||
---Purpose: Destructor. On Windows, closes handle to the thread.
|
||||
-- On UNIX/Linux, does nothing.
|
||||
---C++: alias ~
|
||||
|
||||
SetPriority (me: in out; thePriority: Integer from Standard);
|
||||
---Putpose: Assign the thread to the given priotity, taking it
|
||||
-- : as relative value. The absolute priotity of theThread will
|
||||
-- : be the one of the caller of this function PLUS
|
||||
-- : 'thePriority' parameter
|
||||
-- Note: Currently implemented on Windows only.
|
||||
|
||||
SetFunction (me: in out; func: ThreadFunction);
|
||||
---Purpose: Initialize the tool by the thread function.
|
||||
-- If the current thread handle is not null, nullifies it.
|
||||
--
|
||||
-- Note: On Windows, you might have to take an address of the thread
|
||||
-- function explicitly to pass it to this method without compiler error
|
||||
|
||||
Run (me: in out; data: Address = 0; WNTStackSize: Integer = 0) returns Boolean;
|
||||
---Purpose: Starts a thread with thread function given in constructor,
|
||||
-- passing the specified input data (as void *) to it.
|
||||
-- The parameter \a WNTStackSize (on Windows only)
|
||||
-- specifies size of the stack to be allocated for the thread
|
||||
-- (by default - the same as for the current executable).
|
||||
-- Returns True if thread started successfully
|
||||
|
||||
Detach (me: in out);
|
||||
---Purpose: Detaches the execution thread from this Thread object,
|
||||
-- so that it cannot be waited.
|
||||
-- Note that mechanics of this operation is different on
|
||||
-- UNIX/Linux (the thread is put to detached state) and Windows
|
||||
-- (the handle is closed).
|
||||
-- However, the purpose is the same: to instruct the system to
|
||||
-- release all thread data upon its completion.
|
||||
|
||||
Wait (me) returns Boolean;
|
||||
Wait (me; result: out Address) returns Boolean;
|
||||
---Purpose: Wait till the thread finishes execution.
|
||||
-- Returns True if wait was successful, False in case of error.
|
||||
--
|
||||
-- If successful and \a result argument is provided, saves the pointer
|
||||
-- (void*) returned by the thread function in \a result.
|
||||
--
|
||||
-- Note however that it is advisable not to rely upon returned result
|
||||
-- value, as it is not always the value actually returned by the thread
|
||||
-- function. In addition, on Windows it is converted via DWORD.
|
||||
Wait (me; time: Integer; result: out Address) returns Boolean;
|
||||
---Purpose: Waits for some time and if the thread is finished,
|
||||
-- it returns the result.
|
||||
-- The function returns false if the thread is not finished yet.
|
||||
|
||||
GetId (me) returns ThreadId;
|
||||
---Purpose: Returns ID of the currently controlled thread ID,
|
||||
-- or 0 if no thread is run
|
||||
|
||||
Current (myclass) returns ThreadId;
|
||||
---Purpose: Auxiliary: returns ID of the current thread
|
||||
|
||||
fields
|
||||
myFunc: ThreadFunction from OSD; -- A function to execute
|
||||
myThread: PThread from OSD; -- Thread handle
|
||||
myThreadId: ThreadId from Standard; -- Thread identifier
|
||||
myPriority: Integer from Standard; -- Thread priority
|
||||
|
||||
end;
|
@@ -13,12 +13,12 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#include <OSD_Thread.ixx>
|
||||
|
||||
#include <OSD_Thread.hxx>
|
||||
|
||||
//=============================================
|
||||
// OSD_Thread::OSD_Thread
|
||||
//=============================================
|
||||
|
||||
OSD_Thread::OSD_Thread ()
|
||||
: myFunc(0), myThread(0), myThreadId(0), myPriority(0)
|
||||
{}
|
||||
|
145
src/OSD/OSD_Thread.hxx
Normal file
145
src/OSD/OSD_Thread.hxx
Normal file
@@ -0,0 +1,145 @@
|
||||
// Created on: 2006-03-10
|
||||
// Created by: data exchange team
|
||||
// Copyright (c) 2006-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _OSD_Thread_HeaderFile
|
||||
#define _OSD_Thread_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
#include <Standard_Handle.hxx>
|
||||
|
||||
#include <OSD_ThreadFunction.hxx>
|
||||
#include <OSD_PThread.hxx>
|
||||
#include <Standard_ThreadId.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <Standard_Address.hxx>
|
||||
|
||||
|
||||
//! A simple platform-intependent interface to execute
|
||||
//! and control threads.
|
||||
class OSD_Thread
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
//! Empty constructor
|
||||
Standard_EXPORT OSD_Thread();
|
||||
|
||||
//! Initialize the tool by the thread function
|
||||
//!
|
||||
//! Note: On Windows, you might have to take an address of the thread
|
||||
//! function explicitly to pass it to this constructor without compiler error
|
||||
Standard_EXPORT OSD_Thread(const OSD_ThreadFunction& func);
|
||||
|
||||
//! Copy constructor
|
||||
Standard_EXPORT OSD_Thread(const OSD_Thread& other);
|
||||
|
||||
//! Copy thread handle from other OSD_Thread object.
|
||||
Standard_EXPORT void Assign (const OSD_Thread& other);
|
||||
void operator = (const OSD_Thread& other)
|
||||
{
|
||||
Assign(other);
|
||||
}
|
||||
|
||||
//! Destructor. On Windows, closes handle to the thread.
|
||||
//! On UNIX/Linux, does nothing.
|
||||
Standard_EXPORT void Destroy();
|
||||
~OSD_Thread()
|
||||
{
|
||||
Destroy();
|
||||
}
|
||||
|
||||
Standard_EXPORT void SetPriority (const Standard_Integer thePriority);
|
||||
|
||||
//! Initialize the tool by the thread function.
|
||||
//! If the current thread handle is not null, nullifies it.
|
||||
//!
|
||||
//! Note: On Windows, you might have to take an address of the thread
|
||||
//! function explicitly to pass it to this method without compiler error
|
||||
Standard_EXPORT void SetFunction (const OSD_ThreadFunction& func);
|
||||
|
||||
//! Starts a thread with thread function given in constructor,
|
||||
//! passing the specified input data (as void *) to it.
|
||||
//! The parameter \a WNTStackSize (on Windows only)
|
||||
//! specifies size of the stack to be allocated for the thread
|
||||
//! (by default - the same as for the current executable).
|
||||
//! Returns True if thread started successfully
|
||||
Standard_EXPORT Standard_Boolean Run (const Standard_Address data = 0, const Standard_Integer WNTStackSize = 0);
|
||||
|
||||
//! Detaches the execution thread from this Thread object,
|
||||
//! so that it cannot be waited.
|
||||
//! Note that mechanics of this operation is different on
|
||||
//! UNIX/Linux (the thread is put to detached state) and Windows
|
||||
//! (the handle is closed).
|
||||
//! However, the purpose is the same: to instruct the system to
|
||||
//! release all thread data upon its completion.
|
||||
Standard_EXPORT void Detach();
|
||||
|
||||
Standard_EXPORT Standard_Boolean Wait() const;
|
||||
|
||||
//! Wait till the thread finishes execution.
|
||||
//! Returns True if wait was successful, False in case of error.
|
||||
//!
|
||||
//! If successful and \a result argument is provided, saves the pointer
|
||||
//! (void*) returned by the thread function in \a result.
|
||||
//!
|
||||
//! Note however that it is advisable not to rely upon returned result
|
||||
//! value, as it is not always the value actually returned by the thread
|
||||
//! function. In addition, on Windows it is converted via DWORD.
|
||||
Standard_EXPORT Standard_Boolean Wait (Standard_Address& result) const;
|
||||
|
||||
//! Waits for some time and if the thread is finished,
|
||||
//! it returns the result.
|
||||
//! The function returns false if the thread is not finished yet.
|
||||
Standard_EXPORT Standard_Boolean Wait (const Standard_Integer time, Standard_Address& result) const;
|
||||
|
||||
//! Returns ID of the currently controlled thread ID,
|
||||
//! or 0 if no thread is run
|
||||
Standard_EXPORT Standard_ThreadId GetId() const;
|
||||
|
||||
//! Auxiliary: returns ID of the current thread
|
||||
Standard_EXPORT static Standard_ThreadId Current();
|
||||
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
OSD_ThreadFunction myFunc;
|
||||
OSD_PThread myThread;
|
||||
Standard_ThreadId myThreadId;
|
||||
Standard_Integer myPriority;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _OSD_Thread_HeaderFile
|
@@ -1,82 +0,0 @@
|
||||
-- Created on: 2018-03-15
|
||||
-- Created by: Stephan GARNAUD (ARM)
|
||||
-- Copyright (c) 1998-1999 Matra Datavision
|
||||
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
--
|
||||
-- This file is part of Open CASCADE Technology software library.
|
||||
--
|
||||
-- This library is free software; you can redistribute it and/or modify it under
|
||||
-- the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
-- by the Free Software Foundation, with special exception defined in the file
|
||||
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
-- distribution for complete text of the license and disclaimer of any warranty.
|
||||
--
|
||||
-- Alternatively, this file may be used under the terms of Open CASCADE
|
||||
-- commercial license or contractual agreement.
|
||||
|
||||
-- Updated: J.P. TIRAULT Sept,1993
|
||||
|
||||
class Timer from OSD inherits Chronometer from OSD
|
||||
|
||||
---Purpose: Working on heterogeneous platforms
|
||||
-- we need to use the system call gettimeofday.
|
||||
-- This function is portable and it measures ELAPSED
|
||||
-- time and CPU time in seconds and microseconds.
|
||||
-- Example: OSD_Timer aTimer;
|
||||
-- aTimer.Start(); // Start the timers (t1).
|
||||
-- ..... // Do something.
|
||||
-- aTimer.Stop(); // Stop the timers (t2).
|
||||
-- aTimer.Show(); // Give the elapsed time between t1 and t2.
|
||||
-- // Give also the process CPU time between
|
||||
-- // t1 and t2.
|
||||
|
||||
|
||||
is
|
||||
|
||||
Create returns Timer from OSD;
|
||||
---Purpose: Builds a Chronometer initialized and stopped.
|
||||
---Level: Public
|
||||
|
||||
Reset (me : in out) is redefined;
|
||||
---Purpose: Stops and reinitializes the timer.
|
||||
---Level: Public
|
||||
|
||||
Show (me) is redefined;
|
||||
---Purpose: Shows both the elapsed time and CPU time on the standard output
|
||||
-- stream <cout>.The chronometer can be running (Lap Time) or
|
||||
-- stopped.
|
||||
---Level: Public
|
||||
|
||||
Show (me; os : in out OStream from Standard) is redefined;
|
||||
---Purpose: Shows both the elapsed time and CPU time on the
|
||||
-- output stream <OS>.
|
||||
---Level: Public
|
||||
|
||||
Show (me; theSeconds : in out Real from Standard;
|
||||
theMinutes : in out Integer from Standard;
|
||||
theHours : in out Integer from Standard;
|
||||
theCPUtime : in out Real from Standard);
|
||||
|
||||
---Purpose: returns both the elapsed time(seconds,minutes,hours)
|
||||
-- and CPU time.
|
||||
---Level: Public
|
||||
|
||||
Stop (me : in out) is redefined;
|
||||
---Purpose: Stops the Timer.
|
||||
---Level: Public
|
||||
|
||||
Start (me : in out) is redefined;
|
||||
---Purpose: Starts (after Create or Reset) or restarts (after Stop)
|
||||
-- the Timer.
|
||||
---Level: Public
|
||||
|
||||
ElapsedTime (me) returns Real;
|
||||
---Purpose: Returns elapsed time in seconds.
|
||||
---Level: Public
|
||||
|
||||
fields
|
||||
|
||||
TimeStart : Real;
|
||||
TimeCumul : Real;
|
||||
|
||||
end;
|
@@ -19,7 +19,7 @@
|
||||
// system call gettimeofday. This function is portable and give us
|
||||
// elapsed time in seconds and microseconds.
|
||||
|
||||
#include <OSD_Timer.ixx>
|
||||
#include <OSD_Timer.hxx>
|
||||
|
||||
#ifndef WNT
|
||||
|
||||
|
102
src/OSD/OSD_Timer.hxx
Normal file
102
src/OSD/OSD_Timer.hxx
Normal file
@@ -0,0 +1,102 @@
|
||||
// Created on: 2018-03-15
|
||||
// Created by: Stephan GARNAUD (ARM)
|
||||
// Copyright (c) 1998-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _OSD_Timer_HeaderFile
|
||||
#define _OSD_Timer_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
#include <Standard_Handle.hxx>
|
||||
|
||||
#include <Standard_Real.hxx>
|
||||
#include <OSD_Chronometer.hxx>
|
||||
#include <Standard_OStream.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
|
||||
|
||||
//! Working on heterogeneous platforms
|
||||
//! we need to use the system call gettimeofday.
|
||||
//! This function is portable and it measures ELAPSED
|
||||
//! time and CPU time in seconds and microseconds.
|
||||
//! Example: OSD_Timer aTimer;
|
||||
//! aTimer.Start(); // Start the timers (t1).
|
||||
//! ..... // Do something.
|
||||
//! aTimer.Stop(); // Stop the timers (t2).
|
||||
//! aTimer.Show(); // Give the elapsed time between t1 and t2.
|
||||
//! // Give also the process CPU time between
|
||||
//! // t1 and t2.
|
||||
class OSD_Timer : public OSD_Chronometer
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
//! Builds a Chronometer initialized and stopped.
|
||||
Standard_EXPORT OSD_Timer();
|
||||
|
||||
//! Stops and reinitializes the timer.
|
||||
Standard_EXPORT virtual void Reset() Standard_OVERRIDE;
|
||||
|
||||
//! Shows both the elapsed time and CPU time on the standard output
|
||||
//! stream <cout>.The chronometer can be running (Lap Time) or
|
||||
//! stopped.
|
||||
Standard_EXPORT virtual void Show() const Standard_OVERRIDE;
|
||||
|
||||
//! Shows both the elapsed time and CPU time on the
|
||||
//! output stream <OS>.
|
||||
Standard_EXPORT virtual void Show (Standard_OStream& os) const Standard_OVERRIDE;
|
||||
|
||||
//! returns both the elapsed time(seconds,minutes,hours)
|
||||
//! and CPU time.
|
||||
Standard_EXPORT void Show (Standard_Real& theSeconds, Standard_Integer& theMinutes, Standard_Integer& theHours, Standard_Real& theCPUtime) const;
|
||||
|
||||
//! Stops the Timer.
|
||||
Standard_EXPORT virtual void Stop() Standard_OVERRIDE;
|
||||
|
||||
//! Starts (after Create or Reset) or restarts (after Stop)
|
||||
//! the Timer.
|
||||
Standard_EXPORT virtual void Start() Standard_OVERRIDE;
|
||||
|
||||
//! Returns elapsed time in seconds.
|
||||
Standard_EXPORT Standard_Real ElapsedTime() const;
|
||||
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
Standard_Real TimeStart;
|
||||
Standard_Real TimeCumul;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _OSD_Timer_HeaderFile
|
40
src/OSD/OSD_WhoAmI.hxx
Normal file
40
src/OSD/OSD_WhoAmI.hxx
Normal file
@@ -0,0 +1,40 @@
|
||||
// Copyright (c) 1992-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _OSD_WhoAmI_HeaderFile
|
||||
#define _OSD_WhoAmI_HeaderFile
|
||||
|
||||
//! Allows great accuracy for error management.
|
||||
//! This is private.
|
||||
enum OSD_WhoAmI
|
||||
{
|
||||
OSD_WDirectory,
|
||||
OSD_WDirectoryIterator,
|
||||
OSD_WEnvironment,
|
||||
OSD_WFile,
|
||||
OSD_WFileNode,
|
||||
OSD_WFileIterator,
|
||||
OSD_WPath,
|
||||
OSD_WProcess,
|
||||
OSD_WProtection,
|
||||
OSD_WHost,
|
||||
OSD_WDisk,
|
||||
OSD_WChronometer,
|
||||
OSD_WTimer,
|
||||
OSD_WPackage,
|
||||
OSD_WPrinter,
|
||||
OSD_WEnvironmentIterator
|
||||
};
|
||||
|
||||
#endif // _OSD_WhoAmI_HeaderFile
|
@@ -11,7 +11,8 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#include <OSD.ixx>
|
||||
|
||||
#include <OSD.hxx>
|
||||
|
||||
#ifndef _WIN32
|
||||
|
||||
|
@@ -11,7 +11,8 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#include <OSD.ixx>
|
||||
|
||||
#include <OSD.hxx>
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
|
Reference in New Issue
Block a user