0023427: Unused C-sources in OSD package
authormmv <mmv@opencascade.com>
Wed, 5 Feb 2014 13:20:39 +0000 (17:20 +0400)
committerapn <apn@opencascade.com>
Thu, 13 Feb 2014 10:04:01 +0000 (14:04 +0400)
Deleted unused sources in OSD package

15 files changed:
src/OSD/FILES
src/OSD/OSD.cdl [changed mode: 0644->0755]
src/OSD/OSD_Cmailbox.c [deleted file]
src/OSD/OSD_Csemaphore.c [deleted file]
src/OSD/OSD_Csharedmemory.c [deleted file]
src/OSD/OSD_Error.cdl [changed mode: 0644->0755]
src/OSD/OSD_Error.cxx [changed mode: 0644->0755]
src/OSD/OSD_ErrorList.hxx [changed mode: 0644->0755]
src/OSD/OSD_Getkey.c [deleted file]
src/OSD/OSD_MailBox.cdl [deleted file]
src/OSD/OSD_MailBox.cxx [deleted file]
src/OSD/OSD_Semaphore.cdl [deleted file]
src/OSD/OSD_Semaphore.cxx [deleted file]
src/OSD/OSD_SharedMemory.cdl [deleted file]
src/OSD/OSD_SharedMemory.cxx [deleted file]

index a857f5d..1b08d1e 100755 (executable)
@@ -1,10 +1,6 @@
 EXTERNLIB
-OSD_Cmailbox.c
-OSD_Csemaphore.c
-OSD_Csharedmemory.c
 OSD_CMPLRS.edl
 OSD_Function.cxx
-OSD_Getkey.c
 OSD_Function.hxx
 OSD_ErrorList.hxx
 OSD_WNT.cxx
old mode 100644 (file)
new mode 100755 (executable)
index 4728861..ce7bd16
@@ -91,9 +91,9 @@ is
    ---Purpose: Specifies the type of files.
 
  private enumeration WhoAmI is  WDirectory, WDirectoryIterator,
-             WEnvironment, WFile, WFileNode, WFileIterator, WMailBox,
-             WPath, WProcess, WProtection, WSemaphore, WHost, WDisk,
-             WChronometer, WSharedMemory, WTimer, WPackage, WPrinter,
+             WEnvironment, WFile, WFileNode, WFileIterator,
+             WPath, WProcess, WProtection, WHost, WDisk,
+             WChronometer, WTimer, WPackage, WPrinter,
              WEnvironmentIterator;
    ---Purpose: Allows great accuracy for error management.
    --          This is private.
@@ -150,18 +150,9 @@ is
          class Process;
              ---Purpose: Process specific oriented tools
 
-         class SharedMemory;
-             ---Purpose: Manages shared memory.
-
-         class Semaphore;
-             ---Purpose: Manages semaphores.
-
 --         class Mutex is alias Mutex from Standard;
              ---Purpose: Mutex object to synchronize threads within one process
 
-         class MailBox;
-             ---Purpose: Manages asynchronous mail boxes.
-
          class SharedLibrary;
              ---Purpose: Provides tools to load a shared library
              --          and retrieve the address of an entry point.
diff --git a/src/OSD/OSD_Cmailbox.c b/src/OSD/OSD_Cmailbox.c
deleted file mode 100644 (file)
index a684710..0000000
+++ /dev/null
@@ -1,552 +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 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 !defined( WNT ) && !defined(__hpux)
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <stdio.h>
-#include <errno.h>
-
-#ifdef HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#ifdef HAVE_STRING_H
-# include <string.h>
-#endif
-
-#ifdef HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#ifdef HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-/* #ifdef ANSI */
-int create_sharedmemory (int **,char *,int);
-int open_sharedmemory   (int **,char *,int);
-int remove_sharedmemory (int * ,char *    );
-/* #endif */
-
-/* This is a multi-server & multi-client asynchronous mailbox management */
-
-
-/* The UNIX mail box is based on shared memory 
-/
-/
-/ The messages are send via shared memory .
-/ AST like functions (VMS) are simulated with a signal handler using SIGUSR1.
-/
-/ To manage multiple mail boxes , an internal use shared memory is used
-/ to communicate index among table of mail box informations .
-/
-/
-/ Primitives to manage mail boxes :
-/  osd_crmbox     Create a mail box
-/  osd_opmbox     Open a mail box
-/  osd_clmbox     Close a mail box
-/  osd_wrmbox     Write into a mail box
-/
-/  user function needed to receive messages :
-/   user_function (int *box_id, char *box_name, char *message_address, int message_length)
-/
-/
-/
-/ In following explanations, "special shared memory" designates an internal 
-/ data area implemented with shared memory used to send index of mail box 
-/ informations table for the signal handler.
-/
-/ Algorithms :
-/
-/  To create a mail box      - Find a free entry in mail box infos table
-/                            - If first mail box, create special shared memory
-/                            - Create a shared memory for messages
-/                            - Put PID of creator into shared memory
-/                            - Install signal handler for SIGUSR1
-/
-/
-/  To open a mailbox         - Find a free entry in mail box infos table
-/                            - Attach shared memory to process
-/                            - Get PID of creator from shared memory
-/
-/
-/
-/  To close a mail box       - Remove shared memory
-/                            - Free entry in mail box infos table
-/                            - If last mail box, remove special shared memory
-/
-/
-/  To write in a mail box    - Write message into shared memory using 
-/                              following protocol :
-/                                 Length Message
-/
-/                            - Send signal SIGUSR1 to server process
-/
-/
-/  To receive message        - Get mail box identification from special shared
-/                              memory.
-/                            - Get message with protocol
-/                            - Get all informations for user function
-/                            - Call user function
-/                            - Arm again the signal handler
-*/
-
-
-
-#define MAX_BOX    256          /* Maximum number of mail boxes */
-
-/* Protocol to communicate PID of server to clients */
-
-#define BEGIN_PROTOCOL 0xAABB
-#define END_PROTOCOL   0xCCDD
-
-#define SIZEOFNAME     64      /* length of mailbox name */
-
-
-/* Mail boxes informations table */
-
-static struct {
-
-  int channel;                  /* Id of shared memory (IPC)   */
-  int  size;                    /* Size of data area           */
-  int (* user_func) ();         /* User function               */
-  char name[SIZEOFNAME];        /* Name of mail box   VMS only */
-  int *address;                /* Address of data area        */
-
-} id_table[MAX_BOX +1];         /* Allows up to MAX_BOX mail boxes */
-/*  char *address;   */             /* Address of data area        */
-
-static int first_mail_box = 1;  /* Flag to initialize mail boxes */
-static int pid;                 /* Pid of server or client       */
-static int nb_mail = 0;
-static int max_mail = MAX_BOX;
-
-/* For special shared memory only */
-
-/*static char *shared_infos;*/      /* Address of shared memory     */
-static int *shared_infos;      /* Address of shared memory     */
-static int   shared_shmid;      /* Id (IPC) of shared memory    */
-
-
-
-
-static struct {
-  int code1;      /* Beginning of protocol */
-  int pid;        /* PID of server         */
-  int code2;      /* End of protocol       */
- } protocol;
-
-
-
-
-
-
-
-
-
-
-/*====== Private : ======================================================
-
-  find an entry in the mail_box identification table
-
-  -----------------------------------------------------------------------*/
-
-static int
-alloc_entry()
-{
- int i;
-
- /* If first use, initialize id_table */
-
- if (first_mail_box) {
-  memset(id_table,0,sizeof(id_table));
-  first_mail_box = 0;
-
-  /* Allocate special shared memory named "XptY"  why not ?! */
-
-  if (! create_sharedmemory(&shared_infos, "XptY", sizeof( id_table ) ))
-     max_mail = 1;
-  else {
-     shared_shmid = open_sharedmemory (&shared_infos, "XptY", sizeof (id_table) );
-     if (shared_shmid == 0) max_mail = 1;
-    }
- }
-
-
- i = 1;
- while ( id_table[i].address != NULL && i < MAX_BOX)
-  i++;
-
- if (i == MAX_BOX-1) return -1;   /* Too many mail boxes opened */
-   else return (i);
-}
-
-
-
-
-/*========= Private : ===================================================
-
- Remove special shared memory (internal use) when no more mail boxes
-
- -----------------------------------------------------------------------*/
-
-static void
-keep_clean()
-{
- remove_sharedmemory (&shared_shmid,"Xpty");
- first_mail_box = 1;
-}
-
-
-
-
-
-/*========= Private : ===================================================
-
- Set specific error for Mail boxes
- This allow more detailed error decoding
-
- -----------------------------------------------------------------------*/
-
-static void
-set_err(int number)
-{
- errno = number + 256;   /* Set specific error for Mail boxes */
-}
-
-
-
-
-/*====== Private : ======================================================
-
-  Put PID of handler process into shared memory
-  using a special protocol  AABB pid CCDD
-
-----------------------------------------------------------------------*/
-
-
-void
-put_pid(int boxid)
-{
- protocol.code1 = BEGIN_PROTOCOL;
- protocol.pid   = getpid();
- protocol.code2 = END_PROTOCOL;
- memcpy (id_table[boxid].address, &protocol, sizeof(protocol));
-}
-
-int
-get_pid(int boxid)
-{
- memcpy(&protocol, id_table[boxid].address, sizeof(protocol));
- if (protocol.code1 != BEGIN_PROTOCOL) return(-1);
- if (protocol.pid   <= 2) return(-2);
- if (protocol.code2 != END_PROTOCOL) return(-3);
-
- pid = protocol.pid;
-
- return(0);
-}
-
-
-
-
-/*====== Private : ======================================================
-
-  Mail box handler
-
- This simulate a VMS AST function :
-   Asynchronous function
-
-----------------------------------------------------------------------*/
-
-void
-handler(int sig)
-{         
- int boxid;
- int length;
-/* char * address;*/
- int * address;
- char boxname [65];
-
- memcpy (boxname, shared_infos, SIZEOFNAME); /* Get name of mailbox */
-
- for (boxid=1; boxid <= MAX_BOX; boxid++)
-     if (strcmp(boxname,id_table[boxid].name) == 0) break;
-
- if (boxid > MAX_BOX) return ; /* ****** What could we do ? ***** */
- address = id_table[boxid].address;
-
- address += sizeof(protocol);            /* Pass the protocol     JPT */
-
- memcpy(&length, address, sizeof(int));  /* Restore length of message */
-
- address += sizeof(int);                 /* Adjust pointer to the message */
-
- /* Call user function */
-
- /* Don't forget to give again PID 
-    of handler process in case of multi-clients */
-
-
-/* call user-function */
-(*id_table[boxid].user_func) (&boxid,
-                                id_table[boxid].name,
-                                address,
-                                length
-                               );
-
- /* Re-arm handler */
-
-  signal (SIGUSR1, handler); 
-
-
-/* don't forget to give again PID of handler process in case of multi-clients
- */ 
- put_pid(boxid); 
-
-}
-
-
-
-/*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
-/
-/                          P U B L I C       functions
-/
-/@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/
-
-
-
-/*====================== Create a mail box =========================
-
-  Returns 0 if failed
-          mail box identification if succeeded
-
-  ================================================================*/
-
-int
-create_mailbox(char *box_name, int box_size,
-               int (* async_func) (int *box_id, char *box_name,
-               char *message_address, int message_length) )
-{
-/* int status;*/
- int index;
- int shmid;
-
- /* Test function security */
-
- if (async_func == NULL) {
-  set_err (EFAULT);
-  return (0);  /* Verifies function exists */
- }
-
- if (box_size == 0){
-  set_err (EINVAL);
-  return (0);
- }
-
- if (box_name == NULL) {
-  set_err (EFAULT);
-  return (0);
- }
-
- index = alloc_entry();               /* Find an entry for id_table */
- if (index == -1) {
-  set_err(EMFILE);
-  keep_clean();
-  return(0);
- }
-
- if (max_mail == 1 && index > 0) {  /* If only one mail box authorized */
-  set_err (EMFILE);
-  return(0);
- }
-
- /* Create shared memory for the process */
-
- shmid = create_sharedmemory ( &id_table[index].address, box_name, box_size);
- if (shmid == 0) return (0);
-
-
- put_pid (index);    /* Put pid of server into shared memory  */
-
- id_table[index].channel = shmid;              /* Keep id of shared memory */
- id_table[index].size = box_size;              /* Keep size of mail box */
- strncpy(id_table[index].name,box_name,SIZEOFNAME);    /* Keep name of mail box */
- id_table[index].user_func = async_func;       /* Keep user function */
-
-
- /* Install asynchronous function : AST function */
-
-  signal (SIGUSR1,  handler); 
-
- nb_mail++;          
- return (index);
-}
-
-
-
-/*====================== Open a mail box =======================
-
-  Returns 0 if failed
-          mail box identification if succeeded
-
-  ================================================================*/
-
-int
-open_mailbox(char * box_name, int box_size)
-{
- int status;
- int index;    /* Index for mail box informations access */
-
- /* Test function security */
-
- if (box_size == 0){
-  set_err (EINVAL);
-  return (0);
- }
-
- if (box_name == NULL) {
-  set_err (EFAULT);
-  return (0);
- }
-
- index = alloc_entry();               /* Find an entry for id_table */
- if (index == -1) {
-  set_err(EMFILE);
-  if (nb_mail == 0) keep_clean();
-  return(0);
- }
-
- id_table[index].size = box_size;              /* Keep size of mail box */
- strncpy(id_table[index].name,box_name,SIZEOFNAME);    /* Keep name of mail box */
-
- /* Attach shared memory to the process */
-
- status = open_sharedmemory ( (int **)&id_table[index].address, box_name,
-                       box_size);
-
- if (status !=0)
-
- if (get_pid (index) < 0){  /* Get pid from shared memory  */
-   set_err(ESRCH);
-   return (0);
- }
-
- id_table[index].channel = status;
-
- if (status != 0) {
-  return (index);    
- } 
- else {               /* Error */
-  id_table[index].address = NULL;    /* ensure pointer is empty */
-  keep_clean();
-  return(0);
- }
-}
-
-
-
-
-
-/*====================== Close a mail box =======================*/
-
-int
-remove_mailbox(int *boxid, char *box_name)
-{
- if (boxid == 0){
-  set_err(EINVAL);
-  return (0);
- }
-
- if (box_name == NULL) {
-  set_err(EFAULT);
-  return (0);
- }
-
-
-/*  (*boxid)--; JPT */
-
- nb_mail--;
-
- /* If last mail box removed, remove special shared memory */
-
- if (nb_mail == 0) keep_clean(); 
-
- remove_sharedmemory (&id_table[*boxid].channel, box_name );  /* Close shared memory */
- id_table[*boxid].address = NULL;
-
- return (1);
-}
-
-
-
-/*====================== Write into a mail box =======================*/
-
-int
-write_mailbox(int *boxid, char *box_name, char *message, int length)
-{
- int status;
-/* char * address;*/         /* Used for protocol  :  length   message */
- int * address;         /* Used for protocol  :  length   message */
- int  interm_length;     /* Used to copy length into shared memory */
-
- if (*boxid == 0){
-  set_err(EBADF);
-  return (0);
- }
-
- if (message == NULL) {
-  set_err(EFAULT);
-  return (0);
- }
-
- /* (*boxid)--; JPT */
-
- address = id_table[*boxid].address;
-
- address += sizeof(protocol); /* After the protocol JPT */
-
- interm_length = length; /* Use an intermediate variable for memcpy transfert */
-
- memcpy(address, &interm_length, sizeof(int));  /* Put length of message */
- address += sizeof(int);                        /* Adjust address for message */
-
- memcpy(address, message, length+1); /* Put message */
-
- memcpy(shared_infos, id_table[*boxid].name, SIZEOFNAME ); /* Give index in table infos */
-
- status = kill (pid, SIGUSR1);   /* Send signal to server */
-  if (status == 0) return (1);
-  else {
-   set_err(errno);
-   return (0);
-  }
-}
-#else
-
-// to avoid compiler warning on empty file
-#include "string.h"
-
-#endif
diff --git a/src/OSD/OSD_Csemaphore.c b/src/OSD/OSD_Csemaphore.c
deleted file mode 100644 (file)
index b6f1be1..0000000
+++ /dev/null
@@ -1,320 +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 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 WNT
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <errno.h>
-#include <stdio.h>
-
-#ifdef HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#ifdef HAVE_SYS_IPC_H
-#include <sys/ipc.h>
-#endif
-
-#ifdef HAVE_SYS_SEM_H
-# include <sys/sem.h>
-#endif
-
-#ifdef HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#ifdef HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-/* Modified by Stephan GARNAUD (ARM) 1992 for Matra Datavision */
-
-#if (!defined (__hpux)) && (!defined (HPUX))
-
-#define CLUSTER_NUMBER 4 
-#define SIGUSER SIGUSR1-1
-
-static struct sembuf event_flag ;
-        
-static void osd_signal_(int); 
-int osd_getkey(char *);
-#ifdef ANSI
-int create_semaphore(char *);
-int open_semaphore(char *);
-int lock_semaphore(int *,int *);
-int free_semaphore(int *,int *);
-int reset_semaphore(int *,int *);
-int remove_semaphore(int *,char *);
-int osd_signl_(int *);
-int osd_skill_(int *,int *);
-int osd_alarm_(int,void (*)());
-
-#endif
-
-static void
-osd_signal_(int i )
-{
-}
-
-
-int
-create_semaphore(char *name) 
-/*=======================================================
-
-       CREATE a semaphore cluster of 32 events
-
-=========================================================*/
-{
-int status ;
-
-
-
-    key_t key;
-
-
-        key = (key_t) osd_getkey (name);
-
-
-       status = semget(key,CLUSTER_NUMBER,0750 + IPC_CREAT) ;
-
-       if( status < 0 ) return (0) ;  /* semget failed */
-        return status ;
-}
-
-
-int
-open_semaphore(char *name)
-/*=========================================================
-
-       OPEN a semaphore cluster 
-
-=========================================================================*/
-{
-int status ;
-
-
-    key_t key;
-
-
-        key = (key_t) osd_getkey (name);
-       status = semget(key,0,0) ;
-
-       if( status < 0 ) return (0) ;  /* semget failed */
-         else   return status;
-}
-
-
-
-int
-lock_semaphore(int *semid, int *event) 
-/*==================================================
-
-       WAIT & LOCK the semaphore attached to the cluster
-
-====================================================*/
-{
-  int status ;
-
-  event_flag.sem_num = *event ;
-  event_flag.sem_op  = -1 ;
-  event_flag.sem_flg = SEM_UNDO;
-  
-  do 
-#if defined(SEMOP_NO_REFERENCE) && !defined(DECOSF1) 
-    status = semop(*semid,event_flag,1) ;
-#else 
-    status = semop(*semid,&event_flag,1) ;
-#endif
-  while ( status < 0 && errno != EINTR );
-  
-  if( status < 0 )
-    return (0) ;
-  else
-    return (1) ;
-}
-
-
-int
-free_semaphore(int *semid, int *event) 
-/*==================================================
-
-       FREE the semaphore attached to the cluster
-
-====================================================*/
-{
-  int status ;
-  int zero_value = 0;
-  
-  event_flag.sem_num = *event ;
-  event_flag.sem_op  = 1 ;
-  event_flag.sem_flg = IPC_NOWAIT ;
-
-#ifdef SEMCTL_NO_REFERENCE
-  status = semctl(*semid,*event,GETVAL,zero_value);
-#else 
-  status = semctl(*semid,*event,GETVAL,&zero_value);
-#endif
-  if (status !=1) 
-#if defined(SEMOP_NO_REFERENCE) && !defined(DECOSF1)
-    status = semop(*semid,event_flag,1) ;
-#else 
-    status = semop(*semid,&event_flag,1) ;
-#endif
-  else return 0;
-
-   if( status < 0 )
-    return (0) ;
-  else
-    return (1) ;
-}
-
-
-
-int
-reset_semaphore(int *semid, int *event) 
-/*===================================================
-
-      RESET semaphore to initial state
-
-======================================================*/
-{
- int status;
- int zero_value=0;
-
-#ifdef SEMCTL_NO_REFERENCE
- status = semctl(*semid,*event,SETVAL,zero_value);
-#else
- status = semctl(*semid,*event,SETVAL,&zero_value);
-#endif
- if (status < 0) return(0);
-            else return(1);
-
-}
-
-
-int
-set_semaphore(int *semid, int *event, int value) 
-/*=================================================
-
-      SET semaphore counter to a fixed value
-
-====================================================*/
-{
- int status;
-
-#ifdef SEMCTL_NO_REFERENCE
- status = semctl((*semid),*event,SETVAL,value);
-#else
- status = semctl((*semid),*event,SETVAL,&value);
-#endif
- if (status < 0) return(0);
-            else return(1);
-
-}
-
-
-int
-get_semaphore(int *semid, int *event, int *value)
-/*=================================================
-      GET semaphore counter value
-==========================================================================*/
-{
- int status;
-#ifdef SEMCTL_NO_REFERENCE
- status = semctl((*semid),*event,GETVAL,value);
-#else
- status = semctl((*semid),*event,GETVAL,&value);
-#endif
-
- if (status < 0) return(0);
-            else return(1);
-}
-
-
-
-int
-remove_semaphore(int *semid, char *name) 
-/*======================================================
-
-          CLOSE semaphore attached to cluster
-
-=============================================================================*/
-{
- int status;
-
-/*  status = semctl(*semid,IPC_RMID,NULL);*/
-  status = semctl(*semid,IPC_RMID,0);
-  if (status < 0) return 0;
-             else return 1;
-
-}
-
-
-int
-osd_signl_(int *event) 
-/*====================================================
-
-       ARM the SIGNAL event (Must be 1 or 2 )
-       And WAIT after it was KILLED
-
-=======================================================*/
-{
-       signal(SIGUSER + *event ,  osd_signal_) ;
-       pause() ;
-       return (1) ;
-}
-
-int
-osd_skill_(int *pid, int *event) 
-/*==================================================
-
-       SEND a SIGNAL to the PROCESS ID specified
-
- ====================================================*/
-{
-       if( kill( *pid , SIGUSER  + *event ) < 0 ) return (0) ;
-       return (1) ;
-}
-
-int
-osd_alarm_(int sec,RETSIGTYPE (*_alarm)())
-/*====================================================
-
-       ARM the SIGNAL event (Must be 1 or 2 )
-       And WAIT after it was KILLED
-       
-==========================================================================*/
-{
-  signal(SIGALRM, _alarm) ;
-  alarm(sec) ;
-  return (1) ;
-}
-
-#endif /* __hpux  */
-
-#else
-
-// to avoid compiler warning on empty file
-#include "string.h"
-
-#endif /* WNT  */
diff --git a/src/OSD/OSD_Csharedmemory.c b/src/OSD/OSD_Csharedmemory.c
deleted file mode 100644 (file)
index 68dda55..0000000
+++ /dev/null
@@ -1,122 +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 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 !defined( WNT ) && !defined(__hpux) && !defined( HPUX)
-#include <stdio.h>
-#include <sys/types.h>
-#include <sys/ipc.h>
-#include <sys/shm.h>
-
-#if defined(HAVE_CONFIG_H)
-#include "config.h"
-#endif
-#if defined(HAVE_STDLIB_H)
-#include <stdlib.h>
-#endif
-#if defined(HAVE_MALLOC_H)
-#include <malloc.h>
-#endif
-
-/* Modified by Stephan GARNAUD (ARM) 1992 for Matra Datavision */
-
-
-static int status ;
-
-/* #ifdef ANSI */
-int osd_getkey(char *) ;
-int create_sharedmemory (int **,char *,int);
-int open_sharedmemory   (int **,char *,int);
-int remove_sharedmemory (int * ,char *    );
-/* #endif */
-
-
-int create_sharedmemory(int **section, char *section_name, int section_size) 
-/*===============================
-
-       CREATE a mapping memory section
-
-        returns 0 if failed
-        otherwise successfull : the shared memory id 
-
-===============================================================*/
-{
-
-        key_t key;
-        key = (key_t) osd_getkey (section_name);
-
-       *section = NULL ;
-       status = shmget(        key,section_size,0750 + IPC_CREAT) ;
-
-       if( status < 0 ) return 0 ;  /* shmget failed */
-       else {
-             *section = (int*)shmat(status,NULL,0) ; /* shmat failed */
-
-             if( *section == (int*)-1 ) {
-                    *section = (int*)malloc(section_size) ;
-                    return 0 ;
-               }
-       }
-       return status;
-}
-
-
-int open_sharedmemory(int **section, char *section_name, int section_size) 
-/*=============================
-
-       OPEN a mapping memory section
-        We suppose that the shared memory segment is already
-        created(allocated)
-        Returns Value:
-             0 : If failed
-        otherwise successfull 
-================================================================*/
-{
-
-        key_t key;
-        key = (key_t) osd_getkey (section_name);
-
-       *section = NULL ;
-        /* Test if shared memory identified by "k" exists ? */
-       status = shmget( key,0,0) ;
-
-       if( status < 0 ) return 0;  /* shmget failed */
-
-        /* Try to attach the shared memory to the current process */
-        *section = (int*)shmat(status,NULL,0) ;
-
-       if( *section == (int*)-1 ) return 0; /* shmat failed */
-
-       return status ;
-}
-
-
-int remove_sharedmemory(int *shmid, char *section_name) 
-/*===========================================
-
-       CLOSE a mapping memory section
-
-========================================================*/
-{
-       status = shmctl(*shmid ,IPC_RMID,NULL) ;
-        if (status < 0) return 0;
-                   else return 1;
-}
-#else
-
-// to avoid compiler warning on empty file
-#include "string.h"
-
-#endif
old mode 100644 (file)
new mode 100755 (executable)
index ca566b3..abaf52c
@@ -18,29 +18,6 @@ class Error from OSD
 
    ---Purpose: Management of OSD errors
 
---  Error handling style example:
---
---
---  try{
---  .
---  .
---  .
---  OSD_Semaphore mysem("KeyName"); 
---  if (mysem.Failed()) 
---   switch (mysem.Error()){
---    case 201: mysem.Perror();
---    case 202: cout << "Just a warning";
---   }
---  .
---  .
---  .
---  }
---  catch(Standard_Failure){
---   Handle(Standard_Failure) Occur = Standard_Failure::Caught();
---   .
---   .  // Programmer's decision
---   .
---
 --  Each method can be error tested with object.Failed().
 --  To manage an occuring error, just use object.Perror(); 
 --
old mode 100644 (file)
new mode 100755 (executable)
index d22f702..100bfa8
@@ -66,10 +66,6 @@ void OSD_Error::Perror() {
       buffer += "Invalid file descriptor or bad mode";
       extCode = ERR_FBADF;
       break;
-     case OSD_WMailBox:
-      buffer += "Invalid mail box identification";
-      extCode = ERR_MBADF;
-      break;
     default:
       break;
     }
@@ -100,10 +96,6 @@ void OSD_Error::Perror() {
       buffer += "Invalid file descriptor";
       extCode = ERR_FINVAL;
       break;
-    case OSD_WMailBox :
-      buffer += "Internal error : invalid arguments";
-      extCode = ERR_MINVAL;
-      break;
     default :
       buffer += "User error : Bad parameter";
       extCode = ERR_INVAL;
@@ -178,12 +170,6 @@ void OSD_Error::Perror() {
      buffer += "Not enough or too many bytes written";
      extCode = ERR_FRANGE;
      break;
-    case OSD_WSemaphore:
-    case OSD_WSharedMemory:
-     buffer += "system overflow value.\n";
-     buffer += "Try to reconfigure Kernel with greater values";
-     extCode = ERR_RANGE;
-     break;
     default:
       break;
    }
@@ -198,11 +184,6 @@ void OSD_Error::Perror() {
      buffer += "Permission denied or can't unlink directory";
      extCode = ERR_FPERM;
      break;
-    case OSD_WMailBox :
-     buffer += "User error : processes using mail boxes must ";
-     buffer += "be\nused by the same user";
-     extCode = ERR_MPERM;
-     break;
     default : 
      buffer += "abnormal error : you modified OSD library";
      extCode = ERR_PERM;
@@ -327,10 +308,6 @@ void OSD_Error::Perror() {
      buffer += "Exceed process's file size limit or the maximum file size";
      extCode = ERR_FFBIG; 
      break;
-    case OSD_WSemaphore:
-     buffer += "Internal error : wrong number for this semaphore";
-     extCode = ERR_SFBIG;
-     break;
     default:
      break;
    }
@@ -339,10 +316,6 @@ void OSD_Error::Perror() {
    buffer += "operation breaked by a signal";
    extCode = ERR_INTR;
    break;
-  case EIDRM: 
-   buffer += "Semaphore externaly removed from system";
-   extCode = ERR_SIDRM;
-   break;
   case ENOMEM: 
    buffer += "Not enough memory";
    extCode = ERR_NOMEM;
@@ -353,15 +326,6 @@ void OSD_Error::Perror() {
        buffer += "Too many file descriptors are currently in use by this process";
        extCode = ERR_FMFILE;
        break;
-    case OSD_WMailBox :
-       buffer += "Too many mail boxes opened";
-       extCode = ERR_MMFILE;
-       break;
-    case OSD_WSharedMemory :
-       buffer += "The number of shared memory segments attached to the calling process \nwould exceed the system imposed limit.\n";
-       buffer += "Try to reconfigure Kernel with greater values";
-       extCode = ERR_SMMFILE;
-       break;
     default:
      break;
     }
@@ -403,11 +367,6 @@ void OSD_Error::Perror() {
      buffer += "A component of the path prefix of path does not exist";
      extCode = ERR_DNOENT;
      break;
-    case OSD_WSemaphore:
-    case OSD_WSharedMemory:
-     buffer += "User error : Has not been created";
-     extCode = ERR_SNOENT;
-     break;
     default:
      break;
     }
@@ -419,12 +378,6 @@ void OSD_Error::Perror() {
      buffer += "No more free space on file system";
      extCode = ERR_FNOSPC;
      break;
-    case OSD_WSharedMemory: {
-     buffer += "You exceed number of shared memory allowed.\n";
-     buffer += "Try to reconfigure Kernel with greater values";
-     extCode = ERR_SMNOSPC;
-     break;
-   }
     default:
      break;
    }
@@ -469,17 +422,6 @@ void OSD_Error::Perror() {
    buffer += "Reconfigure Kernel with greater values";
    extCode = ERR_TOOBIG;
    break;
-  case ESRCH  : 
-   switch (myCode){
-    case OSD_WMailBox :
-     buffer += "Server process is dead.\n";
-     buffer += "There is no more process to communicate with";
-     extCode = ERR_MSRCH;
-     break;
-    default:
-     break;
-    }
-    break;
    default: {
      Standard_Character buf[255];
      //
@@ -694,12 +636,6 @@ void OSD_Error :: Perror () {
 
    break;
 
-   case OSD_WSharedMemory:
-
-    ptr = TEXT( "OSD_SharedMemory" );
-
-   break;
-
    case OSD_WDisk:
 
     ptr = TEXT( "OSD_Disk" );
old mode 100644 (file)
new mode 100755 (executable)
index 733d420..89793f1
 #define ERR_FNNOTEMPTY  37
 #define ERR_FNXDEV      38
 
-// Class MailBox
-
-#define ERR_MBADF       40
-#define ERR_MINVAL      41
-#define ERR_MMFILE      42
-#define ERR_MPERM       43
-#define ERR_MSRCH       44
-
-// Class Semaphore
-
-#define ERR_SIDRM       45
-#define ERR_SFBIG       46
-
-// Class SharedMemory
-
-#define ERR_SMMFILE     47
-#define ERR_SMNOSPC     48
-#define ERR_SNOENT      49
-
 // Package
 #define ERR_PPERM       50
 
diff --git a/src/OSD/OSD_Getkey.c b/src/OSD/OSD_Getkey.c
deleted file mode 100644 (file)
index 07848c2..0000000
+++ /dev/null
@@ -1,28 +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 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.
-*/
-
-/* Returns a unique number according to the string passed as 1fst argument */ 
-int osd_getkey(char *name)
-{
-    int   ii = 0;
-    register  char *pp;
-
-        pp = name;
-        while( *pp ) ii = ii << 1 ^ *pp++;
-        if( ii < 0 ) ii = -ii;
-
-    return ii;
-}
diff --git a/src/OSD/OSD_MailBox.cdl b/src/OSD/OSD_MailBox.cdl
deleted file mode 100644 (file)
index 7ea496e..0000000
+++ /dev/null
@@ -1,116 +0,0 @@
--- Created on: 1992-03-19
--- 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 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 MailBox from OSD
-   
-   ---Purpose: Establishes a mailbox with VMS-like-features and with
-   --          asynchronous functions.
-   --          The mail boxes are used to communicate asynchronously
-   --          between processes.
-   --          Basically MailBox facilities provide tools to communicate
-   --          between a client process and a server process.
-   --          The client process puts data/requests into the mail-box and
-   --          the server process gets these data/requests. In this context 
-   --          client and server must run on the same machine. 
-   --  Warning: On VMS, you need TMPMBX privilege.
-
-   uses  Function, SharedMemory, Error, AsciiString from TCollection
-raises ConstructionError, NullObject, OSDError, ProgramError
-
-
-is
-  Create returns MailBox;
-    ---Purpose: To be used with 'Open'.
-    --          It just allocates room for 'myName'.
-    --          This is for a client process.
-    ---Level: Advanced
-
-  Create (name : AsciiString ; Size : Integer ; Async_function : Function) 
-    returns MailBox
-    ---Purpose: Instantiates MailBox object with a name, size required
-    --          and a function to read mail boxes asynchronously.
-    --          Each process working with the same MailBox must use
-    --          a common known access : the mail-box's name.
-    --
-    --          This is for a server process.
-    --          Raises ConstructionError when the name is not composed by
-    --          characters in range of ' ' .. '~'.
-    --          Raises NullObject when Async_function is a null function 
-    --          pointer
-    --          Raises ProgramError when Size has a negative or null value. 
-    ---Level: Advanced
-   raises ConstructionError, NullObject, ProgramError;
-
-  Build (me : in out) is static;
-   ---Purpose: Builds (physically) <me> into system.
-   --          <me> is created and ready to run.
-   --          This can be seen as an asynchronous server.
-   ---Level: Advanced
-
-  Open (me: out ; name : AsciiString ; Size : Integer)
-    ---Purpose: Opens mail box, and is ready to communicate with an 
-    --          already created mailbox.
-    --          Raises NullObject when the name is a null string.
-    --          Raises ConstructionError when the name contains characters not
-    --          in range of ' '...'~'.
-    --          Raises ProgramError when the mail box has a null size.
-    --          This can be seen as a client.
-    ---Level: Advanced
-   raises ConstructionError, NullObject, ProgramError is static;
-
-  Delete (me: out)
-    ---Purpose: Removes the mail box from system.
-    --          This is used only by server process !
-    --          Raises ProgramError when the mail box is already deleted.
-    ---Level: Advanced
-    raises ProgramError is static;
-
-  Write (me : in out; Message : AsciiString ; Length : Integer)
-    ---Purpose: Writes a message of specified length into mail box.
-    --          <Message> is used as a buffer, not as a common string.
-    --          So this can be not null terminated like a 'char *'.
-    --          This is why <Length> is useful.
-    --          Raises ProgramError when the length of the data is either
-    --          negative or zero.
-    --          
-    ---Level: Advanced
-    raises ProgramError is static;
-
-  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
-  myId   : Integer;  -- Mail box Identification
-  myName : AsciiString;   -- Name of mail box
-  mySize : Integer;  -- Size of data area
-  myFunc : Function; -- AST like function
-  myError: Error;
-end MailBox from OSD;
-
diff --git a/src/OSD/OSD_MailBox.cxx b/src/OSD/OSD_MailBox.cxx
deleted file mode 100644 (file)
index f67f8b7..0000000
+++ /dev/null
@@ -1,175 +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 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.
-
-#include <Standard_ProgramError.hxx>
-#include <Standard_NullObject.hxx>
-#include <Standard_ConstructionError.hxx>
-#if !defined( WNT ) && !defined(__hpux) && !defined(HPUX)
-#include <OSD_MailBox.ixx>
-#include <OSD_WhoAmI.hxx>
-
-#include <errno.h>
-
-const OSD_WhoAmI Iam = OSD_WMailBox;
-
-extern "C"{
-int create_mailbox(char *,int, int (*)(...));
-int open_mailbox(char *,int);
-int remove_mailbox(int *, char *);
-int write_mailbox(int *,char *,char *,int);
-}
-
-
-//====================== Create a mail box =========================
-
-OSD_MailBox::OSD_MailBox(){
-}
-
-
-
-//============== Create an instanciated mail box ===================
-
-OSD_MailBox::OSD_MailBox(const TCollection_AsciiString& box_name,
-                         const Standard_Integer         box_size,
-                         const OSD_Function&            async_function){
-
-
- if (!box_name.IsAscii())
-  Standard_ConstructionError::Raise("OSD_MailBox::OSD_MailBox : box_name");
-
- myName = box_name;
-
- if (box_size <= 0)
-  Standard_ProgramError::Raise("OSD_MailBox::OSD_MailBox : box_size");
- mySize = box_size;
-
- if (async_function == NULL)
-  Standard_NullObject::Raise("OSD_MailBox::OSD_MailBox : async_function");
- myFunc = async_function;
-
-}
-
-
-//=======================================================================
-//function : Build
-//purpose  : 
-//=======================================================================
-void OSD_MailBox::Build()
-{
-  Standard_PCharacter pStr;
-  pStr=(Standard_PCharacter)myName.ToCString();
-  myId = create_mailbox(pStr, (int)mySize, myFunc);
-  
-  if (myId == 0)
-    myError.SetValue (errno, Iam, "OSD_MailBox::Build");
-}
-
-//=======================================================================
-//function : Open
-//purpose  : 
-//=======================================================================
-void OSD_MailBox::Open ( const TCollection_AsciiString& box_name,
-                         const Standard_Integer box_size)
-{
-
- // Test function security 
-
- if (box_name == NULL)
-  Standard_NullObject::Raise("OSD_MailBox::Open : box_name");
-
- if (!box_name.IsAscii())
-  Standard_ConstructionError::Raise("OSD_MailBox::Open : box_name");
-
- myName = box_name;
-
- if (box_size <= 0)
-  Standard_ProgramError::Raise("OSD_MailBox::Open : box_size");
- mySize = box_size;
-
- Standard_PCharacter pStr;
- //
- pStr=(Standard_PCharacter)box_name.ToCString();
- myId = open_mailbox(pStr, (int)box_size );
- if (myId == 0)
-   myError.SetValue (errno, Iam, "OSD_MailBox::Open");
-  
-}
-
-
-
-
-
-//====================== Close a mail box =======================
-
-void OSD_MailBox::Delete ()
-{
- if (myError.Failed()) myError.Perror();
-
- if (myId == 0)
-  Standard_ProgramError::Raise("OSD_MailBox::Delete : mail box not opened/created");
-
- if (myName == NULL) 
-  Standard_ProgramError::Raise("OSD_MailBox::Delete : mail box not opened/created");
-
- Standard_PCharacter pStr;
- pStr=(Standard_PCharacter)myName.ToCString();
- if (remove_mailbox((int *)&myId, pStr) == 0)
-  myError.SetValue(errno, Iam, "OSD_MailBox::Delete");
-
- myId = 0;
-}
-
-
-
-//====================== Write into a mail box =======================
-
-void OSD_MailBox::Write(const TCollection_AsciiString& message,
-                        const Standard_Integer length)
-{
-
-
- if (length <= 0 || length > mySize) 
-  Standard_ProgramError::Raise("OSD_Mailbox::Write : bad length");
-
- Standard_PCharacter pStr, pStrM;
- //
- pStr=(Standard_PCharacter)myName.ToCString();
- pStrM=(Standard_PCharacter)message.ToCString();
- //
- if (write_mailbox((int *)&myId, pStr, pStrM, (int)length) == 0)
-  myError.SetValue(errno, Iam, "OSD_Mailbox::Write");
-}
-
-
-void OSD_MailBox::Reset(){
- myError.Reset();
-}
-
-Standard_Boolean OSD_MailBox::Failed()const{
- return( myError.Failed());
-}
-
-void OSD_MailBox::Perror() {
- myError.Perror();
-}
-
-
-Standard_Integer OSD_MailBox::Error()const{
- return( myError.Error());
-}
-#endif
-
-
-
diff --git a/src/OSD/OSD_Semaphore.cdl b/src/OSD/OSD_Semaphore.cdl
deleted file mode 100644 (file)
index 697bb7d..0000000
+++ /dev/null
@@ -1,119 +0,0 @@
--- Created on: 1992-04-21
--- 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 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 Semaphore from OSD
-   
-   ---Purpose: IPC Tools -Semaphores
-   --          The semaphores are used to facilitate shared resources.
-   --          This implementation provides a way to ensure mutual
-   --          exclusion using 'Lock' and 'Free' primitives.
-   --          The Lock is used to prevent access if it's not yet allowed.
-   --          The Free validates the semaphores and if possible, frees process
-   --          waiting for a common resource.
-
-   uses Protection, Error, AsciiString from TCollection
-raises ConstructionError,  OSDError, ProgramError
-
-
-is
-  Create returns Semaphore;
-    ---Purpose: Allocate room for semaphore name.
-    --          This is to be used with 'Open'.
-    --          so the process is a client.
-    ---Level: Advanced
-
-  Create (Name : AsciiString) returns Semaphore
-    ---Purpose: Instantiates Semaphore object with a name.
-    --          The name is the only way provided to work with a common
-    --          semaphore for different processes.
-    --          Each process working with the same semaphore must use
-    --          a common known access : the semaphore's NAME.
-    --          Raises ConstructionError when the name contains characters 
-    --          not in range of ' '...'~'.
-    --          This is for a server process.
-    ---Level: Advanced
-   raises ConstructionError;
-
-  Build (me : in out) is static;
-    ---Purpose: Sets semaphore (physically) into memory
-    ---Level: Advanced
-
-  Open (me : in out ; Name : AsciiString)
-    ---Purpose: Opens (physically) a semaphore
-    --          Raises ConstructionError when the name contains characters 
-    --          not in range of ' '...'~'.
-    ---Level: Advanced
-   raises ConstructionError is static;
-
-  GetCounter (me : in out) returns Integer is static;
-    ---Purpose: Returns current value of the semaphore's counter.
-    --          Raises ProgramError when the semaphore is not open.
-    ---Level: Advanced
-
-  SetCounter (me : in out; Value : Integer) is static;
-    ---Purpose: Sets the semaphore's counter to a specific value.
-    --          Raises ProgramError when the semaphore is not open.
-    ---Level: Advanced
-
-  Delete (me: out)
-    ---Purpose: Removes the semaphore.
-    --          This is used only by server process !
-    --          Raise ProgramError if the semaphore is already deleted.
-    ---Level: Advanced
-    raises ProgramError is static;
-
-  Lock (me: out)
-    ---Purpose: Makes current process waiting for access
-    --          Raises ProgramError when the semaphore does't exist.
-    ---Level: Advanced
-    raises ProgramError is static;
-
-  Free (me: out)
-    ---Purpose: Frees one access to a semaphore.
-    --          Raises ProgramError when the semaphore does't exist.
-    ---Level: Advanced
-    raises ProgramError is static;
-
-  Restore (me : in out)
-    ---Purpose: Resets semaphore counter to zero.
-    --          Raises ProgramError when the semaphore does't exist.
-    ---Level: Advanced
-    raises ProgramError is static;
-
- 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;      -- The semaphore name
-   myKey   : Integer;
-   mySemId : Integer;     -- Internal identification of semaphore
-   myError : Error;
-end Semaphore from OSD;
-
diff --git a/src/OSD/OSD_Semaphore.cxx b/src/OSD/OSD_Semaphore.cxx
deleted file mode 100644 (file)
index 5c99e2e..0000000
+++ /dev/null
@@ -1,320 +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 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 WNT
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <Standard_ProgramError.hxx>
-#include <Standard_NullObject.hxx>
-#include <Standard_ConstructionError.hxx>
-#include <OSD_Semaphore.ixx>
-#include <OSD_WhoAmI.hxx>
-
-
-const OSD_WhoAmI Iam = OSD_WSemaphore;
-
-#ifdef HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#include <errno.h>
-#include <stdio.h>
-
-#ifdef HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#ifdef HAVE_SYS_IPC_H
-# include <sys/ipc.h>
-#endif
-
-#ifdef HAVE_SYS_SEM_H
-# include <sys/sem.h>
-#endif
-
-#ifdef HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-#ifdef SEMUN_DEFINED
-/* union semun is defined by including <sys/sem.h> */
-#else
-/* according to X/OPEN we have to define it ourselves */
-union semun {
-  int val;                    /* value for SETVAL */
-  struct semid_ds *buf;       /* buffer for IPC_STAT, IPC_SET */
-  unsigned short int *array;  /* array for GETALL, SETALL */
-# ifdef SEMUN_BUF_DEFINED     /* union semun contains four members not three */
-  struct seminfo *__buf;      /* buffer for IPC_INFO */
-# endif
-};
-#endif
-
-
-extern "C" int osd_getkey(char *);
-
-// Remark :   ifdef DS3 means  use of DecStation under ULTRIX
-
-#define CLUSTER_NUMBER 4 
-
-static struct sembuf event_flag ;
-        
-OSD_Semaphore::OSD_Semaphore(){
- mySemId = -1;
- event_flag.sem_num = 0;
- event_flag.sem_op  = 0;
- event_flag.sem_flg = 0;
-}
-
-// ===============================================================
-OSD_Semaphore::OSD_Semaphore(const TCollection_AsciiString& Name) 
-
-// CREATE a semaphore cluster of 32 events =======================
-// ===============================================================
-
-
-{
- mySemId = -1;
- event_flag.sem_num = 0;
- event_flag.sem_op  = 0;
- event_flag.sem_flg = 0;
-
- if (!Name.IsAscii())
-  Standard_ConstructionError::Raise("OSD_Semaphore::OSD_Semaphore : name");
-
- myName = Name;
- Standard_PCharacter pStr;
- //
- pStr=(Standard_PCharacter)Name.ToCString();
- myKey = osd_getkey(pStr);
-}
-
-
-
-
-// ===============================================================
-void OSD_Semaphore::Build()
-// Set semaphore into system =====================================
-// ===============================================================
-{
- mySemId = semget((key_t) myKey,CLUSTER_NUMBER,0750 + IPC_CREAT) ;
- if (mySemId == -1) myError.SetValue(errno, Iam, "OSD_Semaphore::Build");
-}
-
-
-
-// ===============================================================
-void OSD_Semaphore::Open(const TCollection_AsciiString& Name) 
-//     OPEN a semaphore cluster ==================================
-// ===============================================================
-
-{
-
- if (!Name.IsAscii())
-  Standard_ConstructionError::Raise("OSD_Semaphore::Open");
-
- myName = Name;
- Standard_PCharacter pStr;
- //
- pStr=(Standard_PCharacter)Name.ToCString();
- myKey = osd_getkey(pStr);
-
- mySemId = semget((key_t) myKey,0,0) ;
-
- if (mySemId == -1) myError.SetValue(errno, Iam, "OSD_Semaphore::Open");
-}
-
-
-
-// ===============================================================
-void OSD_Semaphore::Lock() 
-//     WAIT & LOCK the semaphore attached to the cluster ========
-// ===============================================================
-
-
-{
- int status ;
- int event=0;
-
- if (myError.Failed()) myError.Perror();
-
- if (mySemId == -1)
-   Standard_ProgramError::Raise("OSD_Semaphore::Lock : semaphore not created");
-
- event_flag.sem_num = event ;
- event_flag.sem_op  = -1 ;
- event_flag.sem_flg = SEM_UNDO;
-
- status = semop((int)mySemId ,&event_flag,1) ;
-
- if (status == -1) myError.SetValue(errno, Iam, "Lock semaphore");
-}
-
-
-
-// ===============================================================
-void OSD_Semaphore::Free() 
-//     FREE the semaphore attached to the cluster ===============
-// ===============================================================
-
-{
-int status ;
-
- if (myError.Failed()) myError.Perror();
-
- if (mySemId == -1)
-   Standard_ProgramError::Raise("OSD_Semaphore::Free : semaphore not created");
-
- event_flag.sem_num = 0 ;
- event_flag.sem_op  = 1 ;
- event_flag.sem_flg = IPC_NOWAIT ;
-
- status=semop((int)mySemId ,&event_flag,1) ;
-
- if (status == -1) myError.SetValue(errno, Iam, "OSD_Semaphore::Free");
-}
-
-
-
-// ===============================================================
-void OSD_Semaphore::Restore()
-//      RESET semaphore to initial state =========================
-// ===============================================================
-
-
-{
- int status;
- int event=0;
- union semun zero_value;
-
- if (myError.Failed()) myError.Perror();
-
- if (mySemId == -1)
-   Standard_ProgramError::Raise("OSD_Semaphore::Restore : semaphore not created");
-
- zero_value.val = 0;
-
- status = semctl((int)mySemId ,event,SETVAL,zero_value);
-
- if (status == -1) myError.SetValue(errno, Iam, "OSD_Semaphore::Restore semaphore");
-}
-
-
-
-
-// ===============================================================
-void OSD_Semaphore::SetCounter(const Standard_Integer Value)
-//       Set internal Semaphore counter to desired Value =========
-// ===============================================================
-
-
-{
- int status;
- int event=0;
- union semun param_value;
-
- if (myError.Failed()) myError.Perror();
-
- if (mySemId == -1)
-   Standard_ProgramError::Raise("OSD_Semaphore::SetCounter : semaphore not created");
-
- param_value.val = (int)Value;
-
- status = semctl((int)mySemId ,event,SETVAL,param_value);
- if (status == -1) myError.SetValue(errno, Iam, "OSD_Semaphore::SetCounter semaphore");
-}
-
-
-
-// ===============================================================
-Standard_Integer OSD_Semaphore::GetCounter()
-//     Get value of semaphore counter ============================
-// ===============================================================
-
-{
- int status;
- int event=0;
- int Value; 
- union semun param_value;
-
- if (myError.Failed()) myError.Perror();
-
- if (mySemId == -1)
-   Standard_ProgramError::Raise("OSD_Semaphore::GetCounter : semaphore not created");
-
- param_value.array = (ushort *)&Value; 
- status = semctl((int)mySemId ,event,GETVAL,param_value);
-  
- if (status == -1)
-   myError.SetValue(errno, Iam, "OSD_Semaphore::GetCounter semaphore"); 
- return (Value);
-} 
-
-
-
-// ===============================================================
-void OSD_Semaphore::Delete() 
-//          CLOSE semaphore attached to cluster ==================
-// ===============================================================
-
-{
- int status;
- union semun param_value;
-
- if (myError.Failed()) myError.Perror();
-
- if (mySemId == -1)
-   Standard_ProgramError::Raise("OSD_Semaphore::Delete : semaphore not created");
-
-  param_value.array = NULL;
-  status = semctl((int)mySemId ,IPC_RMID, 0, param_value);
-
- if (status == -1) 
-   myError.SetValue(errno, Iam, "OSD_Semaphore::Delete semaphore");
- mySemId = -1;
-}
-
-
-
-// ===============================================================
-void OSD_Semaphore::Reset(){
-// ===============================================================
- myError.Reset();
-}
-
-// ===============================================================
-Standard_Boolean OSD_Semaphore::Failed()const{
-// ===============================================================
- return( myError.Failed());
-}
-
-// ===============================================================
-void OSD_Semaphore::Perror() {
-// ===============================================================
- myError.Perror();
-}
-
-
-// ===============================================================
-Standard_Integer OSD_Semaphore::Error()const{
-// ===============================================================
- return( myError.Error());
-}
-#endif
diff --git a/src/OSD/OSD_SharedMemory.cdl b/src/OSD/OSD_SharedMemory.cdl
deleted file mode 100644 (file)
index 009a56d..0000000
+++ /dev/null
@@ -1,100 +0,0 @@
--- Created on: 2021-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 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 SharedMemory from OSD 
-
-   ---Purpose: IPC Tools -Shared Memory
-   --          This is a low level interface for communications.
-   --          Using shared memory, processes can use a common area to
-   --          communicate.
-   --          You can create and delete a shared memory.
-
-uses Error, AsciiString from TCollection
-raises ConstructionError, NullObject, OSDError, ProgramError
-   
-
-is
-  Create returns SharedMemory;
-    ---Purpose: Allocates room for shared memory name.
-    --          This is to be used with 'Open'.
-    --          In this case, the process is a client of shared memory.
-    ---Level: Advanced
-
-  Create (Name : AsciiString ; size : Integer) returns SharedMemory
-    ---Purpose: Instantiates SharedMemory object with parameters.
-    --          A name to make sure shared memory is unique and a size in
-    --          bytes for the size of shared memory.
-    --
-    --          Raises ConstructionError when the name contains characters 
-    --          not in range of ' '...'~'.
-    --          Raises ProgramError when the size given is negative or null.
-    --          This is for a server process.
-    --          
-    ---Level: Advanced
-    raises ConstructionError, ProgramError;
-
-  Build (me : in out)  is static;
-    ---Purpose: Creates a shared memory in the system
-    --          This is for a server process.
-    ---Level: Advanced
-
-  Open (me : in out ; Name : AsciiString ; size : Integer)
-    ---Purpose: Opens a shared memory
-    --          Raises ConstructionError when the name contains characters 
-    --          not in range of ' '...'~'.
-    --          Raises ProgramError when the size given is negative or null.
-    --          This is for a server process.
-    --          
-    ---Level: Advanced
-    raises ConstructionError, ProgramError is static;
-
-  Delete (me : in out)
-    ---Purpose: Removes a shared memory access.
-    --          This is used only by a server process !
-    ---Level: Advanced
-    raises ProgramError is static;
-
-  GiveAddress (me) returns Address
-    ---Purpose: Returns address of shared memory.
-    --          Raises NullObject when the Shared Memory is not created.
-    ---Level: Advanced
-    raises NullObject is static;
-
-  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
-   myId : Integer;     -- Shared memory ID
-   myAddress    : Address;
-   myName : AsciiString;   
-   mySize : Integer;
-   myError : Error;
-end SharedMemory from OSD;
-
diff --git a/src/OSD/OSD_SharedMemory.cxx b/src/OSD/OSD_SharedMemory.cxx
deleted file mode 100644 (file)
index b54106b..0000000
+++ /dev/null
@@ -1,321 +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 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 WNT
-#if (!defined (__hpux )) && (!defined (HPUX))
-
-#include <Standard_ProgramError.hxx>
-#include <Standard_NullObject.hxx>
-#include <Standard_ConstructionError.hxx>
-#include <OSD_SharedMemory.ixx>
-#include <OSD_WhoAmI.hxx>
-
-#include <errno.h>
-
-const OSD_WhoAmI Iam = OSD_WSharedMemory;
-
-
-extern "C" int create_sharedmemory(int **,char *,int);
-extern "C" int open_sharedmemory(int **,char *,int);
-extern "C" int remove_sharedmemory(int *, char *);
-
-
-OSD_SharedMemory::OSD_SharedMemory(){
- myId = -1;
-}
-
-
-// ======================================================================
-OSD_SharedMemory::OSD_SharedMemory(const TCollection_AsciiString& Name,
-                                   const Standard_Integer Size) 
-//     CREATE a mapping memory object ==================================
-// ======================================================================
-
-
-{
- myId = -1;
- if (!Name.IsAscii())
-  Standard_ConstructionError::Raise("OSD_SharedMemory::OSD_SharedMemory: Name");
-
- myName = Name;
-
- if (Size <= 0)
-  Standard_ProgramError::Raise("OSD_SharedMemory::OSD_SharedMemory : invalid size");
-
- mySize = Size;
-}
-
-
-
-
-
-
-// ======================================================================
-void OSD_SharedMemory::Build()
-// ======================================================================
-{
-  Standard_PCharacter pStr;
-  //
-  pStr=(Standard_PCharacter)myName.ToCString();
-  myId = create_sharedmemory((int **)&myAddress, pStr, (int)mySize);
-  
-  if (myId == 0)
-    myError.SetValue (errno, Iam, "OSD_SharedMemory::Build");
-}
-
-
-
-
-// ======================================================================
-void OSD_SharedMemory::Open(const TCollection_AsciiString& Name,
-                            const Standard_Integer Size)
-// ======================================================================
-//     OPEN a mapping memory section
-//      We suppose that the shared memory segment is already
-//      created(allocated)
-
-{
-  if (!Name.IsAscii()) {
-    Standard_ConstructionError::Raise("OSD_SharedMemory::Open : Name");
-  }
-  myName = Name;
-
-  if (Size <= 0) {
-    Standard_ProgramError::Raise("OSD_SharedMemory::Open : invalid size");
-  }
-  mySize = Size;
-  //
-  Standard_PCharacter pStr;
-  //
-  pStr=(Standard_PCharacter)myName.ToCString();
-  myId = open_sharedmemory((int **)&myAddress, pStr, (int)mySize);
-  //
-  if (myId == 0) {
-    myError.SetValue (errno, Iam, "OSD_SharedMemory::Open");
-  }
-}
-
-// ======================================================================
-void OSD_SharedMemory::Delete() 
-// ======================================================================
-//     CLOSE a mapping memory section
-
-{
-  if (myError.Failed()) {
-    myError.Perror();
-  }
-  if (myId == -1) {
-    Standard_ProgramError::Raise("OSD_SharedMemory::Delete : shared memory not opened/created");
-  }
-  //
-  Standard_PCharacter pStr;
-  //
-  pStr=(Standard_PCharacter)myName.ToCString();
-  if (remove_sharedmemory((int *)&myId, pStr) == 0) {
-    myError.SetValue(errno, Iam, "OSD_SharedMemory::Delete");
-  }
-}
-
-
-// ======================================================================
-Standard_Address OSD_SharedMemory::GiveAddress()const{
-// ======================================================================
- if (myAddress == NULL)
-  Standard_NullObject::Raise("OSD_SharedMemory::Address : shared memory not opened/created");
- return(myAddress);
-}
-
-
-
-// ======================================================================
-void OSD_SharedMemory::Reset(){
-// ======================================================================
- myError.Reset();
-}
-
-// ======================================================================
-Standard_Boolean OSD_SharedMemory::Failed()const{
-// ======================================================================
- return( myError.Failed());
-}
-
-// ======================================================================
-void OSD_SharedMemory::Perror() {
-// ======================================================================
- myError.Perror();
-}
-
-
-// ======================================================================
-Standard_Integer OSD_SharedMemory::Error()const{
-// ======================================================================
- return( myError.Error());
-}
-
-#endif
-#else
-
-//------------------------------------------------------------------------
-//-------------------  Windows NT sources for OSD_SharedMemory- ----------
-//------------------------------------------------------------------------
-
-#define STRICT
-#include <windows.h>
-
-#include <OSD_SharedMemory.ixx>
-
-void _osd_wnt_set_error ( OSD_Error&, OSD_WhoAmI, ... );
-
-OSD_SharedMemory :: OSD_SharedMemory () {
-
- myId = 0;
-
-}  // end constructor ( 1 )
-
-OSD_SharedMemory :: OSD_SharedMemory (
-                     const TCollection_AsciiString& Name,
-                     const Standard_Integer         size
-                    ) {
-
- myName = Name;
-
- if ( size <= 0 )
-
-  Standard_ConstructionError :: Raise (
-                                 "OSD_SharedMemory :: OSD_SharedMemory : invalid size"
-                                );
-
- mySize = size;
-
-}  // end constructor ( 2 )
-
-void OSD_SharedMemory :: Build () {
-
- HANDLE hFileMapping = CreateFileMapping (
-                        ( HANDLE )0xFFFFFFFF, NULL, PAGE_READWRITE, 0, mySize,
-                        myName.ToCString ()
-                       );
-
- if (  hFileMapping == NULL || GetLastError () == ERROR_ALREADY_EXISTS  )
-  _osd_wnt_set_error ( myError, OSD_WSharedMemory ); 
- else {
-  myAddress = MapViewOfFile ( hFileMapping, FILE_MAP_ALL_ACCESS, 0, 0, 0 );
-
-  if ( myAddress == NULL )
-
-   _osd_wnt_set_error ( myError, OSD_WSharedMemory );
-
-  else
-
-   myId = ( Standard_Integer )hFileMapping;
-
- }  // end else
-
-}  // end OSD_SharedMemory :: Build
-
-void OSD_SharedMemory :: Open (
-                          const TCollection_AsciiString& Name,
-                          const Standard_Integer         size
-                         ) {
-
- myName = Name;
-
- if ( size <= 0 )
-
-  Standard_ProgramError :: Raise ( "OSD_SharedMemory :: Open : invalid size" );
-
- mySize = size;
-
- HANDLE hFileMapping = OpenFileMapping (
-                        FILE_MAP_ALL_ACCESS, FALSE, myName.ToCString ()
-                       );
-
- if ( hFileMapping == NULL )
-
-  _osd_wnt_set_error ( myError, OSD_WSharedMemory );
-
- else {
-  myAddress = MapViewOfFile ( hFileMapping, FILE_MAP_ALL_ACCESS, 0, 0, mySize );
-
-  if ( myAddress == NULL )
-   _osd_wnt_set_error ( myError, OSD_WSharedMemory );
-
-  else
-
-   myId = ( Standard_Integer )hFileMapping;
-
-  CloseHandle ( hFileMapping );
-
- }  // end else
-
-}  // end OSD_SharedMemory :: Open
-
-void OSD_SharedMemory :: Delete () {
-
- if (  Failed ()  ) Perror ();
-
- if ( myId == 0 )
-
-  Standard_ProgramError :: Raise (
-                            "OSD_SharedMemory :: Delete : shared memory not opened/created"
-                           );
-
- UnmapViewOfFile ( myAddress );
- CloseHandle (  ( HANDLE )myId  );
-
-}  // end OSD_SharedMemory :: Delete
-
-Standard_Address OSD_SharedMemory :: GiveAddress () const {
-
- if ( myAddress == NULL )
-
-  Standard_NullObject :: Raise (
-                          "OSD_SharedMemory :: Address : shared memory not opened/created"
-                         );
-
- return myAddress;
-
-}  // end OSD_SharedMemory :: GiveAddress
-
-Standard_Boolean OSD_SharedMemory :: Failed () const {
-
- return myError.Failed ();
-
-}  // end OSD_SharedMemory :: Failed
-
-void OSD_SharedMemory :: Reset () {
-
- myError.Reset ();
-
-}  // end OSD_SharedMemory :: Reset
-
-void OSD_SharedMemory :: Perror () {
-
- myError.Perror ();
-
-}  // end OSD_SharedMemory :: Perror
-
-Standard_Integer OSD_SharedMemory :: Error () const{
-
- return myError.Error ();
-
-}  // end OSD_SharedMemory :: Error
-
-#endif