1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

0020716: Eliminate usage of "config.h" header file

All inclusions of "config.h" were removed.

All places where macros defined by config.h were checked and removed

Small corrections for mac os.

Unused code in file OSD_Disk.cxx was removed.

Unused macros and includes were removed from samples and code.

Added necessary includes for MacOS.

Correct new additional compilation warning on Linux platform.

Fix for error in OSD_Chronometer on Debian70/Fedora18
This commit is contained in:
apn
2014-09-05 10:39:31 +04:00
committed by bugmaster
parent 71b73fde24
commit 03155c18a5
74 changed files with 74 additions and 877 deletions

View File

@@ -16,10 +16,7 @@
#include <Standard_Stream.hxx>
#include <stdio.h>
#include <math.h>
#if HAVE_IEEEFP_H
# include <ieeefp.h>
#endif
#if !defined(HAVE_FINITE) && defined(isfinite)
#if defined(isfinite)
# define finite isfinite
#endif
@@ -82,13 +79,8 @@ Standard_Boolean OSD::CStringToReal(const Standard_CString aString,
#else
# define SLEEP(NSEC) sleep(NSEC)
#endif
#ifdef HAVE_VALUES_H
//# include <values.h>
#endif
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#ifndef _WIN32
#include <unistd.h>
#endif
void OSD::SecSleep(const Standard_Integer aDelay)
@@ -101,7 +93,7 @@ void OSD::SecSleep(const Standard_Integer aDelay)
//purpose : Cause the process to sleep during a amount of milliseconds
//=======================================================================
#ifdef WNT
#ifdef _WIN32
void OSD::MilliSecSleep(const Standard_Integer aDelay)
{
@@ -110,9 +102,7 @@ void OSD::MilliSecSleep(const Standard_Integer aDelay)
#else
#ifdef HAVE_SYS_TIME_H
# include <sys/time.h>
#endif
#include <sys/time.h>
void OSD::MilliSecSleep(const Standard_Integer aDelay)
{

View File

@@ -23,21 +23,8 @@
//---------- Systemes autres que WNT : ----------------------------------
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#ifdef HAVE_SYS_TIMES_H
# include <sys/times.h>
#endif
#include <sys/times.h>
#include <unistd.h>
#ifdef SOLARIS
# include <sys/resource.h>
@@ -51,7 +38,7 @@
# define _sysconf sysconf
#endif
#if defined(HAVE_TIME_H) || defined(WNT) || defined(DECOSF1)
#if defined(DECOSF1)
# include <time.h>
#endif
@@ -59,12 +46,6 @@
# define CLK_TCK CLOCKS_PER_SEC
# endif
#ifdef HAVE_LIMITS
# include <limits>
#elif defined (HAVE_LIMITS_H)
# include <limits.h>
#endif
#if (defined(__APPLE__))
#include <mach/task.h>
#include <mach/mach.h>

View File

@@ -12,39 +12,16 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#ifndef WNT
#include <OSD_Directory.ixx>
#include <OSD_WhoAmI.hxx>
#include <OSD_Protection.hxx>
#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#ifdef HAVE_SYS_STAT_H
# include <sys/stat.h>
#endif
#ifdef HAVE_SYS_PARAM_H
# include <sys/param.h> // For getwd()
#endif
#include <sys/stat.h>
#include <errno.h>
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#include <stdio.h>
#ifdef HAVE_OSFCN_H
# include <osfcn.h>
#endif
#include <unistd.h>
const OSD_WhoAmI Iam = OSD_WDirectory;

View File

@@ -12,28 +12,14 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#ifndef WNT
#include <OSD_DirectoryIterator.ixx>
#include <OSD_WhoAmI.hxx>
#include <stdio.h>
#ifdef HAVE_DIRENT_H
# include <dirent.h>
#endif
#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#ifdef HAVE_SYS_STAT_H
# include <sys/stat.h>
#endif
#include <dirent.h>
#include <sys/stat.h>
//const OSD_WhoAmI Iam = OSD_WDirectoryIterator;

View File

@@ -12,10 +12,6 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#ifndef WNT
#include <OSD_Disk.ixx>
@@ -27,17 +23,7 @@ const OSD_WhoAmI Iam = OSD_WDisk;
extern "C" {
#endif
//#include <sys/types.h>
#if defined(HAVE_STATVFS) && defined(HAVE_SYS_STATVFS_H)
# include <sys/statvfs.h>
#elif defined(HAVE_STATFS) && defined(HAVE_SYS_VFS_H)
// Note: we want to use the "vfs" method on HP, not elsewhere
# include <sys/vfs.h>
#elif defined(HAVE_STATFS)
# include <sys/param.h>
# include <sys/mount.h>
#endif
#include <sys/statvfs.h>
#ifdef __cplusplus
}
@@ -45,9 +31,7 @@ extern "C" {
#include <errno.h>
#if defined(HAVE_STATVFS)
extern "C" {int statvfs(const char *, struct statvfs *); }
#endif
OSD_Disk::OSD_Disk() : myQuotaSize(0) {}
@@ -76,18 +60,6 @@ OSD_Path OSD_Disk::Name()const{
Standard_Integer OSD_Disk::DiskSize(){
#if !defined(HAVE_STATVFS)
struct statfs buffer;
if ( statfs (DiskName.ToCString(),&buffer) == 0 ){
long BSize512 = buffer.f_bsize / 512 ;
return buffer.f_blocks * BSize512 ;
}
else {
myError.SetValue(errno, Iam, "OSD_Disk: statfs failed.");
#else
struct statvfs buffer;
if ( statvfs(DiskName.ToCString(),&buffer) == 0 ){
@@ -96,28 +68,10 @@ struct statvfs buffer;
}
else {
myError.SetValue(errno, Iam, "OSD_Disk: statvfs failed.");
#endif
return 0;
}
}
#if !defined(HAVE_STATVFS)
Standard_Integer OSD_Disk::DiskFree(){
struct statfs buffer;
if ( statfs (DiskName.ToCString(),&buffer) == 0 ){
long BSize512 = buffer.f_bsize / 512 ;
return buffer.f_bavail * BSize512 ;
}
else {
myError.SetValue(errno, Iam, "OSD_Disk: statfs failed.");
return 0;
}
}
#else
Standard_Integer OSD_Disk::DiskFree(){
struct statvfs buffer;
@@ -131,8 +85,6 @@ struct statvfs buffer;
}
}
#endif
Standard_Integer OSD_Disk::DiskQuota(){
//@@@ A faire
return 0;

View File

@@ -12,10 +12,6 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
//------------------------------------------------------------------------
// UNIX Part
//------------------------------------------------------------------------
@@ -39,22 +35,11 @@ const OSD_WhoAmI Iam = OSD_WFile;
#endif
#include <errno.h>
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#include <stdlib.h>
#include <stdio.h>
#include <fcntl.h>
#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#ifdef HAVE_SYS_STAT_H
# include <sys/stat.h>
#endif
#include <unistd.h>
#include <sys/stat.h>
#define NEWLINE '\10';

View File

@@ -12,10 +12,6 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#ifndef WNT
#include <OSD_FileIterator.ixx>
@@ -25,28 +21,11 @@
#include <sys/types.h>
#include <sys/stat.h>
#ifdef HAVE_DIRENT_H
# include <dirent.h>
# define NAMLEN(dirent) strlen((dirent)->d_name)
# ifdef VMS
extern char *vmsify PARAMS ((char *name, int type));
# endif
#else
# define dirent direct
# define NAMLEN(dirent) (dirent)->d_namlen
# ifdef HAVE_SYS_NDIR_H
# include <sys/ndir.h>
# endif
# ifdef HAVE_SYS_DIR_H
# include <sys/dir.h>
# endif
# ifdef HAVE_NDIR_H
# include <ndir.h>
# endif
# ifdef HAVE_VMSDIR_H
# include "vmsdir.h"
# endif /* HAVE_VMSDIR_H */
#endif
/* In GNU systems, <dirent.h> defines this macro for us. */
#ifdef _D_NAMLEN

View File

@@ -12,19 +12,13 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#ifndef _WIN32
//----------------------------------------------------------------------------
//------------------- Linux Sources of OSD_FileNode --------------------------
//----------------------------------------------------------------------------
#include <unistd.h>
#include <errno.h>
#include <string.h>
#include <Standard_ProgramError.hxx>
#include <OSD_OSDError.hxx>
@@ -32,34 +26,13 @@
#include <OSD_WhoAmI.hxx>
#include <OSD_FileNode.ixx>
#if!defined(TM_IN_SYS_TIME) && defined(HAVE_TIME_H)
# include <time.h>
#elif HAVE_SYS_TIME_H
# include <sys/time.h>
#endif
#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#ifdef HAVE_SYS_STAT_H
# include <sys/stat.h> // for "stat"
#endif
#include <stdlib.h> // For "system"
#include <errno.h>
#include <fcntl.h>
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#include <stdio.h>
#ifdef HAVE_OSFCN_H
# include <osfcn.h>
#endif
#include <unistd.h>
#include <sys/stat.h>
const OSD_WhoAmI Iam = OSD_WFileNode;

View File

@@ -12,10 +12,6 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#ifndef WNT
#include <Standard_NullObject.hxx>
@@ -27,20 +23,11 @@ const OSD_WhoAmI Iam = OSD_WHost;
#include <errno.h>
#ifdef HAVE_SYS_UTSNAME_H
# include <sys/utsname.h> // For 'uname'
#endif
#ifdef HAVE_NETDB_H
# include <netdb.h> // This is for 'gethostbyname'
#endif
#include <sys/utsname.h> // For 'uname'
#include <netdb.h> // This is for 'gethostbyname'
#include <unistd.h>
#include <stdio.h>
#ifdef HAVE_SYS_IOCTL_H
# include <sys/ioctl.h>
#endif
#if defined(__osf__) || defined(DECOSF1)
#include <sys/types.h>
#include <sys/sysinfo.h> // For 'getsysinfo'
@@ -52,26 +39,6 @@ extern "C" {
}
#endif
#ifdef HAVE_SYSENT_H
# include <sysent.h> // for 'gethostname'
#endif
#ifdef HAVE_SYS_SOCKET_H
# include <sys/socket.h>
#endif
#ifdef HAVE_SYS_UNISTD_H
# include <sys/unistd.h>
#endif
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#ifdef HAVE_SYS_SYSTEMINFO_H
# include <sys/systeminfo.h>
#endif
extern "C" {int sysinfo(int, char *, long);}
@@ -84,22 +51,11 @@ OSD_Host::OSD_Host(){}
TCollection_AsciiString OSD_Host::SystemVersion(){
struct utsname info;
TCollection_AsciiString result;
#ifdef HAVE_SYS_SYSTEMINFO_H
char buf[100];
#endif
uname (&info);
result = info.sysname;
result += " ";
result += info.release;
#ifdef HAVE_SYS_SYSTEMINFO_H
result += " ";
sysinfo(SI_ARCHITECTURE,buf,99);
result += buf;
result += " ";
sysinfo(SI_HW_PROVIDER,buf,99);
result += buf;
#endif
return(result);
}

View File

@@ -12,10 +12,6 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#ifndef WNT
#include <Standard_NumericError.hxx>
@@ -25,10 +21,6 @@
#include <OSD_Path.ixx>
#include <OSD_WhoAmI.hxx>
#ifdef HAVE_SYS_UTSNAME_H
//# include <sys/utsname.h>
#endif
static OSD_SysType whereAmI(){
#if defined(__digital__) || defined(__FreeBSD__) || defined(SUNOS) || defined(__APPLE__)
return OSD_UnixBSD;

View File

@@ -12,10 +12,6 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#ifndef WNT
#include <OSD_Process.ixx>
@@ -25,28 +21,11 @@
const OSD_WhoAmI Iam = OSD_WProcess;
#include <errno.h>
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#include <stdlib.h>
#ifdef HAVE_SYS_PARAM_H
# include <sys/param.h>
#endif
#if defined(HAVE_TIME_H) || defined(WNT)
# include <time.h>
#endif
#ifdef HAVE_SYS_TIME_H
# include <sys/time.h>
#endif
#ifdef HAVE_PWD_H
# include <pwd.h> // For command getpwuid
#endif
#include <sys/param.h>
#include <sys/time.h>
#include <pwd.h> // For command getpwuid
#include <unistd.h>
OSD_Process::OSD_Process(){
}

View File

@@ -12,10 +12,6 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#ifndef WNT
#include <OSD_LoadMode.hxx>
@@ -24,10 +20,6 @@
#include <stdio.h>
#ifdef HAVE_MALLOC_H
# include <malloc.h>
#endif
#ifdef __some_crappy_system__
/*
* Values for 'mode' argument in dlopen().
@@ -49,13 +41,7 @@ extern "C" {int dlclose ( void *handle );}
extern "C" {void *dlerror (void);}
#endif
#ifdef HAVE_DLFCN_H
# include <dlfcn.h>
#endif
#ifdef HAVE_DL_H
# include <dl.h>
#endif
#include <dlfcn.h>
extern "C" {size_t strlen (const char* s );}
@@ -125,25 +111,12 @@ void OSD_SharedLibrary::SetName(const Standard_CString aName) {
//
// ----------------------------------------------------------------
Standard_Boolean OSD_SharedLibrary::DlOpen(const OSD_LoadMode aMode ) {
#ifdef HAVE_DL_H
if (aMode == OSD_RTLD_LAZY){
// myHandle = cxxshl_load(myName, BIND_FIRST | BIND_TOGETHER | BIND_DEFERRED | BIND_VERBOSE | DYNAMIC_PATH, 0L);
myHandle = shl_load(myName, BIND_FIRST | BIND_TOGETHER | BIND_DEFERRED | BIND_VERBOSE | DYNAMIC_PATH, 0L);
}
else if (aMode == OSD_RTLD_NOW){
// myHandle = cxxshl_load(myName, BIND_FIRST | BIND_TOGETHER | BIND_IMMEDIATE | BIND_VERBOSE | DYNAMIC_PATH, 0L);
myHandle = shl_load(myName, BIND_FIRST | BIND_TOGETHER | BIND_IMMEDIATE | BIND_VERBOSE | DYNAMIC_PATH, 0L);
}
#else
if (aMode == OSD_RTLD_LAZY){
myHandle = dlopen (myName,RTLD_LAZY);
}
else if (aMode == OSD_RTLD_NOW){
myHandle = dlopen (myName,RTLD_NOW);
}
#endif
if (!BAD(myHandle)){
return Standard_True;
@@ -161,8 +134,6 @@ else {
//
// ----------------------------------------------------------------
OSD_Function OSD_SharedLibrary::DlSymb(const Standard_CString aName )const{
#ifndef HAVE_DL_H
void (*fp)();
fp = (void (*)()) dlsym (myHandle,aName);
if (!BAD(fp)){
@@ -171,20 +142,6 @@ if (!BAD(fp)){
else {
return (OSD_Function)NULL;
}
#else
void *adr_get = NULL;
// shl_t handlesym=0 ;
errno = 0 ;
// if ( shl_findsym( &handlesym,aName,TYPE_PROCEDURE,&adr_get) == -1 ) {
if ( shl_findsym((shl_t *)&myHandle,aName,TYPE_PROCEDURE,&adr_get) == -1 ) {
if ( errno != 0 )
perror("OSD_SharedLibrary : shl_findsym perror : ") ;
return (OSD_Function)NULL;
}
else return (OSD_Function) adr_get;
#endif
}
// ----------------------------------------------------------------
//
@@ -195,13 +152,7 @@ else {
//
// ----------------------------------------------------------------
void OSD_SharedLibrary::DlClose()const{
#ifndef HAVE_DL_H
dlclose(myHandle);
#else
shl_unload((shl_t)myHandle);
#endif
}
// ----------------------------------------------------------------
//
@@ -210,12 +161,7 @@ void OSD_SharedLibrary::DlClose()const{
//
// ----------------------------------------------------------------
Standard_CString OSD_SharedLibrary::DlError()const{
#ifndef HAVE_DL_H
return (char*) dlerror();
#else
perror("shl_load, shl_findsym, or shl_unload : perror : ") ;
return (char*) errno;
#endif
}
// ----------------------------------------------------------------------------
// Destroy

View File

@@ -19,19 +19,13 @@
// system call gettimeofday. This function is portable and give us
// elapsed time in seconds and microseconds.
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <OSD_Timer.ixx>
#ifndef WNT
//---------- No Windows NT Systems ----------------------------------
#ifdef HAVE_SYS_TIME_H
# include <sys/time.h>
#endif
#include <sys/time.h>
//=======================================================================
//function : GetWallClockTime

View File

@@ -17,10 +17,6 @@
//---------- All Systems except Windows NT : ----------------------------------
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
# include <stdio.h>
#include <OSD_WhoAmI.hxx>
@@ -40,16 +36,7 @@
#include <Standard_ErrorHandler.hxx>
// POSIX threads
#ifdef HAVE_PTHREAD_H
#include <pthread.h>
#endif
#ifdef HAVE_PTHREAD_H
static pthread_t getOCCThread () {
static pthread_t TheOCCThread = 0;
return TheOCCThread ;
}
#endif
#include <pthread.h>
#ifdef linux
#include <fenv.h>
@@ -64,38 +51,10 @@ static Standard_Boolean fCtrlBrk;
typedef void (ACT_SIGIO_HANDLER)(void) ;
ACT_SIGIO_HANDLER *ADR_ACT_SIGIO_HANDLER = NULL ;
#if defined(HAVE_FLOATINGPOINT_H) && defined(HAVE_SYS_MACHSIG_H)
# include <floatingpoint.h>
# include <sys/machsig.h>
// JPT : Difference between SUN/SUNOS and SUN/SOLARIS
# define FPE_FLTDIV_TRAP FPE_FLTDIV
# define FPE_INTDIV_TRAP FPE_INTDIV
# define FPE_FLTOVF_TRAP FPE_FLTOVF
# define FPE_INTOVF_TRAP FPE_INTOVF
# define FPE_FLTUND_TRAP FPE_FLTUND
#define FPE_FLTRES_TRAP FPE_FLTRES /* floating point inexact result */
#define FPE_FLTINV_TRAP FPE_FLTINV /* invalid floating point operation */
#define FPE_FLTSUB_TRAP FPE_FLTSUB /* subscript out of range */
extern "C" {int ieee_handler(char *,char *, sigfpe_handler_type&);}
# include <stdlib.h>
#endif
#ifdef DECOSF1
typedef void (* SIG_PFV) (int);
#endif
#if defined(HAVE_SIGFPE_H) && defined(HAVE_SYS_SIGINFO_H)
# include <sigfpe.h>
# include <sys/siginfo.h>
# define FPE_FLTDIV_TRAP FPE_FLTDIV
# define FPE_INTDIV_TRAP FPE_INTDIV
# define FPE_FLTOVF_TRAP FPE_FLTOVF
# define FPE_INTOVF_TRAP FPE_INTOVF
# define FPE_FLTUND_TRAP FPE_FLTUND
#endif
#ifdef __GNUC__
# include <stdlib.h>
# include <stdio.h>
@@ -108,13 +67,8 @@ typedef void (* SIG_PFV) (int);
#endif
typedef void (* SIG_PFV) (int);
#ifdef HAVE_SIGNAL_H
# include <signal.h>
#endif
#ifdef HAVE_SYS_SIGNAL_H
# include <sys/signal.h>
#endif
#include <signal.h>
#include <sys/signal.h>
#if defined(HAVE_PTHREAD_H) && defined(NO_CXX_EXCEPTION)
//============================================================================