# Testing linker
AC_LINKER_OPTIONS
+echo
+echo ---------------------------------------------
+echo testing Fortran INTEGER size for CALCIUM
+echo ---------------------------------------------
+echo
+
+CHECK_CALCIUM
+
echo
echo ---------------------------------------------
echo testing threads
./doc/salome/gui/Makefile \
./doc/salome/gui/doxyfile \
./idl/Makefile \
+ ./idl/Calcium_Ports.idl \
./resources/Makefile \
./resources/KERNELCatalog.xml \
./resources/CatalogResources.xml \
./src/DSC/DSC_User/Datastream/Makefile \
./src/DSC/DSC_User/Datastream/Palm/Makefile \
./src/DSC/DSC_User/Datastream/Calcium/Makefile \
+ ./src/DSC/DSC_User/Datastream/Calcium/calcium_integer_port_uses.hxx \
+ ./src/DSC/DSC_User/Datastream/Calcium/CalciumProvidesPort.hxx \
+ ./src/DSC/DSC_User/Datastream/Calcium/CalciumFortranInt.h \
./src/DSC/ParallelDSC/Makefile \
./src/DSC/DSC_Python/Makefile \
./src/GenericObj/Makefile \
--- /dev/null
+// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// File : SALOME_Ports.idl
+// Author : Eric Fayolle, EDF
+//
+#ifndef _CALCIUM_PORTS_IDL_
+#define _CALCIUM_PORTS_IDL_
+
+#include "SALOME_Ports.idl"
+
+module Ports {
+
+ module Calcium_Ports {
+
+ const long UNLIMITED_STORAGE_LEVEL = -70;
+ enum DependencyType { UNDEFINED_DEPENDENCY, TIME_DEPENDENCY, ITERATION_DEPENDENCY };
+ enum DateCalSchem { TI_SCHEM, TF_SCHEM , ALPHA_SCHEM};
+ enum InterpolationSchem { L0_SCHEM, L1_SCHEM };
+ enum ExtrapolationSchem { UNDEFINED_EXTRA_SCHEM, E0_SCHEM, E1_SCHEM};
+
+ // enum DisconnectDirective {UNDEFINED_DIRECTIVE,CONTINUE,STOP};
+ typedef boolean DisconnectDirective;
+ const DisconnectDirective stop = FALSE;
+ const DisconnectDirective cont = TRUE;
+
+ interface Calcium_Port : Ports::Data_Port, Ports::PortProperties {
+ void disconnect(in DisconnectDirective mode);
+ };
+
+ typedef sequence<long> seq_long;
+ typedef sequence<long long> seq_long_long;
+ typedef sequence< @CALCIUM_IDL_INT_F77@ > seq_integer;
+
+ typedef sequence<float> seq_float;
+ typedef sequence<double> seq_double;
+ typedef sequence<string> seq_string;
+ typedef sequence<boolean> seq_boolean;
+ typedef seq_float seq_complex;
+
+ //Fortran int size conforming port
+ interface Calcium_Integer_Port : Calcium_Port {
+ void put (in seq_integer data, in double time, in long tag);
+ };
+
+ interface Calcium_Intc_Port : Calcium_Port {
+ void put (in seq_long data, in double time, in long tag);
+ };
+
+ interface Calcium_Long_Port : Calcium_Port {
+ void put (in seq_long_long data, in double time, in long tag);
+ };
+
+
+ interface Calcium_Real_Port : Calcium_Port {
+ void put (in seq_float data, in double time, in long tag);
+ };
+
+ interface Calcium_Double_Port : Calcium_Port {
+ void put (in seq_double data, in double time, in long tag);
+ };
+
+ interface Calcium_String_Port : Calcium_Port {
+ void put (in seq_string data, in double time, in long tag);
+ };
+
+ interface Calcium_Logical_Port : Calcium_Port {
+ void put (in seq_boolean data, in double time, in long tag);
+ };
+
+ interface Calcium_Complex_Port : Calcium_Port {
+ void put (in seq_complex data, in double time, in long tag);
+ };
+
+ };
+};
+
+#endif
nstest.idl \
DSC_Engines.idl \
SALOME_Ports.idl \
- Calcium_Ports.idl \
Palm_Ports.idl \
SALOME_PACOExtension.idl \
SALOME_ParamPorts.idl
SALOME_PACOExtension.xml SALOME_ParamPorts.xml
# This variable defines the files to be installed
-salomeidl_DATA = $(IDL_FILES)
+salomeidl_DATA = $(IDL_FILES)
+nodist_salomeidl_DATA = Calcium_Ports.idl
# Sources built from idl files
# BUILT_SOURCE = first thing done on make all
endif
idldir = $(prefix)/idl/salome
-nodist_idl_DATA = ${XML} ${IDL_PACO}
-nodist_salomeinclude_HEADERS = ${INCLUDES_PACO}
+nodist_idl_DATA = ${XML} ${IDL_PACO} Calcium_Ports.idl
+nodist_salomeinclude_HEADERS = ${INCLUDES_PACO}
BUILT_SOURCES = $(IDL_SOURCES) $(PAR) $(PAR_INCLUDES)
# These variables defines the building process of CORBA files
OMNIORB_IDL = @OMNIORB_IDL@
-OMNIORB_IDLCXXFLAGS = @OMNIORB_IDLCXXFLAGS@
+OMNIORB_IDLCXXFLAGS = @OMNIORB_IDLCXXFLAGS@ -I$(srcdir)
OMNIORB_IDLPYFLAGS = @OMNIORB_IDLPYFLAGS@ -I$(top_builddir)/salome/idl
IDLCXXFLAGS = -bcxx @IDLCXXFLAGS@ -Wba -I$(top_builddir)/salome/idl
IDLPYFLAGS = @IDLPYFLAGS@
rm -rf $(DESTDIR)$(salomepythondir)/*
mostlyclean-local:
- -rm -f *.hh *.cc .depidl
+ -rm -f *.hh *.cc .depidl Calcium_Ports.idl
# we use cpp to generate dependencies between idl files.
# option x c tells the preprocessor to consider idl as a c file.
# if an idl is modified, all idl dependencies are rebuilt
-.depidl: $(IDL_FILES)
+.depidl: $(IDL_FILES) Calcium_Ports.idl
@echo "" > $@
@for dep in $^ dummy; do \
if [ $$dep != "dummy" ]; then \
-include .depidl
-CLEANFILES = *PaCO* *.hxx *.cxx
+CLEANFILES = *PaCO* *.hxx *.cxx Calcium_Ports.idl
+
ac_cxx_use_std_iostream.m4 \
ac_cxx_warnings.m4 \
ac_linker_options.m4 \
+ac_check_sizeof_fortran.m4 \
acx_pthread.m4 \
check_Kernel.m4 \
check_boost.m4 \
check_corba.m4 \
check_cppunit.m4 \
check_f77.m4 \
+check_calcium.m4 \
check_hdf5.m4 \
check_htmlgen.m4 \
check_lam.m4 \
--- /dev/null
+AC_DEFUN([AC_CHECK_SIZEOF_FORTRAN], [
+ AC_REQUIRE([AC_F77_WRAPPERS])
+ AC_CACHE_CHECK([size of Fortran [$1]], [ac_cv_sizeof_fortran_[]translit($1, [A-Z *], [a-z_p])],[
+ AC_LANG_SAVE()
+ AC_LANG([Fortran 77])
+ AC_COMPILE_IFELSE([
+ AC_LANG_SOURCE([
+ subroutine fsize()
+ $1 i(2)
+ call csize(i(1), i(2))
+ end
+ ])
+ ],[
+ AC_LANG([C])
+ cp conftest.$ac_objext conftestf.$ac_objext
+ old_LDFLAGS="$LDFLAGS"
+ LDFLAGS="conftestf.$ac_objext $LDFLAGS"
+#"$ac_cv_f77_libs"
+ AC_TRY_RUN([
+# include <stdio.h>
+# define CSIZE F77_FUNC(csize,CSIZE)
+# define FSIZE F77_FUNC(fsize,FSIZE)
+ static long size_val;
+ /* Called by Fortran */
+ void CSIZE (i1p, i2p)
+ char *i1p, *i2p;
+ {
+ size_val = (i2p - i1p);
+ }
+ main() {
+ FILE *f=fopen ("conftestval","w");
+ if (!f) return 1;
+ /* Call the Fortran function */
+ FSIZE ();
+ fprintf (f, "%d\n", size_val);
+ return 0;
+ }
+ ])
+ LDFLAGS="$old_LDFLAGS"
+ ac_cv_sizeof_fortran_[]translit($1, [A-Z *], [a-z_p])=`cat conftestval`
+ rm -f conftestval conftestf.$ac_objext
+ ])
+ AC_LANG_RESTORE()
+ ])
+ AC_DEFINE_UNQUOTED(SIZEOF_FORTRAN_[]translit($1, [a-z *], [A-Z_p]),
+ [$ac_cv_sizeof_fortran_[]translit($1, [A-Z *], [a-z_p])],
+ [The size of a Fortran `$1', as computed by sizeof.])
+
+])
--- /dev/null
+AC_DEFUN([CHECK_CALCIUM], [
+
+## Guess where as cal_int type is provided by --with-cal_int option
+## or auto-detection must be used
+
+AC_ARG_WITH([cal_int],
+ AC_HELP_STRING([--with-cal_int=<C type>],
+ [Use <C type> for mapping a Fortran integer in C within CALCIUM C/F77 interfaces.]),
+ [],
+ [withval=no])
+
+if test "x$withval" = "xno"
+then
+ AC_REQUIRE([CHECK_F77])
+ AC_CHECK_SIZEOF_FORTRAN(integer)
+ AC_CHECK_SIZEOF(long)
+ AC_CHECK_SIZEOF(int)
+
+ if test "x$ac_cv_sizeof_fortran_integer" = "x8" ; then
+ AC_DEFINE(HAVE_F77INT64,[],
+ [The size of a Fortran integer, as computed by sizeof.])
+ test "x$ac_cv_sizeof_long" = "x8" || AC_MSG_ERROR([Size of C type long expected to be eight bytes])
+ LONG_OR_INT="long"
+ CALCIUM_IDL_INT_F77="long long"
+ CALCIUM_CORBA_INT_F77="CORBA::LongLong"
+ elif test "x$ac_cv_sizeof_fortran_integer" = "x4" ; then
+ test "x$ac_cv_sizeof_int" = "x4" || AC_MSG_ERROR([Size of C type int expected to be four bytes])
+ LONG_OR_INT="int"
+ CALCIUM_IDL_INT_F77="long"
+ CALCIUM_CORBA_INT_F77="CORBA::Long"
+ else
+ AC_MSG_ERROR([Size of Fortran type integer is neither four nor eigth bytes])
+ fi
+
+else
+ LONG_OR_INT="$withval"
+ CALCIUM_IDL_INT_F77="long"
+ CALCIUM_CORBA_INT_F77="CORBA::Long"
+ AC_MSG_NOTICE([Using C type $withval for cal_int])
+fi
+
+AC_SUBST(CALCIUM_IDL_INT_F77)
+AC_SUBST(CALCIUM_CORBA_INT_F77)
+AC_SUBST(LONG_OR_INT)
+AC_DEFINE_UNQUOTED([CAL_INT],[$LONG_OR_INT],
+ [The C type to be used for mapping a Fortran integer in C within CALCIUM C/F77 interfaces.])
+])
AC_DEFUN([CHECK_F77],[
AC_PROG_F77
-
AC_F77_LIBRARY_LDFLAGS
AC_F77_WRAPPERS
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
# File : Makefile.am
-# Author : André RIBES (EDF), Eric Fayolle (EDF)
+# Author : André RIBES (EDF), Eric Fayolle (EDF)
# Module : KERNEL
#
include $(top_srcdir)/salome_adm/unix/make_common_starter.am
-I$(top_srcdir)/src/DSC/DSC_User/Datastream \
-I$(top_srcdir)/src/DSC/DSC_User/Datastream/Palm \
-I$(top_srcdir)/src/DSC/DSC_User/Datastream/Calcium \
+ -I$(top_builddir)/src/DSC/DSC_User/Datastream/Calcium \
-I$(top_srcdir)/src/DSC/DSC_User/Basic \
-I$(top_srcdir)/src/DSC/DSC_Basic \
-I$(top_srcdir)/src/SALOMELocalTrace \
../DSC_Basic/libSalomeDSCContainer.la \
../../Container/libSalomeContainer.la
-_calcium_la_CXXFLAGS = $(PYTHON_INCLUDES) $(COMMON_CPPFLAGS)
+_calcium_la_CPPFLAGS = $(PYTHON_INCLUDES) $(COMMON_CPPFLAGS)
EXTRA_DIST=calcium_wrap.cpp calcium.i
// Module : KERNEL
#include "calcium.h"
+#include "calciumf.h"
+#include "CalciumFortranInt.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
+#include <stddef.h>
// Interface C de SalomeCalcium
typedef int InfoType;
typedef char bool;
+
/************************************/
/* INTERFACES DE LECTURE EN 0 COPIE */
/************************************/
ecp_lecture_##_typeName##_free(data); \
};
-#define STAR *
-CALCIUM_EXT_LECT_INTERFACE_C_(len,float,int,int,);
-CALCIUM_EXT_LECT_INTERFACE_C_(lre,float,float,float,);
-CALCIUM_EXT_LECT_INTERFACE_C_(ldb,double,double,double,);
-CALCIUM_EXT_LECT_INTERFACE_C_(llo,float,int,bool,);
-CALCIUM_EXT_LECT_INTERFACE_C_(lcp,float,float,cplx,);
-/* CALCIUM_EXT_LECT_INTERFACE_C_(lch,float,char,STAR[]); */
/* L'interface de cette routine diffère de celle obtenue par la macro :
CALCIUM_LECT_INTERFACE_C_.
};
+#define STAR *
+/*REVERIFIER MAINTENANT 0 COPY avec int2integer*/
+CALCIUM_EXT_LECT_INTERFACE_C_(len,float,int,int2integer,);
+CALCIUM_EXT_LECT_INTERFACE_C_(lre,float,float,float,);
+CALCIUM_EXT_LECT_INTERFACE_C_(ldb,double,double,double,);
+CALCIUM_EXT_LECT_INTERFACE_C_(llo,float,int,bool,);
+CALCIUM_EXT_LECT_INTERFACE_C_(lcp,float,float,cplx,);
+/* CALCIUM_EXT_LECT_INTERFACE_C_(lch,float,char,STAR[]); */
+
+
/**************************************/
/* INTERFACES DE LECTURE AVEC RECOPIE */
/**************************************/
-#define CALCIUM_LECT_INTERFACE_C_(_name,_timeType,_type,_typeName,_qual) \
- InfoType cp_##_name (void * component, int mode, \
- _timeType * ti, _timeType * tf, int * i, \
- char * nomvar, int bufferLength, \
- int * nRead, _type _qual * data ) { \
+#define CALCIUM_LECT_INTERFACE_C_(_name,_timeType,_calInt,_type,_typeName,_qual,lastarg) \
+ _calInt cp_##_name (void * component, _calInt mode, \
+ _timeType * ti, _timeType * tf, _calInt * i, \
+ char * nomvar, _calInt bufferLength, \
+ _calInt * nRead, _type _qual * data \
+ lastarg ) { \
+ \
+ int _mode = (int) mode; \
+ size_t _bufferLength = bufferLength; \
size_t _nRead; \
- long _i=*i; \
+ long _i =*i; \
fflush(stdout); \
fflush(stderr); \
fprintf(stderr,"Beginning of cp_" #_name " : %s %d %f\n",nomvar,*i,*ti); \
\
- if ( (data == NULL) || (bufferLength < 1) ) return CPNTNULL; \
+ if ( (data == NULL) || (_bufferLength < 1) ) return CPNTNULL; \
\
- InfoType info = ecp_lecture_##_typeName (component, mode, ti, tf, &_i, \
- nomvar, bufferLength, &_nRead, \
+ _calInt info = ecp_lecture_##_typeName (component, _mode, ti, tf, &_i, \
+ nomvar, _bufferLength, &_nRead, \
&data ); \
if(mode == CP_SEQUENTIEL) \
*i = _i; \
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,
- char * nomvar, int bufferLength, int * nRead,
- char ** data, int strSize) {
- size_t _nRead;
- long _i=*i;
- fflush(stdout);fflush(stderr);
- fprintf(stderr,"Beginning of cp_lch: %s %d %f\n",nomvar,*i,*ti);
+/* InfoType cp_lch(void * component, int mode, float * ti, float * tf, int * i, */
+/* char * nomvar, int bufferLength, int * nRead, */
+/* char ** data, int strSize) { */
+
+/* size_t _nRead; */
+/* long _i=*i; */
+/* fflush(stdout);fflush(stderr); */
+/* fprintf(stderr,"Beginning of cp_lch: %s %d %f\n",nomvar,*i,*ti); */
- if ( (data == NULL) || (bufferLength < 1) ) return CPNTNULL;
+/* if ( (data == NULL) || (bufferLength < 1) ) return CPNTNULL; */
- InfoType info = ecp_lecture_str (component, mode, ti, tf, &_i,
- nomvar, bufferLength, &_nRead,
- &data);/*, strSize );
- strSize est inutile pour les ports CALCIUM
- qui gèrent des tailles quelconques de chaines. */
- if(mode == CP_SEQUENTIEL)
- *i = _i;
- *nRead=_nRead;
- fprintf(stderr,"End of cp_lch: %s %d \n",nomvar,*i);
- fflush(stdout);fflush(stderr);
+/* InfoType info = ecp_lecture_str (component, mode, ti, tf, &_i, */
+/* nomvar, bufferLength, &_nRead, */
+/* &data);*/
+/*, strSize ); */
+/* strSize est inutile pour les ports CALCIUM */
+/* qui gèrent des tailles quelconques de chaines. */
+/* if(mode == CP_SEQUENTIEL) */
+/* *i = _i; */
+/* *nRead=_nRead; */
+/* fprintf(stderr,"End of cp_lch: %s %d \n",nomvar,*i); */
+/* fflush(stdout);fflush(stderr); */
- return info;
-};
+/* return info; */
+/* }; */
/* Definition des méthodes calcium standard */
-
-CALCIUM_LECT_INTERFACE_C_(len,float,int,int,);
-CALCIUM_LECT_INTERFACE_C_(lre,float,float,float,);
-CALCIUM_LECT_INTERFACE_C_(ldb,double,double,double,);
-CALCIUM_LECT_INTERFACE_C_(llo,float,int,bool,);
-CALCIUM_LECT_INTERFACE_C_(lcp,float,float,cplx,);
+/* CALCIUM_LECT_INTERFACE_C_( <suffixe du nom de l'interface à générer>, <type du paramètre temporel>, <type d'entier à utiliser pour les paramètres de type entier>,
+ <type de données>, <nom de l'interface C2CPP à utiliser>, <qualificateur de type optionnel des données>,<paramètres supplémentaire ignoré>)*/
+
+CALCIUM_LECT_INTERFACE_C_(len,float ,int,int ,int2integer,,);
+/*llg ne sera pas disponible si sizeof(long) == 64 bits && cal_int==int
+ sinon problème de conversion de 64bits vers 32bits */
+CALCIUM_LECT_INTERFACE_C_(llg,float ,int,long ,long2integer,,);
+
+CALCIUM_LECT_INTERFACE_C_(lre,float ,int,float ,float,,);
+CALCIUM_LECT_INTERFACE_C_(ldb,double,int,double ,double,,);
+CALCIUM_LECT_INTERFACE_C_(llo,float ,int,int ,bool,,);
+CALCIUM_LECT_INTERFACE_C_(lcp,float ,int,float ,cplx,,);
#define STAR *
-/* CALCIUM_LECT_INTERFACE_C_(lch,float,char,STAR); */
+#define LCH_LAST_PARAM ,int strsize
+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 */
+CALCIUM_LECT_INTERFACE_C_(len_fort_,float ,cal_int,cal_int ,integer,,);
+CALCIUM_LECT_INTERFACE_C_(lin_fort_,float ,cal_int,int ,int2integer,,);
+/*llg ne sera pas disponible si sizeof(long) == 64 bits && cal_int==int
+ 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,,);
+CALCIUM_LECT_INTERFACE_C_(ldb_fort_,double,cal_int,double ,double,,);
+CALCIUM_LECT_INTERFACE_C_(llo_fort_,float ,cal_int,int ,bool,,); /*int pour bool ou cal_int */
+CALCIUM_LECT_INTERFACE_C_(lcp_fort_,float ,cal_int,float ,cplx,,);
+CALCIUM_LECT_INTERFACE_C_(lch_fort_,float ,cal_int,char ,str,STAR, LCH_LAST_PARAM );
/**********************************************/
if (instanceName) strcpy(instanceName,"UNDEFINED");
return CPOK;
}
+
InfoType cp_fin (void * component, int code) {
/* TODO : gérer avec les callbacks des ports DSC */
}
-
/***************************/
/* INTERFACES D'ECRITURE */
/***************************/
-#define CALCIUM_ECR_INTERFACE_C_(_name,_timeType,_type,_typeName,_qual) \
- InfoType cp_##_name (void * component, int mode, \
- _timeType t, int i, \
- char * nomvar, int nbelem, \
- _type _qual * data ) { \
+#define CALCIUM_ECR_INTERFACE_C_(_name,_timeType,_calInt,_type,_typeName,_qual,lastarg) \
+ _calInt cp_##_name (void * component, _calInt mode, \
+ _timeType t, _calInt i, \
+ char * nomvar, _calInt nbelem, \
+ _type _qual * data \
+ lastarg ) { \
\
- /*long _i=i;*/ \
+ int _mode = mode; \
+ long _i = i; \
+ size_t _nbelem = nbelem; \
+ _timeType _t = t; \
fflush(stdout); \
fflush(stderr); \
- fprintf(stderr,"Beginning of cp_" #_name " : %s %d %f\n",nomvar,i,t); \
+ fprintf(stderr,"Beginning of cp_" #_name " : %s %d %f\n",nomvar,i,t); \
if ( (data == NULL) || (nbelem < 1) ) return CPNTNULL; \
- \
- InfoType info = ecp_ecriture_##_typeName (component, mode, &t, i, \
- nomvar, nbelem, \
+ \
+ _calInt info = ecp_ecriture_##_typeName (component, _mode, &_t, _i, \
+ nomvar, _nbelem, \
data ); \
fprintf(stderr,"End of cp_" #_name " : %s %d \n",nomvar,i); \
fflush(stdout); \
}; \
-/* Definition des méthodes calcium standard */
-
-CALCIUM_ECR_INTERFACE_C_(een,float,int,int,);
-CALCIUM_ECR_INTERFACE_C_(ere,float,float,float,);
-CALCIUM_ECR_INTERFACE_C_(edb,double,double,double,);
-/*CALCIUM_ECR_INTERFACE_C_(elo,float,bool,bool,);*/
-CALCIUM_ECR_INTERFACE_C_(elo,float,int,bool,);
-CALCIUM_ECR_INTERFACE_C_(ecp,float,float,cplx,);
-InfoType cp_ech(void * component, int mode, float t, int i,
- char * nomvar, int nbelem,
- char ** data, int strSize) {
+/* InfoType cp_ech(void * component, int mode, float t, int i, */
+/* char * nomvar, int nbelem, */
+/* char ** data, int strSize) { */
- /*long _i=i;*/
- fflush(stdout);fflush(stderr);
- fprintf(stderr,"Beginning of cp_ech: %s %d %f\n",nomvar,i,t);
- if ( (data == NULL) || (nbelem < 1) ) return CPNTNULL;
+/*long _i=i;*/
+/* fflush(stdout);fflush(stderr); */
+/* fprintf(stderr,"Beginning of cp_ech: %s %d %f\n",nomvar,i,t); */
+/* if ( (data == NULL) || (nbelem < 1) ) return CPNTNULL; */
- InfoType info = ecp_ecriture_str (component, mode, &t, i,
- nomvar, nbelem,
- data);/*, strSize );*/
- fprintf(stderr,"End of cp_ech: %s %d \n",nomvar,i);
- fflush(stdout);
- fflush(stderr);
+/* InfoType info = ecp_ecriture_str (component, mode, &t, i, */
+/* nomvar, nbelem, */
+/* data); */
+/*, strSize );*/
+/* fprintf(stderr,"End of cp_ech: %s %d \n",nomvar,i); */
+/* fflush(stdout); */
+/* fflush(stderr); */
- return info;
-};
-
+/* return info; */
+/* }; */
+/* 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,,);
+CALCIUM_ECR_INTERFACE_C_(elg,float ,int,long ,long2integer,,);
+CALCIUM_ECR_INTERFACE_C_(ere,float ,int,float ,float,,);
+CALCIUM_ECR_INTERFACE_C_(edb,double,int,double,double,,);
+CALCIUM_ECR_INTERFACE_C_(elo,float ,int,int ,bool,,);
+CALCIUM_ECR_INTERFACE_C_(ecp,float ,int,float ,cplx,,);
+CALCIUM_ECR_INTERFACE_C_(ech,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 */
+
+CALCIUM_ECR_INTERFACE_C_(een_fort_,float ,cal_int,cal_int,integer,,);
+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,,);
+CALCIUM_ECR_INTERFACE_C_(edb_fort_,double,cal_int,double,double,,);
+CALCIUM_ECR_INTERFACE_C_(elo_fort_,float ,cal_int,int ,bool,,);
+CALCIUM_ECR_INTERFACE_C_(ecp_fort_,float ,cal_int,float ,cplx,,);
+CALCIUM_ECR_INTERFACE_C_(ech_fort_,float ,cal_int,char ,str,STAR,LCH_LAST_PARAM );
--- /dev/null
+#include "CalciumCInterface.hxx"
+#include "CalciumCxxInterface.hxx"
+
+#include <stdio.h>
+
+
+#ifdef _DEBUG_
+#define DEBTRACE(msg) {std::cerr<<std::flush<<__FILE__<<" ["<<__LINE__<<"] : "<<msg<<std::endl<<std::flush;}
+#else
+#define DEBTRACE(msg)
+#endif
+
+
+/* Définition de l'Interface entre l'API C et l'API C++
+ L'utilisateur CALCIUM n'a normalement pas a utliser cette interface
+ En C/C++ il utilisera celle définie dans Calcium.c (calcium.h)
+ En C++/CORBA directement celle de CalciumCxxInterface.hxx
+*/
+
+
+#define STAR *
+
+/* Définition de ecp_lecture_... , ecp_ecriture_..., ecp_free_... */
+
+/* Le premier argument est utilisée :
+ - comme suffixe dans la définition des noms ecp_lecture_ , ecp_ecriture_ et ecp_free_
+ - comme second argument template à l'appel de la méthode C++ correspondante
+ ( le type de port correspondant est alors obtenu par un trait)
+ Le second argument est utilisée :
+ - pour typer le paramètre data de la procédure générée
+ - pour déduire le type des paramètres t, ti tf via un trait
+ - comme premier paramètre template à l'appel de la méthode C++ correspondante
+ (pour typer les données passées en paramètre )
+ Notons que dans le cas CALCIUM_C2CPP_INTERFACE_(int,int,), le type int n'existe pas
+ en CORBA, le port CALCIUM correspondant utilise une séquence de long. La méthode
+ C++ CALCIUM de lecture repère cette différence de type et charge
+ le manipulateur de données d'effectuer une recopie (qui fonctionne si les types sont compatibles).
+*/
+// CALCIUM_C2CPP_INTERFACE_CXX_(_name,_porttype,_type,_qual)
+CALCIUM_C2CPP_INTERFACE_CXX_(intc,int,int,);
+CALCIUM_C2CPP_INTERFACE_CXX_(long,long,long,);
+
+CALCIUM_C2CPP_INTERFACE_CXX_(integer,integer,cal_int,);
+CALCIUM_C2CPP_INTERFACE_CXX_(int2integer ,integer, int,);
+CALCIUM_C2CPP_INTERFACE_CXX_(long2integer, integer, long,);
+
+CALCIUM_C2CPP_INTERFACE_CXX_(float,float,float, );
+CALCIUM_C2CPP_INTERFACE_CXX_(double,double,double,);
+/* Fonnctionne mais essai suivant pour simplification de Calcium.c CALCIUM_C2CPP_INTERFACE_(bool,bool,);*/
+CALCIUM_C2CPP_INTERFACE_CXX_(bool,bool,int,);
+CALCIUM_C2CPP_INTERFACE_CXX_(cplx,cplx,float,);
+CALCIUM_C2CPP_INTERFACE_CXX_(str,str,char*,);
+
+/* Définition de ecp_fin */
+extern "C" CalciumTypes::InfoType
+ecp_fin_ (void * component, int code) {
+
+ Superv_Component_i * _component = static_cast<Superv_Component_i *>(component);
+
+ bool provideLastGivenValue = false;
+ if (code == CalciumTypes::CP_CONT ) provideLastGivenValue = true;
+
+ try {
+ CalciumInterface::ecp_fin( *_component,
+ provideLastGivenValue);
+ } catch ( const CalciumException & ex) { //tester l'arrêt par exception
+ DEBTRACE( ex.what() );
+ return ex.getInfo();
+ }
+ return CalciumTypes::CPOK;
+};
+
+// INTERFACE C/CPP pour les chaines de caractères
+// Le paramètre supplémentaire strsize n'étant pas utilisé
+// j'utilise la génération par la macro CALCIUM_C2CPP_INTERFACE_(str,char*,);
+// extern "C" CalciumTypes::InfoType ecp_lecture_str (void * component, int dependencyType,
+// float * ti, float * tf, long * i,
+// const char * const nomvar, size_t bufferLength,
+// size_t * nRead, char ** *data, size_t strsize ) {
+
+// Superv_Component_i * _component = static_cast<Superv_Component_i *>(component);
+// double _ti=*ti;
+// double _tf=*tf;
+// size_t _nRead=0;
+// size_t _bufferLength=bufferLength;
+// CalciumTypes::DependencyType dependencyType=
+// static_cast<CalciumTypes::DependencyType>(dependencyType);
+
+// // - GERER POINTEUR NULL : NOTHING TODO
+// // - VERIFIER LA TAILLE DES CHAINES RETOURNEES (ELLES DEVRAIENT ETRES CORRECTES SI L'ECRITURE EST BIEN CODEE.)
+
+// DEBTRACE( "-------- CalciumInterface(lecture Inter Part) MARK 1 ------------------" )
+// try {
+// CalciumInterface::ecp_lecture< char*, char* >( *_component,
+// dependencyType,
+// _ti, _tf, *i,
+// nomvar,
+// _bufferLength, _nRead, *data);
+// } catch ( const CalciumException & ex) {
+// DEBTRACE( ex.what() );
+// return ex.getInfo();
+// }
+
+// *nRead = _nRead;
+
+// if (dependencyType == CalciumTypes::CP_SEQUENTIEL )
+// *ti=(float)(_ti);
+
+// DEBTRACE( "-------- CalciumInterface(lecture Inter Part), Data Ptr :" << *data ) ;
+
+// return CalciumTypes::CPOK;
+// };
+
+
+// extern "C" void ecp_lecture_str_free (char** data) {
+// CalciumInterface::ecp_free< char*, char* >(data);
+// };
+
+
+// extern "C" CalciumTypes::InfoType ecp_ecriture_str (void * component, int dependencyType,
+// float *t, long i,
+// const char * const nomvar, size_t bufferLength,
+// char ** data, int strsize ) {
+
+// Superv_Component_i * _component = static_cast<Superv_Component_i *>(component);
+// /* Je ne sais pas pourquoi, je n'arrive pas à passer t par valeur : corruption de la pile*/
+// double _t=*t;
+// size_t _bufferLength=bufferLength;
+
+// // - VERIFIER LA TAILLE DES CHAINES RETOURNEES (ELLES DEVRAIENT ETRES CORRECTES SI L'ECRITURE EST BIEN CODEE.)
+
+// DEBTRACE( "-------- CalciumInterface(ecriture Inter Part) MARK 1 ------------------" )
+// try {
+// std::string essai(nomvar);
+// DEBTRACE( "----------->-" << nomvar )
+// CalciumInterface::ecp_ecriture< char*, char* >( *_component,
+// static_cast<CalciumTypes::DependencyType>(dependencyType),
+// _t,i,nomvar,_bufferLength,*data);
+// } catch ( const CalciumException & ex) {
+// std::cerr << ex.what() << std::endl;
+// return ex.getInfo();
+// }
+// DEBTRACE( "-------- CalciumInterface(ecriture Inter Part), Valeur de data :" << data )
+// return CalciumTypes::CPOK;
+// };
--- /dev/null
+/* Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
+
+ Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+ CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+ See http: www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+
+ File : CalciumInterface.hxx
+ Author : Eric Fayolle (EDF)
+ Module : KERNEL
+ Modified by : $LastChangedBy$
+ Date : $LastChangedDate: 2007-03-01 13:27:58 +0100 (jeu, 01 mar 2007) $
+ Id : $Id$
+*/
+#ifndef _CALCIUM_C_INTERFACE_H_
+#define _CALCIUM_C_INTERFACE_H_
+
+#include "CalciumMacroCInterface.hxx"
+#include "CalciumTypes.hxx"
+#include "CalciumFortranInt.h"
+#include <cstdlib>
+
+/* Déclaration de l'Interface entre l'API C et l'API C++
+ L'utilisateur CALCIUM n'a normalement pas a utliser cette interface
+ En C/C++ il utilisera celle définie dans Calcium.c (calcium.h)
+2 En C++/CORBA directement celle de CalciumCxxInterface.hxx
+*/
+
+/* En CALCIUM l'utilisation de données de type double
+ implique des dates de type double, pour les autres
+ types de données les dates sont de type float
+*/
+template <class T> struct CalTimeType {
+ typedef float TimeType;
+};
+
+template <> struct CalTimeType<double> {
+ typedef double TimeType;
+};
+
+/* Déclaration de ecp_lecture_... , ecp_ecriture_..., ecp_free_... */
+
+/* Le premier argument est utilisé :
+ - comme suffixe dans la définition des noms ecp_lecture_ , ecp_ecriture_ et ecp_free_
+ Le second argument est utilisé :
+ - comme argument template à l'appel de la méthode C++ correspondante
+ ( le type CORBA de port correspondant est alors obtenu par un trait)
+ Le troisième argument est utilisée :
+ - pour typer le paramètre data de la procédure générée
+ - pour déduire le type des paramètres t, ti tf via un trait
+ - comme premier paramètre template à l'appel de la méthode C++ correspondante
+ (pour typer les données passées en paramètre )
+ Notons que dans le cas CALCIUM_C2CPP_INTERFACE_(int,int,), le type int n'existe pas
+ en CORBA, le port CALCIUM correspondant utilise une séquence de long. La méthode
+ C++ CALCIUM de lecture repère cette différence de type et charge
+ le manipulateur de données d'effectuer une recopie (qui fonctionne si les types sont compatibles).
+ Notons qu'en CORBA CORBA:Long est mappé sur long uniquement si celui-ci est 32bits sinon
+ il sera mappé sur le type int (si il est 32bits). Le type CORBA:LongLong est mappé sur le type long
+ s'il est 64 bits sinon celà peut être un long long (s'il existe).
+*/
+CALCIUM_C2CPP_INTERFACE_HXX_(intc,int,int,);
+CALCIUM_C2CPP_INTERFACE_HXX_(long,long,long,);
+
+CALCIUM_C2CPP_INTERFACE_HXX_(integer,integer,cal_int,);
+CALCIUM_C2CPP_INTERFACE_HXX_(int2integer,integer,int,);
+CALCIUM_C2CPP_INTERFACE_HXX_(long2integer,integer, long,);
+
+CALCIUM_C2CPP_INTERFACE_HXX_(float,float,float, );
+CALCIUM_C2CPP_INTERFACE_HXX_(double,double,double,);
+/* Fonctionne mais essai suivant pour simplification de Calcium.c CALCIUM_C2CPP_INTERFACE_(bool,bool,);*/
+CALCIUM_C2CPP_INTERFACE_HXX_(bool,bool,int,);
+CALCIUM_C2CPP_INTERFACE_HXX_(cplx,cplx,float,);
+CALCIUM_C2CPP_INTERFACE_HXX_(str,str,char*,);
+
+/* Déclaration de ecp_fin */
+extern "C" CalciumTypes::InfoType ecp_fin_ (void * component, int code);
+
+#endif
#include <stdio.h>
-//#define _DEBUG_
+#include <typeinfo>
template <typename T1, typename T2>
struct IsSameType {
// T1 est le type de données
// T2 est un <nom> de type Calcium permettant de sélectionner le port CORBA correspondant
- // T1 et T2 sont dissociés pour discriminer le cas des nombres complexes
+ // T1 et T2 sont dissociés pour discriminer par exemple le cas des nombres complexes
// -> Les données des nombres complexes sont de type float mais
// le port à utiliser est le port cplx
template <typename T1, typename T2 > static void
LOC("Le nom de la variable est <nul>"));
PortType * port;
#ifdef _DEBUG_
- std::cout << "-------- CalciumInterface(ecp_lecture) MARK 2 ------------------" << std::endl;
+ std::cout << "-------- CalciumInterface(lecture) MARK 2 --"<<typeid(port).name()<<"----------------" << std::endl;
+ T1 t1;
+ T2 t2;
+ std::cout << "-------- CalciumInterface(lecture) MARK 2b1 -----" << typeid(t1).name() << "-------------" << std::endl;
+ std::cout << "-------- CalciumInterface(lecture) MARK 2b2 -----" << typeid(t2).name() << "-------------" << std::endl;
#endif
try {
#endif
// On essaye de faire du 0 copy si les types T1 et InnerType sont les mêmes.
// Copy2UserSpace :
- // La raison d'être du foncteur Copy2UserSpace est que le compilateur n'acceptera
- // pas une expresion d'affectation sur des types incompatibles même
+ // La raison d'être du foncteur Copy2UserSpace est qu'il n'est pas possible de compiler
+ // une expression d'affectation sur des types incompatibles ; même
// si cette expression se trouve dans une branche non exécuté d'un test
- // sur la compatibilité des types.
- // En utilisant le foncteur Copy2UserSpace, seul la spécialisation en adéquation
+ // portant sur la compatibilité des types.
+ // En utilisant le foncteur Copy2UserSpace, seule la spécialisation en adéquation
// avec la compatibilité des types sera compilée
Copy2UserSpace< IsSameType<T1,InnerType>::value, DataManipulator >::apply(data,corbaData,nRead);
#ifdef _DEBUG_
std::cout << "-------- CalciumInterface(ecp_lecture) MARK 11 ------------------" << std::endl;
#endif
Copy2UserSpace<false, DataManipulator >::apply(data,corbaData,nRead);
- DataManipulator::copy(corbaData,data,nRead);
+ //Déjà fait ci-dessus :
+ //DataManipulator::copy(corbaData,data,nRead);
#ifdef _DEBUG_
std::cout << "-------- CalciumInterface(ecp_lecture) MARK 12 ------------------" << std::endl;
#endif
- // Attention : Seul CalciumCouplingPolicy via eraseDataId doit décider de supprimer ou non
- // la donnée corba associée à un DataId ! Ne pas effectuer la desallocation suivante :
- // DataManipulator::delete_data(corbaData);
}
#ifdef _DEBUG_
std::cout << "-------- CalciumInterface(ecp_lecture), Valeur de data : " << std::endl;
assert(&component);
//typedef typename StarTrait<TT>::NonStarType T;
- typedef typename boost::remove_all_extents< T2 >::type T2_without_extent;
typedef typename boost::remove_all_extents< T1 >::type T1_without_extent;
-
+ typedef typename boost::remove_all_extents< T2 >::type T2_without_extent;
typedef typename UsesPortTraits <T2_without_extent>::PortType UsesPortType;
typedef typename ProvidesPortTraits<T2_without_extent>::PortType ProvidesPortType;// pour obtenir un manipulateur de données
typedef typename ProvidesPortType::DataManipulator DataManipulator;
LOC("Le nom de la variable est <nul>"));
UsesPortType * port;
#ifdef _DEBUG_
- std::cout << "-------- CalciumInterface(ecriture) MARK 2 ------------------" << std::endl;
+ std::cout << "-------- CalciumInterface(ecriture) MARK 2 ---"<<typeid(port).name()<<"---------------" << std::endl;
+ T1 t1;
+ T2 t2;
+ std::cout << "-------- CalciumInterface(ecriture) MARK 2b1 -----" << typeid(t1).name() << "-------------" << std::endl;
+ std::cout << "-------- CalciumInterface(ecriture) MARK 2b2 -----" << typeid(t2).name() << "-------------" << std::endl;
#endif
try {
LOC(OSS()<<"Le buffer a envoyer est de taille nulle "));
+ CorbaDataType corbaData;
#ifdef _DEBUG_
std::cout << "-------- CalciumInterface(ecriture) MARK 4 ------------------" << std::endl;
#endif
- CorbaDataType corbaData;
// Si les types Utilisateurs et CORBA sont différents
// OLD : Il faut effectuer une copie dans le port provides.
// OLD : Cette copie est effectuée dans GenericPortUses::put
// OLD : en fonction de la collocalisation ou non.
+ T1_without_extent t1b;
+ InnerType t2b;
+ std::cout << "-------- CalciumInterface(ecriture) MARK 4b1 -----" << typeid(t1b).name() << "-------------" << std::endl;
+ std::cout << "-------- CalciumInterface(ecriture) MARK 4b2 -----" << typeid(t2b).name() << "-------------" << std::endl;
+
Copy2CorbaSpace<IsSameType<T1_without_extent,InnerType>::value, DataManipulator >::apply(corbaData,_data,bufferLength);
//TODO : GERER LES EXCEPTIONS ICI : ex le port n'est pas connecté
--- /dev/null
+/* Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
+
+ Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+ CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+ See http: www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+
+ File : CalciumInterface.hxx
+ Author : Eric Fayolle (EDF)
+ Module : KERNEL
+ Modified by : $LastChangedBy$
+ Date : $LastChangedDate: 2007-03-01 13:27:58 +0100 (jeu, 01 mar 2007) $
+ Id : $Id$
+*/
+#ifndef _CALCIUM_FORTRAN_INT_H_
+#define _CALCIUM_FORTRAN_INT_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef @LONG_OR_INT@ cal_int;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
\ No newline at end of file
//Interface CALCIUM des utilisateurs en C++
#include "CalciumCxxInterface.hxx"
-#include "CalciumException.hxx"
-#include "CalciumTypes.hxx"
+/* Déclaration de l'Interface entre l'API C et l'API C++
+ L'utilisateur CALCIUM n'a normalement pas a utliser cette interface
+ En C/C++ il utilisera celle définie dans Calcium.c (calcium.h)
+ En C++/CORBA directement celle de CalciumCxxInterface.hxx
+*/
+#include "CalciumCInterface.hxx"
-#include <stdio.h>
-//Ce fichier déclare et défini l'interfaçage entre l'API utilisteur C et C++
-//Les procédures déclarées n'ont pas vocation à être utilisées directement (celà est
-// cependant possible).
-//#define _DEBUG_
-
-#ifdef _DEBUG_
-#define DEBTRACE(msg) {std::cerr<<std::flush<<__FILE__<<" ["<<__LINE__<<"] : "<<msg<<std::endl<<std::flush;}
-#else
-#define DEBTRACE(msg)
-#endif
-
-
-// Interface C/C++
-// L'utilisateur CALCIUM n'a normalement pas a utliser cette interface
-// En C/C++ il utilisera celle définie dans Calcium.c
-// En C++/CORBA directement celle de CalciumCxxInterface
-
-// En CALCIUM l'utilisation de données de type double
-// implique des dates de type double, pour les autres
-// types de données les dates sont de type float
-template <class T> struct CalTimeType {
- typedef float TimeType;
-};
-
-template <> struct CalTimeType<double> {
- typedef double TimeType;
-};
-
-// Définition de ecp_fin
-extern "C" CalciumTypes::InfoType
-ecp_fin_ (void * component, int code) {
-
- Superv_Component_i * _component = static_cast<Superv_Component_i *>(component);
-
- bool provideLastGivenValue = false;
- if (code == CalciumTypes::CP_CONT ) provideLastGivenValue = true;
-
- try {
- CalciumInterface::ecp_fin( *_component,
- provideLastGivenValue);
- } catch ( const CalciumException & ex) { //tester l'arrêt par exception
- DEBTRACE( ex.what() );
- return ex.getInfo();
- }
- return CalciumTypes::CPOK;
-};
-
-
-// Définition de ecp_lecture_... , ecp_ecriture_..., ecp_free_...
-#define CALCIUM_C2CPP_INTERFACE_(_name,_type,_qual) \
- extern "C" CalciumTypes::InfoType ecp_lecture_##_name (void * component, int dependencyType, \
- CalTimeType< _type _qual >::TimeType * ti, \
- CalTimeType< _type _qual >::TimeType * tf, long * i, \
- const char * const nomvar, size_t bufferLength, \
- size_t * nRead, _type _qual ** data ) { \
- Superv_Component_i * _component = static_cast<Superv_Component_i *>(component); \
- double _ti=*ti; \
- double _tf=*tf; \
- size_t _nRead=0; \
- size_t _bufferLength=bufferLength; \
- \
- if ( IsSameType< _name , cplx >::value ) _bufferLength*=2; \
- DEBTRACE( "-------- CalciumInterface(lecture Inter Part) MARK 1 ------------------" ) \
- try { \
- CalciumInterface::ecp_lecture< _type, _name >( *_component, \
- dependencyType, \
- _ti, _tf, *i, \
- nomvar, \
- _bufferLength, _nRead, *data); \
- } catch ( const CalciumException & ex) { \
- DEBTRACE( ex.what() ); \
- return ex.getInfo(); \
- } catch ( ... ) { \
- std::cerr << "Unexpected exception " << std::endl; \
- return CalciumTypes::CPATAL; \
- } \
- if ( IsSameType< _name , cplx >::value ) { *nRead=_nRead/2; \
- DEBTRACE( "-------- CalciumInterface(lecture Inter Part) IsSameType cplx -------------" ) \
- DEBTRACE( "-------- CalciumInterface(lecture Inter Part) _nRead : " << _nRead ) \
- DEBTRACE( "-------- CalciumInterface(lecture Inter Part) *nRead : " << *nRead ) \
- } else *nRead = _nRead; \
- if (dependencyType == CalciumTypes::CP_SEQUENTIEL ) \
- *ti=(CalTimeType< _type _qual >::TimeType)(_ti); \
- DEBTRACE( "-------- CalciumInterface(lecture Inter Part), Data Ptr :" << *data ) \
- return CalciumTypes::CPOK; \
- }; \
- \
- \
- extern "C" void ecp_lecture_##_name##_free ( _type _qual * data) { \
- CalciumInterface::ecp_free< _type, _name >(data); \
- }; \
- \
- \
- extern "C" CalciumTypes::InfoType ecp_ecriture_##_name (void * component, int dependencyType, \
- CalTimeType< _type _qual >::TimeType *t, \
- long i, \
- const char * const nomvar, size_t bufferLength, \
- _type _qual * data ) { \
- Superv_Component_i * _component = static_cast<Superv_Component_i *>(component); \
- /* Je ne sais pas pourquoi, je n'arrive pas à passer t par valeur : corruption de la pile*/ \
- double _t=*t; \
- size_t _bufferLength=bufferLength; \
- if ( IsSameType< _name , cplx >::value ) _bufferLength=_bufferLength*2; \
- DEBTRACE( "-------- CalciumInterface(ecriture Inter Part) MARK 1 ------------------" ) \
- try { \
- /*printf("-------- CalciumInterface(ecriture Inter Part), cp_name : Nom de la var. de type %s : %s\n",#_type,nomvar);*/ \
- DEBTRACE( "----------->-" << nomvar ) \
- CalciumInterface::ecp_ecriture< _type, _name >( *_component, \
- dependencyType, \
- _t,i,nomvar,_bufferLength,*data); \
- } catch ( const CalciumException & ex) { \
- std::cerr << ex.what() << std::endl; \
- return ex.getInfo(); \
- } catch ( ... ) { \
- std::cerr << "Unexpected exception " << std::endl; \
- return CalciumTypes::CPATAL; \
- } \
- DEBTRACE( "-------- CalciumInterface(ecriture Inter Part), Valeur de data :" << data ) \
- return CalciumTypes::CPOK; \
- }; \
-
-
-
-#define STAR *
-// Le premier argument est utilisée :
-// - comme suffixe dans la définition des noms ecp_lecture_ , ecp_ecriture_ et ecp_free_
-// - comme second argument template à l'appel de la méthode C++ correspondante
-// ( le type de port correspondant est alors obtenu par un trait)
-// Le second argument est utilisée :
-// - pour typer le paramètre data de la procédure générée
-// - pour déduire le type des paramètres t, ti tf via un trait
-// - comme premier paramètre template à l'appel de la méthode C++ correspondante
-// (pour typer les données passées en paramètre )
-// Notons que dans le cas CALCIUM_C2CPP_INTERFACE_(int,int,), le type int n'existe pas
-// en CORBA, le port CALCIUM correspondant utilise une séquence de long. La méthode
-// C++ CALCIUM de lecture repère cette différence de type et charge
-// le manipulateur de données d'effectuer une recopie (qui fonctionne si les types sont compatibles).
-CALCIUM_C2CPP_INTERFACE_(int,int,);
-CALCIUM_C2CPP_INTERFACE_(float,float, );
-CALCIUM_C2CPP_INTERFACE_(double,double,);
-// Fonctionne mais essai suivant pour simplification de Calcium.c CALCIUM_C2CPP_INTERFACE_(bool,bool,);
-CALCIUM_C2CPP_INTERFACE_(bool,int,);
-CALCIUM_C2CPP_INTERFACE_(cplx,float,);
-CALCIUM_C2CPP_INTERFACE_(str,char*,);
-
-// INTERFACE C/CPP pour les chaines de caractères
-// Le paramètre supplémentaire strsize n'étant pas utilisé
-// j'utilise la génération par la macro CALCIUM_C2CPP_INTERFACE_(str,char*,);
-// extern "C" CalciumTypes::InfoType ecp_lecture_str (void * component, int dependencyType,
-// float * ti, float * tf, long * i,
-// const char * const nomvar, size_t bufferLength,
-// size_t * nRead, char ** *data, size_t strsize ) {
-
-// Superv_Component_i * _component = static_cast<Superv_Component_i *>(component);
-// double _ti=*ti;
-// double _tf=*tf;
-// size_t _nRead=0;
-// size_t _bufferLength=bufferLength;
-// CalciumTypes::DependencyType dependencyType=
-// static_cast<CalciumTypes::DependencyType>(dependencyType);
-
-// // - GERER POINTEUR NULL : NOTHING TODO
-// // - VERIFIER LA TAILLE DES CHAINES RETOURNEES (ELLES DEVRAIENT ETRES CORRECTES SI L'ECRITURE EST BIEN CODEE.)
-
-// DEBTRACE( "-------- CalciumInterface(lecture Inter Part) MARK 1 ------------------" )
-// try {
-// CalciumInterface::ecp_lecture< char*, char* >( *_component,
-// dependencyType,
-// _ti, _tf, *i,
-// nomvar,
-// _bufferLength, _nRead, *data);
-// } catch ( const CalciumException & ex) {
-// DEBTRACE( ex.what() );
-// return ex.getInfo();
-// }
-
-// *nRead = _nRead;
-
-// if (dependencyType == CalciumTypes::CP_SEQUENTIEL )
-// *ti=(float)(_ti);
-
-// DEBTRACE( "-------- CalciumInterface(lecture Inter Part), Data Ptr :" << *data ) ;
-
-// return CalciumTypes::CPOK;
-// };
-
-
-// extern "C" void ecp_lecture_str_free (char** data) {
-// CalciumInterface::ecp_free< char*, char* >(data);
-// };
-
-
-// extern "C" CalciumTypes::InfoType ecp_ecriture_str (void * component, int dependencyType,
-// float *t, long i,
-// const char * const nomvar, size_t bufferLength,
-// char ** data, int strsize ) {
-
-// Superv_Component_i * _component = static_cast<Superv_Component_i *>(component);
-// /* Je ne sais pas pourquoi, je n'arrive pas à passer t par valeur : corruption de la pile*/
-// double _t=*t;
-// size_t _bufferLength=bufferLength;
-
-// // - VERIFIER LA TAILLE DES CHAINES RETOURNEES (ELLES DEVRAIENT ETRES CORRECTES SI L'ECRITURE EST BIEN CODEE.)
-
-// DEBTRACE( "-------- CalciumInterface(ecriture Inter Part) MARK 1 ------------------" )
-// try {
-// std::string essai(nomvar);
-// DEBTRACE( "----------->-" << nomvar )
-// CalciumInterface::ecp_ecriture< char*, char* >( *_component,
-// static_cast<CalciumTypes::DependencyType>(dependencyType),
-// _t,i,nomvar,_bufferLength,*data);
-// } catch ( const CalciumException & ex) {
-// std::cerr << ex.what() << std::endl;
-// return ex.getInfo();
-// }
-// DEBTRACE( "-------- CalciumInterface(ecriture Inter Part), Valeur de data :" << data )
-// return CalciumTypes::CPOK;
-// };
#endif
--- /dev/null
+/* Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
+
+Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Lesser General Public
+License as published by the Free Software Foundation; either
+version 2.1 of the License.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+See http: www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+
+File : CalciumInterface.hxx
+Author : Eric Fayolle (EDF)
+Module : KERNEL
+Modified by : $LastChangedBy$
+Date : $LastChangedDate: 2007-03-01 13:27:58 +0100 (jeu, 01 mar 2007) $
+Id : $Id$
+*/
+
+#ifndef _CALCIUM_MACRO_C_INTERFACE_H_
+#define _CALCIUM_MACRO_C_INTERFACE_H_
+
+
+
+/****** CALCIUM_C2CPP_INTERFACE_HXX_ : ******/
+/****** Déclaration de ecp_lecture_... , ecp_ecriture_..., ecp_free_... ******/
+
+#define CALCIUM_C2CPP_INTERFACE_HXX_(_name,_porttype,_type,_qual) \
+ extern "C" CalciumTypes::InfoType ecp_lecture_##_name (void * component, int dependencyType, \
+ CalTimeType< _type _qual >::TimeType * ti, \
+ CalTimeType< _type _qual >::TimeType * tf, long * i, \
+ const char * const nomvar, size_t bufferLength, \
+ size_t * nRead, _type _qual ** data ); \
+ \
+ \
+ extern "C" void ecp_lecture_##_name##_free ( _type _qual * data); \
+ \
+ \
+ extern "C" CalciumTypes::InfoType ecp_ecriture_##_name (void * component, int dependencyType, \
+ CalTimeType< _type _qual >::TimeType *t, \
+ long i, \
+ const char * const nomvar, size_t bufferLength, \
+ _type _qual * data ); \
+
+
+
+
+
+/****** CALCIUM_C2CPP_INTERFACE_CXX_ : ******/
+/******Définition de ecp_lecture_... , ecp_ecriture_..., ecp_free_... ******/
+#define CALCIUM_C2CPP_INTERFACE_CXX_(_name,_porttype,_type,_qual) \
+ extern "C" CalciumTypes::InfoType ecp_lecture_##_name (void * component, int dependencyType, \
+ CalTimeType< _type _qual >::TimeType * ti, \
+ CalTimeType< _type _qual >::TimeType * tf, long * i, \
+ const char * const nomvar, size_t bufferLength, \
+ size_t * nRead, _type _qual ** data ) { \
+ Superv_Component_i * _component = static_cast<Superv_Component_i *>(component); \
+ double _ti=*ti; \
+ double _tf=*tf; \
+ size_t _nRead=0; \
+ size_t _bufferLength=bufferLength; \
+ \
+ if ( IsSameType< _porttype , cplx >::value ) _bufferLength*=2; \
+ DEBTRACE( "-------- CalciumInterface(lecture Inter Part) MARK 1 ------------------" ) \
+ try { \
+ CalciumInterface::ecp_lecture< _type,_porttype >( *_component, \
+ dependencyType, \
+ _ti, _tf, *i, \
+ nomvar, \
+ _bufferLength, _nRead, *data); \
+ } catch ( const CalciumException & ex) { \
+ DEBTRACE( ex.what() ); \
+ return ex.getInfo(); \
+ } catch ( ... ) { \
+ std::cerr << "Unexpected exception " << std::endl; \
+ return CalciumTypes::CPATAL; \
+ } \
+ if ( IsSameType< _porttype , cplx >::value ) { *nRead=_nRead/2; \
+ DEBTRACE( "-------- CalciumInterface(lecture Inter Part) IsSameType cplx -------------" ) \
+ DEBTRACE( "-------- CalciumInterface(lecture Inter Part) _nRead : " << _nRead ) \
+ DEBTRACE( "-------- CalciumInterface(lecture Inter Part) *nRead : " << *nRead ) \
+ } else *nRead = _nRead; \
+ if (dependencyType == CalciumTypes::CP_SEQUENTIEL ) \
+ *ti=(CalTimeType< _type _qual >::TimeType)(_ti); \
+ DEBTRACE( "-------- CalciumInterface(lecture Inter Part), Data Ptr :" << *data ) \
+ return CalciumTypes::CPOK; \
+ }; \
+ \
+ \
+ extern "C" void ecp_lecture_##_name##_free ( _type _qual * data) { \
+ CalciumInterface::ecp_free< _type, _porttype >(data); \
+ }; \
+ \
+ \
+ extern "C" CalciumTypes::InfoType ecp_ecriture_##_name (void * component, int dependencyType, \
+ CalTimeType< _type _qual >::TimeType *t, \
+ long i, \
+ const char * const nomvar, size_t bufferLength, \
+ _type _qual * data ) { \
+ DEBTRACE( "-------- CalciumInterface(ecriture Inter Part) MARK 0 ------------------" ) \
+ Superv_Component_i * _component = static_cast<Superv_Component_i *>(component); \
+ /* Je ne sais pas pourquoi, je n'arrive pas à passer t par valeur : corruption de la pile*/ \
+ double _t=*t; \
+ size_t _bufferLength=bufferLength; \
+ if ( IsSameType< _porttype , cplx >::value ) _bufferLength=_bufferLength*2; \
+ fprintf(stderr,"Beginning of ecp_ecriture_" #_name " : %s %ld %e\n",nomvar,i,_t); \
+ DEBTRACE( "-------- CalciumInterface(ecriture Inter Part) MARK 1 ------------------" ) \
+ try { \
+ /*printf("-------- CalciumInterface(ecriture Inter Part), cp_name : Nom de la var. de type %s : %s\n",#_type,nomvar);*/ \
+ DEBTRACE( "----------->-" << nomvar ) \
+ CalciumInterface::ecp_ecriture< _type, _porttype >( *_component, \
+ dependencyType, \
+ _t,i,nomvar,_bufferLength,*data); \
+ } catch ( const CalciumException & ex) { \
+ std::cerr << ex.what() << std::endl; \
+ return ex.getInfo(); \
+ } catch ( ... ) { \
+ std::cerr << "Unexpected exception " << std::endl; \
+ return CalciumTypes::CPATAL; \
+ } \
+ fprintf(stderr,"End of ecp_ecriture_" #_name " : %s %ld %e\n",nomvar,i,_t); \
+ DEBTRACE( "-------- CalciumInterface(ecriture Inter Part), Valeur de data :" << data ) \
+ return CalciumTypes::CPOK; \
+ }; \
+
+
+#endif
template <class T> struct ProvidesPortTraits {
typedef UnknownProvidesPortType<T> PortType;
};
-template <> struct ProvidesPortTraits<int> {
+struct integer {};
+template <> struct ProvidesPortTraits<integer> {
typedef calcium_integer_port_provides PortType;
};
+template <> struct ProvidesPortTraits<int> {
+ typedef calcium_intc_port_provides PortType;
+};
template <> struct ProvidesPortTraits<long> {
- typedef calcium_integer_port_provides PortType;
+ typedef calcium_long_port_provides PortType;
};
template <> struct ProvidesPortTraits<float> {
typedef calcium_real_port_provides PortType;
template <> struct ProvidesPortTraits<str> {
typedef calcium_string_port_provides PortType;
};
+// Définition du type intc pour obtenir le type de port
+// correspondant
+struct intc {};
+template <> struct ProvidesPortTraits<intc> {
+ typedef calcium_intc_port_provides PortType;
+};
template < typename T > struct StarTrait { typedef T NonStarType; };
template <class T> struct UsesPortTraits {
typedef UnknownUsesPortType<T> PortType;
};
-template <> struct UsesPortTraits<int> {
+template <> struct UsesPortTraits<integer> {
typedef calcium_integer_port_uses PortType;
};
+template <> struct UsesPortTraits<int> {
+ typedef calcium_intc_port_uses PortType;
+};
template <> struct UsesPortTraits<long> {
- typedef calcium_integer_port_uses PortType;
+ typedef calcium_long_port_uses PortType;
};
template <> struct UsesPortTraits<float> {
typedef calcium_real_port_uses PortType;
template <> struct UsesPortTraits<cplx> {
typedef calcium_complex_port_uses PortType;
};
+template <> struct UsesPortTraits<intc> {
+ typedef calcium_intc_port_uses PortType;
+};
#endif
CALCIUM_GENERIC_PROVIDES_PORT_CXX(calcium_integer_port_provides)
+CALCIUM_GENERIC_PROVIDES_PORT_CXX(calcium_long_port_provides)
+
+CALCIUM_GENERIC_PROVIDES_PORT_CXX(calcium_intc_port_provides)
+
CALCIUM_GENERIC_PROVIDES_PORT_CXX(calcium_real_port_provides)
CALCIUM_GENERIC_PROVIDES_PORT_CXX(calcium_double_port_provides)
+++ /dev/null
-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-// Modified by : $LastChangedBy$
-// Date : $LastChangedDate: 2007-03-01 13:40:26 +0100 (Thu, 01 Mar 2007) $
-// Id : $Id$
-//
-#ifndef _CALCIUM_PORT_PROVIDES_HXX_
-#define _CALCIUM_PORT_PROVIDES_HXX_
-
-#include <SALOMEconfig.h>
-
-#include "Calcium_Ports.hh"
-#include "CalciumGenericProvidesPort.hxx"
-#include "CalciumCouplingPolicy.hxx"
-
-
-CALCIUM_GENERIC_PROVIDES_PORT_HXX(calcium_integer_port_provides, \
- POA_Ports::Calcium_Ports::Calcium_Integer_Port, \
- seq_u_manipulation<Ports::Calcium_Ports::seq_long,CORBA::Long> ) \
-
-CALCIUM_GENERIC_PROVIDES_PORT_HXX(calcium_real_port_provides, \
- POA_Ports::Calcium_Ports::Calcium_Real_Port, \
- seq_u_manipulation<Ports::Calcium_Ports::seq_float,CORBA::Float> ) \
-
-CALCIUM_GENERIC_PROVIDES_PORT_HXX(calcium_double_port_provides, \
- POA_Ports::Calcium_Ports::Calcium_Double_Port, \
- seq_u_manipulation<Ports::Calcium_Ports::seq_double,CORBA::Double> ) \
-
-CALCIUM_GENERIC_PROVIDES_PORT_HXX(calcium_complex_port_provides, \
- POA_Ports::Calcium_Ports::Calcium_Complex_Port, \
- seq_u_manipulation<Ports::Calcium_Ports::seq_float,CORBA::Float> ) \
-
-CALCIUM_GENERIC_PROVIDES_PORT_HXX(calcium_logical_port_provides, \
- POA_Ports::Calcium_Ports::Calcium_Logical_Port, \
- seq_u_manipulation<Ports::Calcium_Ports::seq_boolean,CORBA::Boolean> ) \
-
-CALCIUM_GENERIC_PROVIDES_PORT_HXX(calcium_string_port_provides, \
- POA_Ports::Calcium_Ports::Calcium_String_Port, \
- seq_u_manipulation<Ports::Calcium_Ports::seq_string,char *> ) \
-
-#endif
--- /dev/null
+// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// Modified by : $LastChangedBy$
+// Date : $LastChangedDate: 2007-03-01 13:40:26 +0100 (Thu, 01 Mar 2007) $
+// Id : $Id$
+//
+#ifndef _CALCIUM_PORT_PROVIDES_HXX_
+#define _CALCIUM_PORT_PROVIDES_HXX_
+
+#include <SALOMEconfig.h>
+
+#include "Calcium_Ports.hh"
+#include "CalciumGenericProvidesPort.hxx"
+#include "CalciumCouplingPolicy.hxx"
+
+
+CALCIUM_GENERIC_PROVIDES_PORT_HXX(calcium_integer_port_provides, \
+ POA_Ports::Calcium_Ports::Calcium_Integer_Port, \
+ seq_u_manipulation<Ports::Calcium_Ports::seq_integer,@CALCIUM_CORBA_INT_F77@> ) \
+
+CALCIUM_GENERIC_PROVIDES_PORT_HXX(calcium_long_port_provides, \
+ POA_Ports::Calcium_Ports::Calcium_Long_Port, \
+ seq_u_manipulation<Ports::Calcium_Ports::seq_long_long,CORBA::LongLong> ) \
+
+CALCIUM_GENERIC_PROVIDES_PORT_HXX(calcium_intc_port_provides, \
+ POA_Ports::Calcium_Ports::Calcium_Intc_Port, \
+ seq_u_manipulation<Ports::Calcium_Ports::seq_long,CORBA::Long> ) \
+
+CALCIUM_GENERIC_PROVIDES_PORT_HXX(calcium_real_port_provides, \
+ POA_Ports::Calcium_Ports::Calcium_Real_Port, \
+ seq_u_manipulation<Ports::Calcium_Ports::seq_float,CORBA::Float> ) \
+
+CALCIUM_GENERIC_PROVIDES_PORT_HXX(calcium_double_port_provides, \
+ POA_Ports::Calcium_Ports::Calcium_Double_Port, \
+ seq_u_manipulation<Ports::Calcium_Ports::seq_double,CORBA::Double> ) \
+
+CALCIUM_GENERIC_PROVIDES_PORT_HXX(calcium_complex_port_provides, \
+ POA_Ports::Calcium_Ports::Calcium_Complex_Port, \
+ seq_u_manipulation<Ports::Calcium_Ports::seq_float,CORBA::Float> ) \
+
+CALCIUM_GENERIC_PROVIDES_PORT_HXX(calcium_logical_port_provides, \
+ POA_Ports::Calcium_Ports::Calcium_Logical_Port, \
+ seq_u_manipulation<Ports::Calcium_Ports::seq_boolean,CORBA::Boolean> ) \
+
+CALCIUM_GENERIC_PROVIDES_PORT_HXX(calcium_string_port_provides, \
+ POA_Ports::Calcium_Ports::Calcium_String_Port, \
+ seq_u_manipulation<Ports::Calcium_Ports::seq_string,char *> ) \
+
+#endif
#ifndef _COPY_TO_CORBA_SPACE_HXX_
#define _COPY_TO_CORBA_SPACE_HXX_
+
#include <string>
#include <iostream>
#include "CalciumPortTraits.hxx"
// Le PORT doit être capable de répondre aux demandes de lecture
// multiples d'une donnée pour une même estampille et doit donc garder un pointeur valide
// sur le buffer. Il se pose cependant un problème s'il décide
- // de supprimer la donnée alors que des client utilise le buffer (historique) !
+ // de supprimer la donnée alors que des client utilise le buffer (historique calcium) !
// La seule façon de gérer proprement cette situation est d'utiliser un shared_pointer (TODO).
// Pour l'instant l'utilisateur du mode zero copie doit s'assurer que le niveau d'historique
// utilisé par le port est compatible avec son utilisation des buffers. Il doit
- // être également conscient que s'il modifie le buffer, il est modifier pour tous les
+ // être également conscient que s'il modifie le buffer, il est modifié pour tous les
// utilisateurs actuels et futurs.
//REF: InnerType * dataPtr = DataManipulator::getPointer(corbaData,true);
// Cette ligne poserait uun problème dans la méthode appelante, si elle
// ne testait pas que les types utilisateurs et CORBA sont identiques :
// ex : InnerType == Corba::Long et d'un T == int
- // C'est l'objet de la procédure suivante
+ // C'est l'objet de la spécialisation ci-dessous.
data = dataPtr;
// En zero copie l'utilisateur doit appeler ecp_free ( cas ou un buffer intermédiaire
calcium_uses_port.hxx \
CalciumGenericUsesPort.hxx \
calcium_provides_port.hxx \
- CalciumProvidesPort.hxx \
- calcium_integer_port_uses.hxx \
+ calcium_intc_port_uses.hxx \
+ calcium_long_port_uses.hxx \
calcium_real_port_uses.hxx \
calcium_double_port_uses.hxx \
calcium_string_port_uses.hxx \
CalciumException.hxx \
CalciumTypes.hxx \
CalciumCxxInterface.hxx \
+ CalciumMacroCInterface.hxx \
+ CalciumCInterface.hxx \
CalciumInterface.hxx \
Copy2UserSpace.hxx \
Copy2CorbaSpace.hxx \
CalciumPortTraits.hxx \
calcium.h \
+ calciumf.h \
Calcium.hxx \
calciumP.h \
calciumE.h \
version.h \
calcium.hf
-EXTRA_DIST=fortoc.h
+nodist_salomeinclude_HEADERS = calcium_integer_port_uses.hxx CalciumProvidesPort.hxx CalciumFortranInt.h
+
+EXTRA_DIST=fortoc.h calcium_integer_port_uses.hxx.in CalciumProvidesPort.hxx.in CalciumFortranInt.h.in
+
+calcium_integer_port_uses.hxx: calcium_integer_port_uses.hxx.in
+CalciumProvidesPort.hxx : CalciumProvidesPort.hxx.in
+CalciumFortranInt.h : CalciumFortranInt.h.in
+
#
# ===============================================================
# Local definitions
CalciumCouplingPolicy.cxx \
CorbaTypes2CalciumTypes.cxx \
CalciumTypes2CorbaTypes.cxx \
+ CalciumCInterface.cxx \
CalciumProvidesPort.cxx \
Calcium.cxx \
calcium_destructors_port_uses.cxx
test_DataIdContainer_LDFLAGS = $(COMMON_LIBS)
+CLEANFILES = calcium_integer_port_uses.hxx CalciumProvidesPort.hxx CalciumFortranInt.h
#endif
);
+extern int cp_elg(
+/* ------ */
+#if CPNeedPrototype
+ void * component /* Pointeur de type Superv_Component_i* sur le */
+ /* composant SALOME Supervisable */,
+ int /* E Type de dependance */
+ /* CP_TEMPS, CP_ITERATION */,
+ float /* E Pas de temps a ecrire */,
+ int /* E Pas d'iteration a ecrire */,
+ char * /* E Nom de la variable a ecrire */,
+ int /* E Nombre de valeurs a ecrire */,
+ long * /* E Tableau d'entiers a ecrire */
+#endif
+);
+
extern int cp_ere(
/* ------ */
#if CPNeedPrototype
// Module : KERNEL
//
#include "calcium_integer_port_uses.hxx"
+#include "calcium_long_port_uses.hxx"
+#include "calcium_intc_port_uses.hxx"
#include "calcium_real_port_uses.hxx"
#include "calcium_double_port_uses.hxx"
#include "calcium_string_port_uses.hxx"
calcium_real_port_uses::~calcium_real_port_uses(void) {};
calcium_double_port_uses::~calcium_double_port_uses(void) {};
calcium_integer_port_uses::~calcium_integer_port_uses(void) {};
+calcium_long_port_uses::~calcium_long_port_uses(void) {};
+calcium_intc_port_uses::~calcium_intc_port_uses(void) {};
calcium_logical_port_uses::~calcium_logical_port_uses(void) {};
calcium_complex_port_uses::~calcium_complex_port_uses(void) {};
calcium_string_port_uses::~calcium_string_port_uses(void) {};
--- /dev/null
+// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// File : calcium_int_port_uses.hxx
+// Author : Eric Fayolle (EDF)
+// Module : KERNEL
+// Modified by : $LastChangedBy$
+// Date : $LastChangedDate: 2007-02-28 15:26:32 +0100 (mer, 28 fév 2007) $
+// Id : $Id$
+//
+#ifndef _CALCIUM_INTC_PORT_USES_HXX_
+#define _CALCIUM_INTC_PORT_USES_HXX_
+
+#include <SALOMEconfig.h>
+
+#include "Calcium_Ports.hh"
+#include "CalciumGenericUsesPort.hxx"
+
+extern char _repository_Calcium_Intc_Port_name[];
+
+class calcium_intc_port_uses :
+ public virtual CalciumGenericUsesPort< seq_u_manipulation<Ports::Calcium_Ports::seq_long,
+ CORBA::Long >,
+ Ports::Calcium_Ports::Calcium_Intc_Port,
+ _repository_Calcium_Intc_Port_name
+ >
+{
+ public :
+
+ virtual ~calcium_intc_port_uses();
+
+};
+
+#endif
+++ /dev/null
-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-// File : calcium_integer_port_uses.hxx
-// Author : Eric Fayolle (EDF)
-// Module : KERNEL
-// Modified by : $LastChangedBy$
-// Date : $LastChangedDate: 2007-02-28 15:26:32 +0100 (mer, 28 fév 2007) $
-// Id : $Id$
-//
-#ifndef _CALCIUM_INTEGER_PORT_USES_HXX_
-#define _CALCIUM_INTEGER_PORT_USES_HXX_
-
-#include <SALOMEconfig.h>
-
-#include "Calcium_Ports.hh"
-#include "CalciumGenericUsesPort.hxx"
-
-extern char _repository_Calcium_Integer_Port_name[];
-
-class calcium_integer_port_uses :
- public virtual CalciumGenericUsesPort< seq_u_manipulation<Ports::Calcium_Ports::seq_long,
- CORBA::Long >,
- Ports::Calcium_Ports::Calcium_Integer_Port,
- _repository_Calcium_Integer_Port_name
- >
-{
- public :
-
- virtual ~calcium_integer_port_uses();
-
-};
-
-#endif
--- /dev/null
+// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// File : calcium_integer_port_uses.hxx
+// Author : Eric Fayolle (EDF)
+// Module : KERNEL
+// Modified by : $LastChangedBy$
+// Date : $LastChangedDate: 2007-02-28 15:26:32 +0100 (mer, 28 fév 2007) $
+// Id : $Id$
+//
+#ifndef _CALCIUM_INTEGER_PORT_USES_HXX_
+#define _CALCIUM_INTEGER_PORT_USES_HXX_
+
+#include <SALOMEconfig.h>
+
+#include "Calcium_Ports.hh"
+#include "CalciumGenericUsesPort.hxx"
+
+extern char _repository_Calcium_Integer_Port_name[];
+
+class calcium_integer_port_uses :
+ public virtual CalciumGenericUsesPort< seq_u_manipulation<Ports::Calcium_Ports::seq_integer,
+ @CALCIUM_CORBA_INT_F77@ >,
+ Ports::Calcium_Ports::Calcium_Integer_Port,
+ _repository_Calcium_Integer_Port_name
+ >
+{
+ public :
+
+ virtual ~calcium_integer_port_uses();
+
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// File : calcium_long_port_uses.hxx
+// Author : Eric Fayolle (EDF)
+// Module : KERNEL
+// Modified by : $LastChangedBy$
+// Date : $LastChangedDate: 2007-02-28 15:26:32 +0100 (mer, 28 fév 2007) $
+// Id : $Id$
+//
+#ifndef _CALCIUM_LONG_PORT_USES_HXX_
+#define _CALCIUM_LONG_PORT_USES_HXX_
+
+#include <SALOMEconfig.h>
+
+#include "Calcium_Ports.hh"
+#include "CalciumGenericUsesPort.hxx"
+
+extern char _repository_Calcium_Long_Port_name[];
+
+class calcium_long_port_uses :
+ public virtual CalciumGenericUsesPort< seq_u_manipulation<Ports::Calcium_Ports::seq_long_long,
+ CORBA::LongLong >,
+ Ports::Calcium_Ports::Calcium_Long_Port,
+ _repository_Calcium_Long_Port_name
+ >
+{
+ public :
+
+ virtual ~calcium_long_port_uses();
+
+};
+
+#endif
if ( type == "integer")
rtn_port = new calcium_integer_port_provides();
+ if ( type == "long")
+ rtn_port = new calcium_long_port_provides();
+ if ( type == "intc")
+ rtn_port = new calcium_intc_port_provides();
if ( type == "real")
rtn_port = new calcium_real_port_provides();
if ( type == "double")
if ( type == "integer")
rtn_port = new calcium_integer_port_uses();
+ if ( type == "long")
+ rtn_port = new calcium_long_port_uses();
+ if ( type == "intc")
+ rtn_port = new calcium_intc_port_uses();
if ( type == "real")
rtn_port = new calcium_real_port_uses();
if ( type == "double")
#include "CalciumProvidesPort.hxx"
#include "calcium_integer_port_uses.hxx"
+#include "calcium_long_port_uses.hxx"
+#include "calcium_intc_port_uses.hxx"
#include "calcium_real_port_uses.hxx"
#include "calcium_double_port_uses.hxx"
#include "calcium_string_port_uses.hxx"
// Id : $Id$
//
#include "calcium_integer_port_uses.hxx"
+#include "calcium_long_port_uses.hxx"
+#include "calcium_intc_port_uses.hxx"
#include "calcium_real_port_uses.hxx"
#include "calcium_double_port_uses.hxx"
#include "calcium_complex_port_uses.hxx"
#include "calcium_string_port_uses.hxx"
char _repository_Calcium_Integer_Port_name[]="IDL:Ports/Calcium_Ports/Calcium_Integer_Port:1.0";
+char _repository_Calcium_Long_Port_name[]="IDL:Ports/Calcium_Ports/Calcium_Long_Port:1.0";
+char _repository_Calcium_Intc_Port_name[]="IDL:Ports/Calcium_Ports/Calcium_Intc_Port:1.0";
char _repository_Calcium_Real_Port_name[]="IDL:Ports/Calcium_Ports/Calcium_Real_Port:1.0";
char _repository_Calcium_Double_Port_name[]="IDL:Ports/Calcium_Ports/Calcium_Double_Port:1.0";
char _repository_Calcium_Complex_Port_name[]="IDL:Ports/Calcium_Ports/Calcium_Complex_Port:1.0";
#include <stdlib.h>
#include "fortoc.h"
#include "calcium.h"
+#include "calciumf.h"
+#include "CalciumFortranInt.h"
#include <stdio.h>
static void* COMPO=0;
extern "C" {
#endif
-static void fstrtocstr(char *cstr, char *fstr,int fstr_len)
+
+static void fstrtocstr(char *cstr, char *fstr,cal_int fstr_len)
{
- int i,iend;
+ cal_int i,iend;
for (iend = fstr_len-1; iend >= 0; iend--)
if (fstr[iend] != ' ') break;
for (i = 0; i <= iend; i++)
cstr[i] = '\0';
}
-static void cstrtofstr(char *cstr, char *fstr,int fstr_len)
+static void cstrtofstr(char *cstr, char *fstr,cal_int fstr_len)
{
- int i, len;
+ cal_int i, len;
len = strlen(cstr);
if (len > fstr_len) len = fstr_len;
for (i = 0; i < len; i++)
fstr[i++] = ' ';
}
-static char * fstr1(char *nom,int nnom)
+static char * fstr1(char *nom,cal_int nnom)
{
char * cnom=(char*)malloc((nnom+1)*sizeof(char));
fstrtocstr(cnom,nom,nnom);
free(nom);
}
-void F_FUNC(cpcd,CPCD)(long *compo,STR_PSTR(nom),int *info STR_PLEN(nom))
+/**********************************************/
+/* INTERFACES DE DÉBUT ET DE FIN DE COUPLAGE */
+/**********************************************/
+
+void F_FUNC(cpcd,CPCD)(long *compo,STR_PSTR(nom),cal_int *info STR_PLEN(nom))
{
/* nom is OUT argument */
cp_cd((void *)*compo,STR_PTR(nom));
cstrtofstr(STR_PTR(nom),STR_PTR(nom),STR_LEN(nom));
}
-void F_FUNC(cplen,CPLEN)(long *compo,int *dep,float *ti,float *tf,int *iter,STR_PSTR(nom),
- int *max,int *n, int *tab,int *err STR_PLEN(nom))
+void F_FUNC(cpfin,CPFIN)(long *compo,cal_int *dep,cal_int *err)
+{
+ fprintf(stderr,"CPFIN: \n");
+ *err=cp_fin((void *)*compo,(int)*dep);
+}
+
+/**************************************/
+/* INTERFACES DE LECTURE */
+/**************************************/
+
+
+
+void F_FUNC(cplin,CPLIN)(long *compo,cal_int *dep,float *ti,float *tf,cal_int *iter,STR_PSTR(nom),
+ cal_int *max,cal_int *n, int *tab,cal_int *err STR_PLEN(nom))
+{
+ char* cnom=fstr1(STR_PTR(nom),STR_LEN(nom));
+ fprintf(stderr,"CPLIN: %s %f %f\n",cnom,*ti,*tf);
+
+#if !SIZEOF_INT
+#error "The macro SIZEOF_INT must be defined."
+#elif SIZEOF_INT == 4
+ *err=cp_lin_fort_((void *)*compo,*dep,ti,tf,iter,cnom,*max,n,tab);
+#else
+ fprintf(stderr,"End of CPLIN: %s : Can't use fortran INTEGER*4 because int C is not 32bits long on this machine.\n",
+ cnom);
+#endif
+ fprintf(stderr,"End of CPLIN: %s \n",cnom);
+ free_str1(cnom);
+}
+
+void F_FUNC(cpllg,CPLLG)(long *compo,cal_int *dep,float *ti,float *tf,cal_int *iter,STR_PSTR(nom),
+ cal_int *max,cal_int *n, long *tab,cal_int *err STR_PLEN(nom))
+{
+ char* cnom=fstr1(STR_PTR(nom),STR_LEN(nom));
+ fprintf(stderr,"CPLLG: %s %f %f\n",cnom,*ti,*tf);
+#if !SIZEOF_LONG
+#error "The macro SIZEOF_LONG must be defined."
+#elif SIZEOF_LONG == 8
+ *err=cp_llg_fort_((void *)*compo,*dep,ti,tf,iter,cnom,*max,n,tab);
+#else
+ fprintf(stderr,"End of CPLLG: %s : Can't use fortran INTEGER*8 because long C is not 64bits long on this machine.\n",
+ cnom);
+#endif
+ fprintf(stderr,"End of CPLLG: %s \n",cnom);
+ free_str1(cnom);
+}
+
+void F_FUNC(cplen,CPLEN)(long *compo,cal_int *dep,float *ti,float *tf,cal_int *iter,STR_PSTR(nom),
+ cal_int *max,cal_int *n, cal_int *tab,cal_int *err STR_PLEN(nom))
{
char* cnom=fstr1(STR_PTR(nom),STR_LEN(nom));
fprintf(stderr,"CPLEN: %s %f %f\n",cnom,*ti,*tf);
- *err=cp_len((void *)*compo,*dep,ti,tf,iter,cnom,*max,n,tab);
+ /*Les tests suivants n'empêchent pas l'utilisateur fortran de compiler son
+ module avec une taille d'entier différente de celle qu'il a précisée à SALOME.
+ Sans adaptation spécifique du code (integer*8, integer*4), ce cas de figure entrainera
+ inévitablement un crash.*/
+#if !(SIZEOF_FORTRAN_INTEGER && SIZEOF_INT && SIZEOF_LONG)
+# error "The macros SIZEOF_FORTRAN_INTEGER, SIZEOF_INT and SIZEOF_LONG must be defined."
+#elif ( SIZEOF_FORTRAN_INTEGER == SIZEOF_INT ) || ( SIZEOF_FORTRAN_INTEGER == SIZEOF_LONG )
+ *err=cp_len_fort_((void *)*compo,*dep,ti,tf,iter,cnom,*max,n,tab);
+#else
+# error "The SIZEOF_FORTRAN_INTEGER is not equal to SIZEOF_INT nor SIZEOF_LONG."
+#endif
fprintf(stderr,"End of CPLEN: %s \n",cnom);
free_str1(cnom);
}
-void F_FUNC(cpllo,CPLLO)(long *compo,int *dep,float *ti,float *tf,int *iter,STR_PSTR(nom),
- int *max,int *n, int *tab,int *err STR_PLEN(nom))
+
+void F_FUNC(cpllo,CPLLO)(long *compo,cal_int *dep,float *ti,float *tf,cal_int *iter,STR_PSTR(nom),
+ cal_int *max,cal_int *n, int *tab,cal_int *err STR_PLEN(nom))
{
char* cnom=fstr1(STR_PTR(nom),STR_LEN(nom));
fprintf(stderr,"CPLLO: %s %f %f\n",cnom,*ti,*tf);
- *err=cp_llo((void *)*compo,*dep,ti,tf,iter,cnom,*max,n,tab);
+ *err=cp_llo_fort_((void *)*compo,*dep,ti,tf,iter,cnom,*max,n,tab);
fprintf(stderr,"End of CPLLO: %s \n",cnom);
free_str1(cnom);
}
-void F_FUNC(cpldb,CPLDB)(long *compo,int *dep,double *ti,double *tf,int *iter,STR_PSTR(nom),
- int *max,int *n, double *tab,int *err STR_PLEN(nom))
+void F_FUNC(cpldb,CPLDB)(long *compo,cal_int *dep,double *ti,double *tf,cal_int *iter,STR_PSTR(nom),
+ cal_int *max,cal_int *n, double *tab,cal_int *err STR_PLEN(nom))
{
char* cnom=fstr1(STR_PTR(nom),STR_LEN(nom));
fprintf(stderr,"CPLDB: %s %f %f \n",cnom, *ti,*tf);
- *err=cp_ldb((void *)*compo,*dep,ti,tf,iter,cnom,*max,n,tab);
+ *err=cp_ldb_fort_((void *)*compo,*dep,ti,tf,iter,cnom,*max,n,tab);
fprintf(stderr,"End of CPLDB: %s %f %f \n",cnom,*ti,*tf);
free_str1(cnom);
}
-void F_FUNC(cplre,CPLRE)(long *compo,int *dep,float *ti,float *tf,int *iter,STR_PSTR(nom),
- int *max,int *n, float *tab,int *err STR_PLEN(nom))
+void F_FUNC(cplre,CPLRE)(long *compo,cal_int *dep,float *ti,float *tf,cal_int *iter,STR_PSTR(nom),
+ cal_int *max,cal_int *n, float *tab,cal_int *err STR_PLEN(nom))
{
char* cnom=fstr1(STR_PTR(nom),STR_LEN(nom));
fprintf(stderr,"CPLRE: %s %f %f \n",cnom, *ti,*tf);
- *err=cp_lre((void *)*compo,*dep,ti,tf,iter,cnom,*max,n,tab);
+ *err=cp_lre_fort_((void *)*compo,*dep,ti,tf,iter,cnom,*max,n,tab);
fprintf(stderr,"End of CPLRE: %s %f %f \n",cnom,*ti,*tf);
free_str1(cnom);
}
-void F_FUNC(cplcp,CPLCP)(long *compo,int *dep,float *ti,float *tf,int *iter,STR_PSTR(nom),
- int *max,int *n, float *tab,int *err STR_PLEN(nom))
+void F_FUNC(cplcp,CPLCP)(long *compo,cal_int *dep,float *ti,float *tf,cal_int *iter,STR_PSTR(nom),
+ cal_int *max,cal_int *n, float *tab,cal_int *err STR_PLEN(nom))
{
char* cnom=fstr1(STR_PTR(nom),STR_LEN(nom));
fprintf(stderr,"CPLCP: %s %f %f \n",cnom, *ti,*tf);
- *err=cp_lcp((void *)*compo,*dep,ti,tf,iter,cnom,*max,n,tab);
+ *err=cp_lcp_fort_((void *)*compo,*dep,ti,tf,iter,cnom,*max,n,tab);
fprintf(stderr,"End of CPLCP: %s %f %f \n",cnom,*ti,*tf);
free_str1(cnom);
}
-void F_FUNC(cplch,CPLCH)(long *compo,int *dep,float *ti,float *tf,int *iter,STR_PSTR(nom),
- int *max,int *n, char *tab,int *err STR_PLEN(nom) STR_PLEN(tab) )
+void F_FUNC(cplch,CPLCH)(long *compo,cal_int *dep,float *ti,float *tf,cal_int *iter,STR_PSTR(nom),
+ cal_int *max,cal_int *n, char *tab,cal_int *err STR_PLEN(nom) STR_PLEN(tab) )
{
- char **tabChaine=NULL;
- int index=0;
- char* cnom=fstr1(STR_PTR(nom),STR_LEN(nom));
+ char **tabChaine = NULL;
+ cal_int index = 0;
+ char* cnom = fstr1(STR_PTR(nom),STR_LEN(nom));
fprintf(stderr,"CPLCH: %s %f %f \n",cnom, *ti,*tf);
tabChaine = (char **) malloc(sizeof(char *) * (*max));
for (index = 0; index < *max; index++)
tabChaine[index] = (char *) malloc(sizeof(char) * (STR_LEN(tab)+1));
- *err=cp_lch((void *)*compo,*dep,ti,tf,iter,cnom,*max,n,tabChaine,STR_LEN(tab));
+ *err=cp_lch_fort_((void *)*compo,*dep,ti,tf,iter,cnom,*max,n,tabChaine,STR_LEN(tab));
for (index = 0; index < *n; index++)
strncpy(&tab[index * STR_LEN(tab)], tabChaine[index], strlen(tabChaine[index]));
free_str1(cnom);
}
-void F_FUNC(cpech,CPECH)(long *compo,int *dep,float *ti,int *iter,STR_PSTR(nom),int *n, char *tab,int *err
+
+/***************************/
+/* INTERFACES D'ECRITURE */
+/***************************/
+
+void F_FUNC(cpech,CPECH)(long *compo,cal_int *dep,float *ti,cal_int *iter,STR_PSTR(nom),cal_int *n, char *tab,cal_int *err
STR_PLEN(nom) STR_PLEN(tab))
{
char ** tabChaine=NULL;
- int index=0,index2=0;
+ cal_int index=0,index2=0;
char* cnom=fstr1(STR_PTR(nom),STR_LEN(nom));
fprintf(stderr,"CPECH: %s %f \n",cnom, *ti);
}
}
- *err=cp_ech((void *)*compo,*dep,*ti,*iter,cnom,*n,tabChaine,STR_LEN(tab) );
+ *err=cp_ech_fort_((void *)*compo,*dep,*ti,*iter,cnom,*n,tabChaine,STR_LEN(tab) );
fprintf(stderr,"End of CPECH: %s %f \n",cnom, *ti);
if (tabChaine != (char **) NULL) {
free_str1(cnom);
}
-void F_FUNC(cpedb,CPEDB)(long *compo,int *dep,double *ti,int *iter,STR_PSTR(nom),int *n, double *tab,int *err STR_PLEN(nom))
+void F_FUNC(cpedb,CPEDB)(long *compo,cal_int *dep,double *ti,cal_int *iter,STR_PSTR(nom),cal_int *n, double *tab,cal_int *err STR_PLEN(nom))
{
char* cnom=fstr1(STR_PTR(nom),STR_LEN(nom));
fprintf(stderr,"CPEDB: %s %f \n",cnom, *ti);
- *err=cp_edb((void *)*compo,*dep,*ti,*iter,cnom,*n,tab);
+ *err=cp_edb_fort_((void *)*compo,*dep,*ti,*iter,cnom,*n,tab);
fprintf(stderr,"End of CPEDB: %s %f \n",cnom, *ti);
free_str1(cnom);
}
-void F_FUNC(cpere,CPERE)(long *compo,int *dep,float *ti,int *iter,STR_PSTR(nom),int *n, float *tab,int *err STR_PLEN(nom))
+void F_FUNC(cpere,CPERE)(long *compo,cal_int *dep,float *ti,cal_int *iter,STR_PSTR(nom),cal_int *n, float *tab,cal_int *err STR_PLEN(nom))
{
char* cnom=fstr1(STR_PTR(nom),STR_LEN(nom));
fprintf(stderr,"CPERE: %s %f \n",cnom, *ti);
- *err=cp_ere((void *)*compo,*dep,*ti,*iter,cnom,*n,tab);
+ *err=cp_ere_fort_((void *)*compo,*dep,*ti,*iter,cnom,*n,tab);
fprintf(stderr,"End of CPERE: %s %f \n",cnom, *ti);
free_str1(cnom);
}
-void F_FUNC(cpecp,CPECP)(long *compo,int *dep,float *ti,int *iter,STR_PSTR(nom),int *n, float *tab,int *err STR_PLEN(nom))
+void F_FUNC(cpecp,CPECP)(long *compo,cal_int *dep,float *ti,cal_int *iter,STR_PSTR(nom),cal_int *n, float *tab,cal_int *err STR_PLEN(nom))
{
char* cnom=fstr1(STR_PTR(nom),STR_LEN(nom));
fprintf(stderr,"CPECP: %s %f \n",cnom, *ti);
- *err=cp_ecp((void *)*compo,*dep,*ti,*iter,cnom,*n,tab);
+ *err=cp_ecp_fort_((void *)*compo,*dep,*ti,*iter,cnom,*n,tab);
fprintf(stderr,"End of CPECP: %s %f \n",cnom, *ti);
free_str1(cnom);
}
-void F_FUNC(cpeen,CPEEN)(long *compo,int *dep,float *ti,int *iter,STR_PSTR(nom),int *n, int *tab,int *err STR_PLEN(nom))
+
+void F_FUNC(cpein,CPEIN)(long *compo,cal_int *dep,float *ti,cal_int *iter,STR_PSTR(nom),cal_int *n, int *tab,cal_int *err STR_PLEN(nom))
+{
+
+ char* cnom=fstr1(STR_PTR(nom),STR_LEN(nom));
+ fprintf(stderr,"CPEIN: %s %f %d\n",cnom, *ti,*iter);
+#if !SIZEOF_INT
+#error "The macro SIZEOF_INT must be defined."
+#elif SIZEOF_INT == 4
+ *err=cp_ein_fort_((void *)*compo,*dep,*ti,*iter,cnom,*n,tab);
+#else
+ fprintf(stderr,"CPEIN: %s %f %d : Can't use fortran INTEGER*4 because int C is not 32bits long on this machine.\n",
+ cnom, *ti,*iter);
+#endif
+ fprintf(stderr,"End of CPIN: %s %f \n",cnom,*ti);
+ free_str1(cnom);
+}
+
+void F_FUNC(cpelg,CPELG)(long *compo,cal_int *dep,float *ti,cal_int *iter,STR_PSTR(nom),cal_int *n, long *tab,cal_int *err STR_PLEN(nom))
+{
+
+ char* cnom=fstr1(STR_PTR(nom),STR_LEN(nom));
+ fprintf(stderr,"CPELG: %s %f %d\n",cnom, *ti,*iter);
+#if !SIZEOF_LONG
+#error "The macro SIZEOF_LONG must be defined."
+#elif SIZEOF_LONG == 8
+ *err=cp_elg_fort_((void *)*compo,*dep,*ti,*iter,cnom,*n,tab);
+#else
+ fprintf(stderr,"CPELG: %s %f %d : Can't use fortran INTEGER*8 because long C is not 64bits long on this machine.\n",
+ cnom, *ti,*iter);
+#endif
+ fprintf(stderr,"End of CPELG: %s %f \n",cnom,*ti);
+ free_str1(cnom);
+}
+
+void F_FUNC(cpeen,CPEEN)(long *compo,cal_int *dep,float *ti,cal_int *iter,STR_PSTR(nom),cal_int *n, cal_int *tab,cal_int *err STR_PLEN(nom))
{
char* cnom=fstr1(STR_PTR(nom),STR_LEN(nom));
fprintf(stderr,"CPEEN: %s %f %d\n",cnom, *ti,*iter);
- *err=cp_een((void *)*compo,*dep,*ti,*iter,cnom,*n,tab);
+ /*Les tests suivants n'empêchent pas l'utilisateur fortran de compiler son
+ module avec une taille d'entier différente de celle qu'il a précisée à SALOME.
+ Ce cas de figure entrainera inévitablement un crash.*/
+#if !(SIZEOF_FORTRAN_INTEGER && SIZEOF_INT && SIZEOF_LONG)
+# error "The macros SIZEOF_FORTRAN_INTEGER, SIZEOF_INT and SIZEOF_LONG must be defined."
+#elif ( SIZEOF_FORTRAN_INTEGER == SIZEOF_INT ) || ( SIZEOF_FORTRAN_INTEGER == SIZEOF_LONG )
+ *err=cp_een_fort_((void *)*compo,*dep,*ti,*iter,cnom,*n,tab);
+#else
+# error "The SIZEOF_FORTRAN_INTEGER is not equal to SIZEOF_INT nor SIZEOF_LONG."
+#endif
fprintf(stderr,"End of CPEEN: %s %f \n",cnom,*ti);
free_str1(cnom);
}
-void F_FUNC(cpelo,CPELO)(long *compo,int *dep,float *ti,int *iter,STR_PSTR(nom),int *n, int *tab,int *err STR_PLEN(nom))
+void F_FUNC(cpelo,CPELO)(long *compo,cal_int *dep,float *ti,cal_int *iter,STR_PSTR(nom),cal_int *n, int *tab,cal_int *err STR_PLEN(nom))
{
char* cnom=fstr1(STR_PTR(nom),STR_LEN(nom));
fprintf(stderr,"CPELO: %s %f %d\n",cnom, *ti,*iter);
- *err=cp_elo((void *)*compo,*dep,*ti,*iter,cnom,*n,tab);
+ *err=cp_elo_fort_((void *)*compo,*dep,*ti,*iter,cnom,*n,tab);
fprintf(stderr,"End of CPELO: %s %f \n",cnom,*ti);
free_str1(cnom);
}
-void F_FUNC(cpfin,CPFIN)(long *compo,int *dep,int *err)
-{
- fprintf(stderr,"CPFIN: \n");
- *err=cp_fin((void *)*compo,*dep);
-}
#ifdef __cplusplus
}
--- /dev/null
+// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// File : calcium.h
+// Author : Eric Fayolle (EDF)
+// Module : KERNEL
+
+/* Outils d'Aide au Couplage de Code de Calcul : $Id$ */
+
+#ifndef __CALCIUMF_H
+#define __CALCIUMF_H
+
+#include "CalciumFortranInt.h"
+
+/*TODO CPCD... */
+
+#define STAR *
+#define LCH_LAST_PARAM ,int strsize
+
+
+#define CALCIUM_ECR_INTERFACE_C_H(_name,_timeType,_calInt,_type,_typeName,_qual,lastarg) \
+ extern _calInt cp_##_name (void * component, _calInt mode, \
+ _timeType t, _calInt i, \
+ char * nomvar, _calInt nbelem, \
+ _type _qual * data \
+ lastarg ) ; \
+
+
+CALCIUM_ECR_INTERFACE_C_H(een_fort_,float ,cal_int,cal_int,integer,,);
+CALCIUM_ECR_INTERFACE_C_H(elg_fort_,float ,cal_int,long ,long2integer,,);
+CALCIUM_ECR_INTERFACE_C_H(ein_fort_,float ,cal_int,int ,int2integer,,);
+CALCIUM_ECR_INTERFACE_C_H(ere_fort_,float ,cal_int,float ,float,,);
+CALCIUM_ECR_INTERFACE_C_H(edb_fort_,double,cal_int,double,double,,);
+CALCIUM_ECR_INTERFACE_C_H(elo_fort_,float ,cal_int,int ,bool,,); /*int pour bool ou cal_int */
+CALCIUM_ECR_INTERFACE_C_H(ecp_fort_,float ,cal_int,float ,cplx,,);
+CALCIUM_ECR_INTERFACE_C_H(ech_fort_,float ,cal_int,char ,str,STAR,LCH_LAST_PARAM );
+
+
+
+#define CALCIUM_LECT_INTERFACE_C_H(_name,_timeType,_calInt,_type,_typeName,_qual,lastarg) \
+ extern _calInt cp_##_name (void * component, _calInt mode, \
+ _timeType * ti, _timeType * tf, _calInt * i, \
+ char * nomvar, _calInt bufferLength, \
+ _calInt * nRead, _type _qual * data \
+ lastarg ) ; \
+ \
+
+
+CALCIUM_LECT_INTERFACE_C_H(len_fort_,float ,cal_int,cal_int ,integer,,);
+CALCIUM_LECT_INTERFACE_C_H(llg_fort_,float ,cal_int,long ,long2integer,,);
+CALCIUM_LECT_INTERFACE_C_H(lin_fort_,float ,cal_int,int ,int2integer,,);
+CALCIUM_LECT_INTERFACE_C_H(lre_fort_,float ,cal_int,float ,float,,);
+CALCIUM_LECT_INTERFACE_C_H(ldb_fort_,double,cal_int,double ,double,,);
+CALCIUM_LECT_INTERFACE_C_H(llo_fort_,float ,cal_int,int ,bool,,); /*int pour bool ou cal_int */
+CALCIUM_LECT_INTERFACE_C_H(lcp_fort_,float ,cal_int,float ,cplx,,);
+CALCIUM_LECT_INTERFACE_C_H(lch_fort_,float ,cal_int,char ,str,STAR, LCH_LAST_PARAM );
+
+
+
+#endif