diff --git a/src/Container/Component_i.cxx b/src/Container/Component_i.cxx index d7c79f340..d53ba6889 100644 --- a/src/Container/Component_i.cxx +++ b/src/Container/Component_i.cxx @@ -400,13 +400,18 @@ bool Engines_Component_i::Kill_impl() // << dec ) ; bool RetVal = false ; -#ifndef WIN32 +#if !defined(WIN32) && !defined(__APPLE__) if ( _ThreadId > 0 && pthread_self() != _ThreadId ) { RetVal = Killer( _ThreadId , SIGUSR2 ) ; _ThreadId = (pthread_t ) -1 ; } - +#elif defined(__APPLE__) + if ( _ThreadId && !pthread_equal(pthread_self(), _ThreadId )) + { + RetVal = Killer( _ThreadId , SIGUSR2 ) ; + _ThreadId = (pthread_t ) -1 ; + } #else if ( _ThreadId > 0 && pthread_self().p != _ThreadId->p ) { @@ -442,12 +447,18 @@ bool Engines_Component_i::Stop_impl() bool RetVal = false ; -#ifndef WIN32 +#if !defined(WIN32) && !defined(__APPLE__) if ( _ThreadId > 0 && pthread_self() != _ThreadId ) { RetVal = Killer( _ThreadId , 0 ) ; _ThreadId = (pthread_t ) -1 ; } +#elif defined(__APPLE__) + if ( _ThreadId && !pthread_equal(pthread_self(), _ThreadId )) + { + RetVal = Killer( _ThreadId , 0 ) ; + _ThreadId = (pthread_t ) -1 ; + } #else if ( _ThreadId > 0 && pthread_self().p != _ThreadId->p ) { @@ -481,8 +492,10 @@ bool Engines_Component_i::Suspend_impl() #endif bool RetVal = false ; -#ifndef WIN32 +#if !defined(WIN32) && !defined(__APPLE__) if ( _ThreadId > 0 && pthread_self() != _ThreadId ) +#elif defined(__APPLE__) + if ( _ThreadId && !pthread_equal(pthread_self(), _ThreadId )) #else if ( _ThreadId > 0 && pthread_self().p != _ThreadId->p ) #endif @@ -527,8 +540,10 @@ bool Engines_Component_i::Resume_impl() << std::dec << " _ThreadId " << _ThreadId ); #endif bool RetVal = false ; -#ifndef WIN32 +#if !defined(WIN32) && !defined(__APPLE__) if ( _ThreadId > 0 && pthread_self() != _ThreadId ) +#elif defined(__APPLE__) + if ( _ThreadId && !pthread_equal(pthread_self(), _ThreadId )) #else if ( _ThreadId > 0 && pthread_self().p != _ThreadId->p ) #endif @@ -557,7 +572,7 @@ CORBA::Long Engines_Component_i::CpuUsed_impl() long cpu = 0 ; if ( _ThreadId || _Executed ) { - if ( _ThreadId > 0 ) + if ( _ThreadId ) { #ifndef WIN32 if ( pthread_self() != _ThreadId ) diff --git a/src/Container/Container_i.cxx b/src/Container/Container_i.cxx index fc989c6f2..07b4416ab 100644 --- a/src/Container/Container_i.cxx +++ b/src/Container/Container_i.cxx @@ -47,6 +47,11 @@ int SIGUSR1 = 1000; #endif +#if defined(__APPLE__) +#include +#define environ (*_NSGetEnviron()) +#endif + #include "utilities.h" #include #include CORBA_SERVER_HEADER(SALOME_Component) diff --git a/src/DSC/CMakeLists.txt b/src/DSC/CMakeLists.txt index 9d7372e3a..17a04bb2d 100644 --- a/src/DSC/CMakeLists.txt +++ b/src/DSC/CMakeLists.txt @@ -22,9 +22,9 @@ SET(SUBDIRS_COMMON ) IF(NOT WIN32) - SET(SUBDIRS_ADD - DSC_User + SET(SUBDIRS_ADD DSC_Python + DSC_User ) ENDIF() diff --git a/src/DSC/DSC_Python/calcium.i b/src/DSC/DSC_Python/calcium.i index d31582711..df10b508b 100644 --- a/src/DSC/DSC_Python/calcium.i +++ b/src/DSC/DSC_Python/calcium.i @@ -42,6 +42,10 @@ omniORBpyAPI* api=0; PyObject* dsc ; +#if PY_VERSION_HEX >= 0x030C0000 /* Python 3.12.0 */ + #define PyEval_CallObject(func, arg) PyObject_CallObject(func, arg) +#endif + %} %init @@ -92,7 +96,25 @@ typedef PyArrayObject ArrayObject; /* Macros to extract array attributes. */ #define is_array(a) ((a) && PyArray_Check((PyArrayObject *)a)) +#ifdef __APPLE__ + // Fix NumPy >= 1.24 C-API strict typing + #ifndef PyArray_TYPE + #include + #endif + #define array_type(a) (int)(PyArray_TYPE((PyArrayObject*)(a))) + #ifndef PyArray_NOTYPE + #define PyArray_NOTYPE NPY_NOTYPE + #endif + #define PyArray_INT NPY_INT + #define PyArray_LONG NPY_LONG + #define PyArray_DOUBLE NPY_DOUBLE + #define PyArray_FLOAT NPY_FLOAT + #define PyArray_STRING NPY_STRING + #define PyArray_CFLOAT NPY_CFLOAT +#else #define array_type(a) (int)(PyArray_TYPE(a)) +#endif + #define array_dimensions(a) (((PyArrayObject *)a)->nd) #define array_size(a,i) (((PyArrayObject *)a)->dimensions[i]) #define array_is_contiguous(a) (PyArray_ISCONTIGUOUS(a)) diff --git a/src/DSC/DSC_User/Datastream/Calcium/CalciumC.c b/src/DSC/DSC_User/Datastream/Calcium/CalciumC.c index 5fdc9f47e..a1117c0f5 100644 --- a/src/DSC/DSC_User/Datastream/Calcium/CalciumC.c +++ b/src/DSC/DSC_User/Datastream/Calcium/CalciumC.c @@ -38,21 +38,56 @@ typedef int InfoType; typedef char bool; //TODO: ajouter les prototypes pour eviter les pbs de passage par valeur +InfoType ecp_fin_ (void * component, int code) ; +InfoType ecp_cd_ (void * component, char * instanceName); InfoType ecp_fint_ (void * component, char* nomVar, float t); InfoType ecp_fini_ (void * component, char* nomVar, int i); InfoType ecp_efft_ (void * component, char* nomVar, float t); InfoType ecp_effi_ (void * component, char* nomVar, int i); +#define CALCIUM_C2CPP_INTERFACE_CXX_PROTO(_name,porttype,_type,_qual) \ + InfoType ecp_lecture_##_name (void * component, int dependencyType, \ + _type _qual * ti, \ + _type _qual * tf, long * i, \ + const char * const nomvar, size_t bufferLength, \ + size_t * nRead, _type _qual ** data ) ; \ + void ecp_lecture_##_name##_free ( _type _qual * data); \ + \ + \ + InfoType ecp_ecriture_##_name (void * component, int dependencyType, \ + _type _qual *t, \ + long i, \ + const char * const nomvar, size_t bufferLength, \ + _type _qual * data ); \ + + +CALCIUM_C2CPP_INTERFACE_CXX_PROTO(intc,int,int,) +CALCIUM_C2CPP_INTERFACE_CXX_PROTO(long,long,long,) + +CALCIUM_C2CPP_INTERFACE_CXX_PROTO(integer,integer,cal_int,) +CALCIUM_C2CPP_INTERFACE_CXX_PROTO(int2integer ,integer, int,) +CALCIUM_C2CPP_INTERFACE_CXX_PROTO(long2integer, integer, long,) + +CALCIUM_C2CPP_INTERFACE_CXX_PROTO(float,float,float, ) +CALCIUM_C2CPP_INTERFACE_CXX_PROTO(double,double,double,) + +CALCIUM_C2CPP_INTERFACE_CXX_PROTO(float2double,double,float, ) + +/* Fonnctionne mais essai suivant pour simplification de Calcium.c CALCIUM_C2CPP_INTERFACE_(bool,bool,);*/ +CALCIUM_C2CPP_INTERFACE_CXX_PROTO(bool,bool,int,) +CALCIUM_C2CPP_INTERFACE_CXX_PROTO(cplx,cplx,float,) +CALCIUM_C2CPP_INTERFACE_CXX_PROTO(str,str,char*,) + /************************************/ /* INTERFACES DE LECTURE EN 0 COPIE */ /************************************/ -/* Definition des méthodes calcium étendues en 0 copie */ -/* Le buffer est alloué par le port pas par l'utilisateur */ +/* Definition des m�thodes calcium �tendues en 0 copie */ +/* Le buffer est allou� par le port pas par l'utilisateur */ /* Remarquer le type ** de data */ -/* L'utilisateur devra appeler ecp_..._free pour désallouer le buffer interne */ -/* Attention en cas de lectures multiples : le buffer retourné est le même */ -/* Attention si les niveaux sont actifs le buffer peut être supprimé automatiquement par calcium. */ +/* L'utilisateur devra appeler ecp_..._free pour d�sallouer le buffer interne */ +/* Attention en cas de lectures multiples : le buffer retourn� est le m�me */ +/* Attention si les niveaux sont actifs le buffer peut �tre supprim� automatiquement par calcium. */ #define CALCIUM_EXT_LECT_INTERFACE_C_(_name,_timeType,_type,_typeName,_qual) \ InfoType ecp_##_name (void * component, int mode, \ @@ -86,10 +121,10 @@ InfoType ecp_effi_ (void * component, char* nomVar, int i); } -/* L'interface de cette routine diffère de celle obtenue par la macro : +/* L'interface de cette routine diff�re de celle obtenue par la macro : CALCIUM_LECT_INTERFACE_C_. - Le paramètre supplémentaire strSize indique la taille fixe et identique - des chaînes stockées dans data (les ports CALCIUM n'en n'ont pas besoin) + Le param�tre suppl�mentaire strSize indique la taille fixe et identique + des cha�nes stock�es dans data (les ports CALCIUM n'en n'ont pas besoin) */ InfoType ecp_lch(void * component, int mode, float * ti, float * tf, int * i, char * nomvar, int bufferLength, int * nRead, @@ -104,7 +139,7 @@ InfoType ecp_lch(void * component, int mode, float * ti, float * tf, int nomvar, bufferLength, &_nRead, data);/*, strSize ); strSize est inutile pour les ports CALCIUM - qui gèrent des tailles quelconques de chaines. */ + qui g�rent des tailles quelconques de chaines. */ if(mode == CP_SEQUENTIEL) *i = _i; *nRead=_nRead; @@ -121,7 +156,7 @@ void ecp_lch_free (char* * data) { \ /*REVERIFIER MAINTENANT 0 COPY avec int2integer*/ CALCIUM_EXT_LECT_INTERFACE_C_(len,float,int,int2integer,) CALCIUM_EXT_LECT_INTERFACE_C_(lre,float,float,float,) -/*Permet d'envoyer/recevoir des réels sur un port Double */ +/*Permet d'envoyer/recevoir des r�els sur un port Double */ CALCIUM_EXT_LECT_INTERFACE_C_(lrd,float ,float ,float2double,) CALCIUM_EXT_LECT_INTERFACE_C_(ldb,double,double,double,) @@ -167,10 +202,10 @@ CALCIUM_EXT_LECT_INTERFACE_C_(lcp,float,float,cplx,) } -/* L'interface de cette routine diffère de celle obtenue par la macro : +/* L'interface de cette routine diff�re de celle obtenue par la macro : CALCIUM_LECT_INTERFACE_C_. - Le paramètre supplémentaire strSize indique la taille fixe et identique - des chaînes stockées dans data (les ports CALCIUM n'en n'ont pas besoin) + Le param�tre suppl�mentaire strSize indique la taille fixe et identique + des cha�nes stock�es dans data (les ports CALCIUM n'en n'ont pas besoin) */ /* InfoType cp_lch(void * component, int mode, float * ti, float * tf, int * i, */ @@ -187,7 +222,7 @@ CALCIUM_EXT_LECT_INTERFACE_C_(lcp,float,float,cplx,) /* &data);*/ /*, strSize ); */ /* strSize est inutile pour les ports CALCIUM */ -/* qui gèrent des tailles quelconques de chaines. */ +/* qui g�rent des tailles quelconques de chaines. */ /* if(mode == CP_SEQUENTIEL) */ /* *i = _i; */ /* *nRead=_nRead; */ @@ -197,19 +232,19 @@ CALCIUM_EXT_LECT_INTERFACE_C_(lcp,float,float,cplx,) /* }; */ -/* Definition des méthodes calcium standard */ -/* CALCIUM_LECT_INTERFACE_C_( , , , - , , ,)*/ +/* Definition des m�thodes calcium standard */ +/* CALCIUM_LECT_INTERFACE_C_( , , , + , , ,)*/ CALCIUM_LECT_INTERFACE_C_(len,float ,int,int ,int2integer,,) /*llg ne fonctionnera pas toujours correctement (port calcium_integer) si sizeof(long) == 64 bits && cal_int==int (32 bits) - sinon problème de conversion de 64bits vers 32bits */ + sinon probl�me de conversion de 64bits vers 32bits */ CALCIUM_LECT_INTERFACE_C_(llg,float ,int,long ,long2integer,,) CALCIUM_LECT_INTERFACE_C_(lln,float ,int,long ,long,,) CALCIUM_LECT_INTERFACE_C_(lre,float ,int,float ,float,,) -/*Permet d'envoyer/recevoir des réels sur un port Double */ +/*Permet d'envoyer/recevoir des r�els sur un port Double */ CALCIUM_LECT_INTERFACE_C_(lrd,float ,int,float ,float2double,,) CALCIUM_LECT_INTERFACE_C_(ldb,double,int,double ,double,,) @@ -220,13 +255,13 @@ CALCIUM_LECT_INTERFACE_C_(lcp,float ,int,float ,cplx,,) CALCIUM_LECT_INTERFACE_C_(lch,float ,int,char ,str,STAR, LCH_LAST_PARAM ) -/* Definition des méthodes calcium destinées à l'interfaçage fortran - avec une taille des INTEGER fortran paramétrés à la configuration du KERNEL */ +/* Definition des m�thodes calcium destin�es � l'interfa�age fortran + avec une taille des INTEGER fortran param�tr�s � la configuration du KERNEL */ CALCIUM_LECT_INTERFACE_C_(len_fort_,float ,cal_int,cal_int ,integer,,) CALCIUM_LECT_INTERFACE_C_(lin_fort_,float ,cal_int,int ,int2integer,,) /*llg_fort_ ne fonctionnera pas toujours correctement (port calcium_integer) si sizeof(long) == 64 bits && cal_int==int (32 bits) - sinon problème de conversion de 64bits vers 32bits */ + sinon probl�me de conversion de 64bits vers 32bits */ CALCIUM_LECT_INTERFACE_C_(llg_fort_,float ,cal_int,long ,long2integer,,) CALCIUM_LECT_INTERFACE_C_(lre_fort_,float ,cal_int,float ,float,,) @@ -239,7 +274,7 @@ CALCIUM_LECT_INTERFACE_C_(lch_fort_,float ,cal_int,char ,str,STAR, LCH_LAST_P CALCIUM_LECT_INTERFACE_C_(lln_fort_,float ,cal_int,long ,long,,) /**********************************************/ -/* INTERFACES DE DÉBUT ET DE FIN DE COUPLAGE */ +/* INTERFACES DE D�BUT ET DE FIN DE COUPLAGE */ /**********************************************/ InfoType cp_cd (void * component, char * instanceName) { @@ -248,7 +283,7 @@ InfoType cp_cd (void * component, char * instanceName) { } InfoType cp_fin (void * component, int code) { - /* TODO : gérer avec les callbacks des ports DSC */ + /* TODO : g�rer avec les callbacks des ports DSC */ InfoType info = ecp_fin_(component,code); @@ -307,14 +342,14 @@ InfoType cp_fin (void * component, int code) { /* return info; */ /* }; */ -/* Definition des méthodes calcium standard */ +/* Definition des m�thodes calcium standard */ /* CALCIUM_ECR_INTERFACE_C_(_name,_timeType,_calInt,type,_typeName,_qual) */ CALCIUM_ECR_INTERFACE_C_(een,float ,int,int ,int2integer,,) /*elg ne fonctionnera pas toujours correctement (port calcium_integer) si sizeof(long) == 64 bits && cal_int==int (32 bits) - sinon problème de conversion de 64bits vers 32bits */ + sinon probl�me de conversion de 64bits vers 32bits */ CALCIUM_ECR_INTERFACE_C_(elg,float ,int,long ,long2integer,,) CALCIUM_ECR_INTERFACE_C_(ere,float ,int,float ,float,,) -/*Permet d'envoyer/recevoir des réels sur un port Double */ +/*Permet d'envoyer/recevoir des r�els sur un port Double */ CALCIUM_ECR_INTERFACE_C_(erd,float ,int,float ,float2double,,) CALCIUM_ECR_INTERFACE_C_(edb,double,int,double,double,,) @@ -324,12 +359,12 @@ CALCIUM_ECR_INTERFACE_C_(ech,float ,int,char ,str,STAR,LCH_LAST_PARAM ) CALCIUM_ECR_INTERFACE_C_(eln,float ,int,long ,long,,) -/* Definition des méthodes calcium destinées à l'interfaçage fortran - avec une taille des INTEGER fortran paramétrés à la configuration du KERNEL */ +/* Definition des m�thodes calcium destin�es � l'interfa�age fortran + avec une taille des INTEGER fortran param�tr�s � la configuration du KERNEL */ CALCIUM_ECR_INTERFACE_C_(een_fort_,float ,cal_int,cal_int,integer,,) /*elg_fort_ ne fonctionnera pas toujours correctement (port calcium_integer) si sizeof(long) == 64 bits && cal_int==int (32 bits) - sinon problème de conversion de 64bits vers 32bits */ + sinon probl�me de conversion de 64bits vers 32bits */ CALCIUM_ECR_INTERFACE_C_(elg_fort_,float ,cal_int,long ,long2integer,,) CALCIUM_ECR_INTERFACE_C_(ein_fort_,float ,cal_int,int ,int2integer,,) CALCIUM_ECR_INTERFACE_C_(ere_fort_,float ,cal_int,float ,float,,) diff --git a/src/Launcher/SALOME_ExternalServerLauncher.cxx b/src/Launcher/SALOME_ExternalServerLauncher.cxx index d28aa22ad..0a18654aa 100644 --- a/src/Launcher/SALOME_ExternalServerLauncher.cxx +++ b/src/Launcher/SALOME_ExternalServerLauncher.cxx @@ -34,6 +34,16 @@ #include #endif +#if defined(__APPLE__) +char* get_current_dir_name(){ + char* cwd = getcwd(nullptr, 0); + if(cwd==nullptr){ + perror("getcwd"); + } + return cwd; +} +#endif + #include #include #include diff --git a/src/Launcher_SWIG/Launcher.i b/src/Launcher_SWIG/Launcher.i index bd288fb94..0656f330a 100644 --- a/src/Launcher_SWIG/Launcher.i +++ b/src/Launcher_SWIG/Launcher.i @@ -112,7 +112,7 @@ public: { try { - $function + $action } catch (ResourcesException& e) { @@ -186,7 +186,7 @@ public: { try { - $function + $action } catch (LauncherException& e) { diff --git a/src/TestContainer/CMakeLists.txt b/src/TestContainer/CMakeLists.txt index 734ff4e22..b5d9600bd 100755 --- a/src/TestContainer/CMakeLists.txt +++ b/src/TestContainer/CMakeLists.txt @@ -51,17 +51,31 @@ IF(WIN32) Registry SalomeNotification SalomeResourcesManager - SalomeNS + SalomeNS SALOMELocalTrace SalomeGenericObj SalomeIDLKernel SalomeTestComponentEngine ) ENDIF(WIN32) +IF(APPLE) + LIST (APPEND COMMON_LIBS + ArgvKeeper + SalomeContainer + Registry + SalomeNotification + SalomeResourcesManager + SalomeNS + SALOMELocalTrace + SalomeGenericObj + SalomeIDLKernel + ) +ENDIF(WIN32) + ADD_DEFINITIONS(${OMNIORB_DEFINITIONS}) ADD_LIBRARY(SalomeTestComponentEngine ${SalomeTestComponentEngine_SOURCES}) -TARGET_LINK_LIBRARIES(SalomeTestComponentEngine ${COMMON_LIBS}) +TARGET_LINK_LIBRARIES(SalomeTestComponentEngine ${COMMON_LIBS} ${OMNIORB_LIBRARIES}) INSTALL(TARGETS SalomeTestComponentEngine EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_LIBS})