]> SALOME platform Git repositories - tools/yacsgen.git/commitdiff
Salome HOME
Merge from V6_main_20120808 08Aug12
authorvsr <vsr@opencascade.com>
Thu, 9 Aug 2012 14:08:07 +0000 (14:08 +0000)
committervsr <vsr@opencascade.com>
Thu, 9 Aug 2012 14:08:07 +0000 (14:08 +0000)
136 files changed:
Examples/ast1/Makefile [new file with mode: 0644]
Examples/ast1/README.txt
Examples/ast1/components.py
Examples/ast1/fcompo/Makefile
Examples/ast1/fcompo/compo.f
Examples/ast1/myaster/Makefile
Examples/ast1/myaster/make_cata
Examples/ast2/Makefile [new file with mode: 0644]
Examples/ast2/README.txt
Examples/ast2/components.py
Examples/ast2/coupling.xml
Examples/ast2/coupling2.xml [new file with mode: 0644]
Examples/ast2/exeaster [new file with mode: 0755]
Examples/ast2/f.comm
Examples/ast2/fcompo/Makefile
Examples/ast2/fcompo/compo.f
Examples/ast2/myaster/Makefile
Examples/ast2/myaster/config.txt
Examples/ast2/myaster/make_exec
Examples/ast2/myaster/src/op0189.f
Examples/calcium1/Makefile [new file with mode: 0644]
Examples/calcium1/code1.f [new file with mode: 0644]
Examples/calcium1/components.py [new file with mode: 0644]
Examples/calcium1/coupling.xml [new file with mode: 0644]
Examples/calcium2/Makefile [new file with mode: 0644]
Examples/calcium2/code1.f [new file with mode: 0644]
Examples/calcium2/components.py [new file with mode: 0644]
Examples/calcium2/coupling.xml [new file with mode: 0644]
Examples/context.py [new file with mode: 0644]
Examples/cpp1/Makefile [new file with mode: 0644]
Examples/cpp1/README.txt
Examples/cpp1/components.py
Examples/cpp1/coupling.xml
Examples/cpp2/Makefile
Examples/cpp2/README.txt
Examples/cpp2/components.py
Examples/cpp2/prog.cxx
Examples/cppgui1/Makefile [new file with mode: 0644]
Examples/cppgui1/components.py [new file with mode: 0644]
Examples/cppgui1/cppcompos.png [new file with mode: 0644]
Examples/cppgui1/cppcomposGUI.cxx [new file with mode: 0644]
Examples/cppgui1/cppcomposGUI.h [new file with mode: 0644]
Examples/cppgui1/demo.ui [new file with mode: 0644]
Examples/cppgui1/exec.png [new file with mode: 0644]
Examples/cppgui1/index.rst [new file with mode: 0644]
Examples/cppgui1/myinterface.idl [new file with mode: 0644]
Examples/cppgui1/using.rst [new file with mode: 0644]
Examples/fort1/Makefile
Examples/fort1/README.txt
Examples/fort1/bidul.f
Examples/fort1/code1.f
Examples/fort1/code2.f
Examples/fort1/components.py
Examples/fort1/coupling.xml
Examples/fort2/Makefile
Examples/fort2/README.txt
Examples/fort2/code1.f
Examples/fort2/code2.f
Examples/fort2/components.py
Examples/fort2/prog1.sh [new file with mode: 0755]
Examples/fort2/prog2.sh [new file with mode: 0755]
Examples/hxx1/Makefile [new file with mode: 0644]
Examples/hxx1/README [new file with mode: 0644]
Examples/hxx1/component.py [new file with mode: 0644]
Examples/hxx1/cpp_component.tgz [new file with mode: 0644]
Examples/hxx1/test_compohxx.py [new file with mode: 0644]
Examples/makefile.inc [new file with mode: 0644]
Examples/paco1/Makefile [new file with mode: 0644]
Examples/paco1/README.txt [new file with mode: 0644]
Examples/paco1/components.py [new file with mode: 0644]
Examples/paco1/coupling.xml [new file with mode: 0644]
Examples/paco2/Makefile [new file with mode: 0644]
Examples/paco2/README.txt [new file with mode: 0644]
Examples/paco2/components.py [new file with mode: 0644]
Examples/paco2/coupling.xml [new file with mode: 0644]
Examples/paco3/Makefile [new file with mode: 0644]
Examples/paco3/README.txt [new file with mode: 0644]
Examples/paco3/components.py [new file with mode: 0644]
Examples/paco3/coupling.xml [new file with mode: 0644]
Examples/pacocontext.py [new file with mode: 0644]
Examples/pydoc1/Makefile [new file with mode: 0644]
Examples/pydoc1/components.py [new file with mode: 0644]
Examples/pydoc1/exec.png [new file with mode: 0644]
Examples/pydoc1/index.rst [new file with mode: 0644]
Examples/pydoc1/using.rst [new file with mode: 0644]
Examples/pygui1/Makefile [new file with mode: 0644]
Examples/pygui1/README.txt [new file with mode: 0644]
Examples/pygui1/components.py [new file with mode: 0644]
Examples/pygui1/demo.ui [new file with mode: 0644]
Examples/pygui1/exec.png [new file with mode: 0644]
Examples/pygui1/index.rst [new file with mode: 0644]
Examples/pygui1/myinterface.idl [new file with mode: 0644]
Examples/pygui1/pycompos.png [new file with mode: 0644]
Examples/pygui1/pycomposGUI.py [new file with mode: 0644]
Examples/pygui1/using.rst [new file with mode: 0644]
Examples/pyth1/Makefile [new file with mode: 0644]
Examples/pyth1/README.txt
Examples/pyth1/bidul.py
Examples/pyth1/components.py
Examples/pyth1/coupling.xml
Examples/pyth2/Makefile [new file with mode: 0644]
Examples/pyth2/README.txt
Examples/pyth2/components.py
Examples/types1/Makefile [new file with mode: 0644]
Examples/types1/README.txt [new file with mode: 0644]
Examples/types1/components.py [new file with mode: 0644]
Examples/types1/coupling.xml [new file with mode: 0644]
Examples/types1/geom_coupling.xml [new file with mode: 0644]
Examples/types1/geom_coupling_compo2.xml [new file with mode: 0644]
MANIFEST.in
module_generator/__init__.py
module_generator/astcompo.py
module_generator/aster_tmpl.py
module_generator/cata_tmpl.py
module_generator/compat.py
module_generator/cpp_tmpl.py
module_generator/cppcompo.py
module_generator/doc_tmpl.py [new file with mode: 0644]
module_generator/fcompo.py
module_generator/gener.py
module_generator/gui_tmpl.py [new file with mode: 0644]
module_generator/hxx_awk.py [new file with mode: 0644]
module_generator/hxx_para_tmpl.py [new file with mode: 0644]
module_generator/hxx_tmpl.py [new file with mode: 0644]
module_generator/hxx_tmpl_gui.py [new file with mode: 0644]
module_generator/hxxcompo.py [new file with mode: 0644]
module_generator/hxxparacompo.py [new file with mode: 0644]
module_generator/mod_tmpl.py
module_generator/paco_tmpl.py [new file with mode: 0644]
module_generator/pacocompo.py [new file with mode: 0644]
module_generator/pycompo.py
module_generator/pyth_tmpl.py
module_generator/salomemodules.py [new file with mode: 0644]
module_generator/yacstypes.py [new file with mode: 0644]
script/hxx2salome.py [new file with mode: 0755]
setup.py

diff --git a/Examples/ast1/Makefile b/Examples/ast1/Makefile
new file mode 100644 (file)
index 0000000..02a8472
--- /dev/null
@@ -0,0 +1,21 @@
+# Copyright (C) 2009-2012  EDF R&D
+#
+# 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
+#
+
+clean:
+       rm -rf *.o *.so *.pyc astmod_SRC astmod_SRC.bak appli appli.bak install install.bak traceExec_proc
index 6feb349739bde497d09439c428a2d1695fabd4d3..e694f3e852c5d88fb882c0818cecff4f9f5bd2a1 100644 (file)
@@ -1,14 +1,15 @@
 A Code_Aster component dynamically loadable
 ===============================================
 
-To build this example, modify the files components.py, fcompo/Makefile, myaster/Makefile
+To build this example, modify the files ../context.py, ../makefile.inc, fcompo/Makefile, myaster/Makefile
 to take into account your configuration.
 
 1- your prerequisite file 
 2- your KERNEL_ROOT_DIR
 3- your Code_Aster installation
+4- your FORTRAN compiler
 
-Then set the environment (including PYTHONPATH for YACGEN, ../.. from here and execute components.py ::
+Then set the environment (including PYTHONPATH for YACSGEN, ../.. from here)::
 
   source <your prerequisite file>
 
@@ -26,8 +27,8 @@ process components.py ::
 
   python components.py
 
-You should get a SALOME module in source form (pycompos_SRC), its installation (install) and
-a SALOME application (appli) composed of modules KERNEL, GUI, YACS and pycompos.
+You should get a SALOME module in source form (astmod_SRC), its installation (install) and
+a SALOME application (appli) composed of modules KERNEL, GUI, YACS and the new module astmod.
 
 To run a coupling:
 
index 9c7847c6dbc7296b4d9e90c7e68e88cc57db9d04..65ff54ff1e40e5eabfab66bc4eab1e8f01001f08 100644 (file)
@@ -1,12 +1,32 @@
+# Copyright (C) 2009-2012  EDF R&D
+#
+# 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
+#
+
 """
  Example with one Code_Aster component and one fortran component
 """
 import os
+
+#import context from ..
+execfile("../context.py")
 from module_generator import Generator,Module,ASTERComponent,Service,F77Component
 
-context={'update':1,"prerequisites":"/local/cchris/.packages.d/envSalome50",
-          "kernel":"/local/chris/SALOME2/RELEASES/Install/KERNEL_V5"}
-aster_root="/local/chris/ASTER/instals/NEW9"
+aster_root=os.path.join(aster_home,aster_version)
 
 libfcompodir=os.path.join(os.getcwd(),"fcompo")
 myasterdir=os.path.join(os.getcwd(),"myaster","bibpyt")
@@ -26,9 +46,9 @@ c1=ASTERComponent("caster",services=[
          ],
          aster_dir=aster_root,
          python_path=[myasterdir],
-         argv=["-memjeveux","4",'-rep_outils','/local/chris/ASTER/instals/outils'],
+         argv=["-memjeveux","4",'-rep_outils',os.path.join(aster_home,'outils')],
          )
-          
+
 c2=F77Component("cfort",services=[
           Service("s1",inport=[("a","double"),("b","long"),("c","string")],
                        outport=[("d","double"),("e","long"),("f","string")],
@@ -49,4 +69,4 @@ g.bootstrap()
 g.configure()
 g.make()
 g.install()
-g.make_appli(appli_dir,restrict=["KERNEL","GUI","YACS"])
+g.make_appli("appli", restrict=["KERNEL"], altmodules={"GUI":GUI_ROOT_DIR, "YACS":YACS_ROOT_DIR})
index ce601fe0cf0ad0e7241a0aeadd013d1ac3ce4e73..5055ce6258284985e0c4e68e92d14f0d212043c9 100644 (file)
@@ -1,15 +1,32 @@
-FC=g77
+# Copyright (C) 2009-2012  EDF R&D
+#
+# 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
+#
 
-KERNEL_ROOT_DIR=/local/chris/SALOME2/RELEASES/Install/KERNEL_V5
+include ../../makefile.inc
 
 KERNEL_LIBS= -L$(KERNEL_ROOT_DIR)/lib/salome -lCalciumC -lSalomeDSCSuperv -lSalomeDSCContainer -lSalomeDatastream -lSalomeDSCSupervBasic
 
 all: libfcompo.so
 
 libfcompo.so:compo.o 
-       $(FC) -shared -o libfcompo.so compo.o ${KERNEL_LIBS} -Wl,--rpath -Wl,$(KERNEL_ROOT_DIR)/lib/salome -fexceptions
+       $(FC) -shared -fPIC -o libfcompo.so compo.o ${KERNEL_LIBS} -Wl,--rpath -Wl,$(KERNEL_ROOT_DIR)/lib/salome -fexceptions
 compo.o:compo.f
-       $(FC) -c compo.f -I$(KERNEL_ROOT_DIR)/include/salome -fexceptions
+       $(FC) -c compo.f -fPIC -I$(KERNEL_ROOT_DIR)/include/salome -fexceptions
 
 clean:
        rm -f *.o *.so
index 7abff52395a1c576fa4617d96d86f9c092738518..f0fa23495b7bc12d27600b9c2925fb02f2bb5c95 100644 (file)
@@ -1,3 +1,22 @@
+C Copyright (C) 2009-2012  EDF R&D
+C
+C This library is free software; you can redistribute it and/or
+C modify it under the terms of the GNU Lesser General Public
+C License as published by the Free Software Foundation; either
+C version 2.1 of the License.
+C
+C This library is distributed in the hope that it will be useful,
+C but WITHOUT ANY WARRANTY; without even the implied warranty of
+C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+C Lesser General Public License for more details.
+C
+C You should have received a copy of the GNU Lesser General Public
+C License along with this library; if not, write to the Free Software
+C Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+C
+C See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+C
+
        SUBROUTINE S1(compo,A,B,C,D,E,F)
        include 'calcium.hf'
        integer compo
index 4419fdbeac4afa5274ebdfdc385246716b4bad22..e3dd3827b9f922f98919cc53f1ce6b5b84ed2143 100644 (file)
@@ -1,25 +1,44 @@
-#ASTER
-ASTER_ROOT=/local/chris/ASTER/instals
-#SALOME
-KERNEL_ROOT_DIR=/local/chris/SALOME2/RELEASES/Install/KERNEL_V5
+# Copyright (C) 2009-2012  EDF R&D
+#
+# 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
+#
 
+include ../../makefile.inc
 
-ASTER_INSTALL=$(ASTER_ROOT)/NEW9
+ASTER_INSTALL=$(ASTER_ROOT)/$(ASTER_VERSION)
 ASTER_PUB=$(ASTER_ROOT)/public
 ASTER_OUTILS=$(ASTER_ROOT)/outils
 
+MUMPS=-L$(ASTER_PUB)/mumps-4.9.2/lib -ldmumps -lzmumps -lsmumps -lcmumps -lmumps_common -lpord -lmpiseq
+METIS=-L$(ASTER_PUB)/metis-4.0/lib -lmetis
+
+
 ASTER_LIBS = -L$(ASTER_INSTALL)/lib -laster \
-             -L$(ASTER_PUB)/scotch_4.0/bin -lscotch -lscotcherr \
-                                                -L/local/chris/pkg/med23/install/lib -lmed \
+            $(MUMPS) $(METIS) \
+             -L$(MED2HOME)/lib -lmed \
              -lferm -llapack -lhdf5
 
 KERNEL_INCLUDES=-I$(KERNEL_ROOT_DIR)/include/salome
 KERNEL_LIBS= -L$(KERNEL_ROOT_DIR)/lib/salome -lCalciumC -lSalomeDSCSuperv -lSalomeDSCContainer \
              -lSalomeDatastream -lSalomeDSCSupervBasic -Wl,--rpath -Wl,$(KERNEL_ROOT_DIR)/lib/salome
 
-FC=g77
-LD=g77
-FFLAGS=
+FC=gfortran
+LD=gfortran
+FFLAGS=-fopenmp -fdefault-double-8 -fdefault-integer-8 -fdefault-real-8
 CC=gcc
 SOURCES= src/op0078.f src/op0189.f src/op0181.f
 OBJETS=op0078.o op0189.o op0181.o
@@ -35,7 +54,7 @@ cata: commande/cata.py
        cp -rf commande/cata.py* bibpyt/Cata
 
 commande/cata.py:$(CATAPY)
-       ./make_cata $(ASTER_ROOT)/ASTK/ASTK_SERV/bin/as_run
+       ./make_cata $(ASTER_ROOT)/bin/as_run $(ASTER_VERSION)
 
 astermodule:astermodule.so pyth
        cp -rf astermodule.so bibpyt
@@ -47,6 +66,6 @@ op0189.o:src/op0189.f
 op0181.o:src/op0181.f
        $(FC) -c -fpic $(FFLAGS) $(KERNEL_INCLUDES) src/op0181.f
 astermodule.so: $(OBJETS)
-       $(LD) -shared -o $@ $(OBJETS) $(KERNEL_LIBS) $(ASTER_LIBS)
+       $(LD) -shared $(FFLAGS) -o $@ $(OBJETS) $(KERNEL_LIBS) $(ASTER_LIBS)
 clean:
-       rm -rf *.o *.so bibpyt commande/cata.py*
+       rm -rf *.o *.so bibpyt commande/cata.py* make-cmd commande
index 37ef2fe92868779dabc23cc7de893f2ec0ce838a..09f2be64d418f4de954fda6c014397c47be8c3ef 100755 (executable)
@@ -1,8 +1,27 @@
 #!/bin/sh
+# Copyright (C) 2009-2012  EDF R&D
+#
+# 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
+#
+
 cat >make-cmd << END
 P debug nodebug
 P mode interactif
-P version NEW9
+P version $2
 P ncpus 1
 A args
 A memjeveux 16.0
diff --git a/Examples/ast2/Makefile b/Examples/ast2/Makefile
new file mode 100644 (file)
index 0000000..013cda0
--- /dev/null
@@ -0,0 +1,21 @@
+# Copyright (C) 2009-2012  EDF R&D
+#
+# 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
+#
+
+clean:
+       rm -rf *.o *.so *.pyc astmod_SRC astmod_SRC.bak appli appli.bak install install.bak traceExec_proc caster_inst_1 cfort_inst_1 monfichier
index d117e11bc24b0915b356ba788718c46bc0c4edcb..08b30cb83d821bd7cea3132bf88145c90eda6640 100644 (file)
@@ -1,14 +1,15 @@
 A Code_Aster standalone component (in executable form)
 ===========================================================
 
-To build this example, modify the files components.py, fcompo/Makefile, myaster/config.txt, myaster/Makefile
+To build this example, modify the files ../context.py, ../makefile.inc, fcompo/Makefile, myaster/config.txt, myaster/Makefile
 to take into account your configuration.
 
 1- your prerequisite file 
 2- your KERNEL_ROOT_DIR
 3- your Code_Aster installation
+4- your FORTRAN compiler
 
-Then set the environment (including PYTHONPATH for YACGEN, ../.. from here and execute components.py ::
+Then set the environment (including PYTHONPATH for YACSGEN, ../.. from here)::
 
   source <your prerequisite file>
 
@@ -16,24 +17,27 @@ process components.py ::
 
   python components.py
 
-You should get a SALOME module in source form (pycompos_SRC), its installation (install) and
-a SALOME application (appli) composed of modules KERNEL, GUI, YACS and pycompos.
+You should get a SALOME module in source form (astmod_SRC), its installation (install) and
+a SALOME application (appli) composed of modules KERNEL, GUI, YACS and the new module astmod_SRC.
 
-Build the fcompo library ::
+Build the fcompo executable, under the SALOME application environment::
 
   cd fcompo
-  make
+  ../appli/runSession make
 
-Build the Code_Aster library ::
+Build the Code_Aster executable ::
 
   cd myaster
+  modify the config.txt for your SALOME Installation
   make
 
+Modify the exeaster script that drives the ASTER execution (change the files path)
+
 To run a coupling:
 
  1. start SALOME in background : ./appli/runAppli -t
  2. start a SALOME session : ./appli/runSession
  3. start YACS coupler with coupling file : driver coupling.xml
  4. examine output files in /tmp
- 5. shutdown SALOME : shutdowSalome.py
+ 5. shutdown SALOME : shutdownSalome.py
  6. exit session : CTRL-D (or exit)
index 5f26dc77d83c8400aab5b0f3b4008b5ebdde9693..d50a6f0ff7314ac892a8d0a6b7c8f3dfb4d001e8 100644 (file)
@@ -1,25 +1,40 @@
+# Copyright (C) 2009-2012  EDF R&D
+#
+# 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
+#
+
 """
  Example with one Code_Aster component and one fortran component
 """
 import os
+
+#import context from ..
+execfile("../context.py")
 from module_generator import Generator,Module,ASTERComponent,Service,F77Component
 
-context={'update':1,"prerequisites":"/local/cchris/.packages.d/envSalome50",
-          "kernel":"/local/chris/SALOME2/RELEASES/Install/KERNEL_V5"}
-aster_home="/local/chris/ASTER/instals"
-aster_root=os.path.join(aster_home,"NEW9")
-asrun=os.path.join(aster_home,"ASTK/ASTK_SERV/bin/as_run")
+aster_root=os.path.join(aster_home,aster_version)
 
 fcompodir=os.path.join(os.getcwd(),"fcompo")
-myasterdir=os.path.join(os.getcwd(),"myaster","bibpyt")
+
 install_prefix="./install"
 appli_dir="appli"
-export="""F exec %s D 0
-R cmde %s D 0
-""" % (os.path.join(os.getcwd(),"myaster","aster.exe"),os.path.join(os.getcwd(),"myaster","commande"))
 
 c1=ASTERComponent("caster",services=[
-          Service("s1",inport=[("argv","string"),("a","double"),("b","long"),("c","string")],
+          Service("s1",inport=[("jdc","file"),("a","double"),("b","long"),("c","string")],
                        outport=[("d","double")],
                        instream=[("aa","CALCIUM_double","T"),("ab","CALCIUM_double","I"),
                                  ("ac","CALCIUM_integer","I"),("ad","CALCIUM_real","I"),
@@ -28,14 +43,15 @@ c1=ASTERComponent("caster",services=[
                          ],
                        outstream=[("ba","CALCIUM_double","T"),("bb","CALCIUM_double","I")],
                  ),
+          Service("s2",inport=[("a","double"),],
+                       outport=[("d","double")],
+                 ),
          ],
          aster_dir=aster_root,
-         exe_path=os.path.join(os.getcwd(),"exeaster"),
-         asrun=asrun,
          kind="exe",
-         export_extras=export,
+         exe_path=os.path.join(os.getcwd(),"exeaster"),
          )
-          
+
 c2=F77Component("cfort",services=[
           Service("s1",inport=[("a","double"),("b","long"),("c","string")],
                        outport=[("d","double"),("e","long"),("f","string")],
@@ -58,4 +74,4 @@ g.bootstrap()
 g.configure()
 g.make()
 g.install()
-g.make_appli(appli_dir,restrict=["KERNEL","GUI","YACS"])
+g.make_appli("appli", restrict=["KERNEL"], altmodules={"GUI":GUI_ROOT_DIR, "YACS":YACS_ROOT_DIR})
index 95d944c00196949a66494297c1f258a9898ce2bd..0a541cbef7d598caf00d401364d7621e7dfbd4b9 100644 (file)
-<proc>
-
-<container name="A">
-</container>
-
-<container name="B">
-</container>
-
-<datanode name="datain">
-  <parameter name="f1" type="double">
-    <value><double>23</double> </value>
-  </parameter>
-</datanode>
-
-<service name="node1" >
-  <component>caster</component>
-  <method>s1</method>
-  <load container="A"/>
-  <inport name="jdc" type="string"/>
-  <inport name="argv" type="string"/>
-  <inport name="a" type="double"/>
-  <inport name="b" type="int"/>
-  <inport name="c" type="string"/>
-  <outport name="fort:8" type="file"/>
-  <outport name="d" type="double"/>
-  <instream name="aa" type="CALCIUM_double"/>
-  <instream name="ab" type="CALCIUM_double"/>
-  <instream name="ac" type="CALCIUM_integer"/>
-  <instream name="ad" type="CALCIUM_real"/>
-  <instream name="ae" type="CALCIUM_string"/>
-  <instream name="af" type="CALCIUM_complex"/>
-  <instream name="ag" type="CALCIUM_logical"/>
-  <outstream name="ba" type="CALCIUM_double"/>
-  <outstream name="bb" type="CALCIUM_double"/>
-</service>
-
-<service name="node2" >
-  <component>cfort</component>
-  <method>s1</method>
-  <load container="B"/>
-  <inport name="a" type="double"/>
-  <inport name="b" type="int"/>
-  <inport name="c" type="string"/>
-  <outport name="d" type="double"/>
-  <outport name="e" type="int"/>
-  <outport name="f" type="string"/>
-  <instream name="a" type="CALCIUM_double"/>
-  <instream name="b" type="CALCIUM_double"/>
-  <outstream name="ba" type="CALCIUM_double"/>
-  <outstream name="bb" type="CALCIUM_double"/>
-  <outstream name="bc" type="CALCIUM_integer"/>
-  <outstream name="bd" type="CALCIUM_real"/>
-  <outstream name="be" type="CALCIUM_string"/>
-  <outstream name="bf" type="CALCIUM_complex"/>
-  <outstream name="bg" type="CALCIUM_logical"/>
-</service>
-
-<inline name="node98" >
-  <script>
-    <code>print "dans python node:",p1</code>
-  </script>
-  <inport name="p1" type="double"/>
-</inline>
-
-<inline name="ljdc" >
-  <script>
-    <code>f=open(comm)</code>
-    <code>jdc=f.read()</code>
-    <code>f.close()</code>
-  </script>
-  <inport name="comm" type="string"/>
-  <outport name="jdc" type="string"/>
-</inline>
-
-<outnode name="dataout" >
-  <parameter name="f1" type="file" ref="monfichier"/>
-</outnode>
-
-<!--datalinks -->
-<stream>
-<fromnode>node1</fromnode><fromport>ba</fromport>
-<tonode>node2</tonode><toport>a</toport>
-</stream>
-<stream>
-<fromnode>node1</fromnode><fromport>bb</fromport>
-<tonode>node2</tonode><toport>b</toport>
-</stream>
-<stream>
-<fromnode>node2</fromnode><fromport>ba</fromport>
-<tonode>node1</tonode><toport>aa</toport>
-</stream>
-<stream>
-<fromnode>node2</fromnode><fromport>bb</fromport>
-<tonode>node1</tonode><toport>ab</toport>
-</stream>
-<stream>
-<fromnode>node2</fromnode><fromport>bc</fromport>
-<tonode>node1</tonode><toport>ac</toport>
-</stream>
-<stream>
-<fromnode>node2</fromnode><fromport>bd</fromport>
-<tonode>node1</tonode><toport>ad</toport>
-</stream>
-<stream>
-<fromnode>node2</fromnode><fromport>be</fromport>
-<tonode>node1</tonode><toport>ae</toport>
-</stream>
-<stream>
-<fromnode>node2</fromnode><fromport>bf</fromport>
-<tonode>node1</tonode><toport>af</toport>
-</stream>
-<stream>
-<fromnode>node2</fromnode><fromport>bg</fromport>
-<tonode>node1</tonode><toport>ag</toport>
-</stream>
-
-<datalink>
-   <fromnode>node1</fromnode><fromport>fort:8</fromport>
-   <tonode>dataout</tonode> <toport>f1</toport>
-</datalink>
-<datalink>
-   <fromnode>node1</fromnode><fromport>d</fromport>
-   <tonode>node98</tonode> <toport>p1</toport>
-</datalink>
-<datalink>
-   <fromnode>datain</fromnode><fromport>f1</fromport>
-   <tonode>node2</tonode> <toport>a</toport>
-</datalink>
-<datalink>
-   <fromnode>ljdc</fromnode><fromport>jdc</fromport>
-   <tonode>node1</tonode> <toport>jdc</toport>
-</datalink>
-
-<parameter>
-  <tonode>node1</tonode> <toport>a</toport>
-  <value><double>23</double> </value>
-</parameter>
-<parameter>
-  <tonode>node1</tonode> <toport>b</toport>
-  <value><int>23</int> </value>
-</parameter>
-<parameter>
-  <tonode>node1</tonode> <toport>c</toport>
-  <value><string>hello</string> </value>
-</parameter>
-
-<parameter>
-  <tonode>node2</tonode> <toport>b</toport>
-  <value><int>23</int> </value>
-</parameter>
-<parameter>
-  <tonode>node2</tonode> <toport>c</toport>
-  <value><string>hello</string> </value>
-</parameter>
-
-<parameter>
-  <tonode>ljdc</tonode> <toport>comm</toport>
-  <value><string>f.comm</string> </value>
-</parameter>
-
-<parameter>
-  <tonode>node1</tonode> <toport>argv</toport>
-  <value><string>-memjeveux 4 </string> </value>
-</parameter>
-
+<?xml version='1.0' encoding='iso-8859-1' ?>
+<proc name="proc">
+   <property name="DefaultStudyID" value="1"/>
+   <objref name="CALCIUM_complex" id="IDL:Ports/Calcium_Ports/Calcium_Complex_Port:1.0"/>
+   <objref name="CALCIUM_double" id="IDL:Ports/Calcium_Ports/Calcium_Double_Port:1.0"/>
+   <objref name="CALCIUM_integer" id="IDL:Ports/Calcium_Ports/Calcium_Integer_Port:1.0"/>
+   <objref name="CALCIUM_logical" id="IDL:Ports/Calcium_Ports/Calcium_Logical_Port:1.0"/>
+   <objref name="CALCIUM_real" id="IDL:Ports/Calcium_Ports/Calcium_Real_Port:1.0"/>
+   <objref name="CALCIUM_string" id="IDL:Ports/Calcium_Ports/Calcium_String_Port:1.0"/>
+   <type name="string" kind="string"/>
+   <struct name="Engines/dataref">
+      <member name="ref" type="string"/>
+   </struct>
+   <type name="bool" kind="bool"/>
+   <sequence name="boolvec" content="bool"/>
+   <type name="double" kind="double"/>
+   <sequence name="dblevec" content="double"/>
+   <objref name="file" id="file"/>
+   <type name="int" kind="int"/>
+   <sequence name="intvec" content="int"/>
+   <objref name="pyobj" id="python:obj:1.0"/>
+   <sequence name="stringvec" content="string"/>
+   <container name="A">
+   </container>
+   <container name="B">
+   </container>
+   <container name="DefaultContainer">
+      <property name="container_name" value="FactoryServer"/>
+      <property name="name" value="localhost"/>
+   </container>
+   <datanode name="datain">
+      <parameter name="f1" type="double">
+         <value><double>23</double></value>
+      </parameter>
+   </datanode>
+   <service name="node1">
+      <component>caster</component>
+      <load container="A"/>
+      <method>s1</method>
+      <inport name="jdc" type="file"/>
+      <inport name="a" type="double"/>
+      <inport name="b" type="int"/>
+      <inport name="c" type="string"/>
+      <instream name="aa" type="CALCIUM_double"/>
+      <instream name="ab" type="CALCIUM_double"/>
+      <instream name="ac" type="CALCIUM_integer"/>
+      <instream name="ad" type="CALCIUM_real"/>
+      <instream name="ae" type="CALCIUM_string"/>
+      <instream name="af" type="CALCIUM_complex"/>
+      <instream name="ag" type="CALCIUM_logical"/>
+      <outport name="fort:8" type="file"/>
+      <outport name="d" type="double"/>
+      <outstream name="ba" type="CALCIUM_double"/>
+      <outstream name="bb" type="CALCIUM_double"/>
+   </service>
+   <service name="node2">
+      <component>cfort</component>
+      <load container="B"/>
+      <method>s1</method>
+      <inport name="a" type="double"/>
+      <inport name="b" type="int"/>
+      <inport name="c" type="string"/>
+      <instream name="a" type="CALCIUM_double"/>
+      <instream name="b" type="CALCIUM_double"/>
+      <outport name="d" type="double"/>
+      <outport name="e" type="int"/>
+      <outport name="f" type="string"/>
+      <outstream name="ba" type="CALCIUM_double"/>
+      <outstream name="bb" type="CALCIUM_double"/>
+      <outstream name="bc" type="CALCIUM_integer"/>
+      <outstream name="bd" type="CALCIUM_real"/>
+      <outstream name="be" type="CALCIUM_string"/>
+      <outstream name="bf" type="CALCIUM_complex"/>
+      <outstream name="bg" type="CALCIUM_logical"/>
+   </service>
+   <inline name="node98">
+      <script><code><![CDATA[print "dans python node:",p1]]></code></script>
+      <inport name="p1" type="double"/>
+   </inline>
+   <outnode name="dataout">
+      <parameter name="f1" type="file"/>
+   </outnode>
+   <control> <fromnode>datain</fromnode> <tonode>node2</tonode> </control>
+   <control> <fromnode>node1</fromnode> <tonode>node98</tonode> </control>
+   <control> <fromnode>node1</fromnode> <tonode>dataout</tonode> </control>
+   <datalink control="false">
+      <fromnode>datain</fromnode> <fromport>f1</fromport>
+      <tonode>node2</tonode> <toport>a</toport>
+   </datalink>
+   <datalink control="false">
+      <fromnode>node1</fromnode> <fromport>fort:8</fromport>
+      <tonode>dataout</tonode> <toport>f1</toport>
+   </datalink>
+   <datalink control="false">
+      <fromnode>node1</fromnode> <fromport>d</fromport>
+      <tonode>node98</tonode> <toport>p1</toport>
+   </datalink>
+   <stream>
+      <fromnode>node1</fromnode> <fromport>ba</fromport>
+      <tonode>node2</tonode> <toport>a</toport>
+   </stream>
+   <stream>
+      <fromnode>node1</fromnode> <fromport>bb</fromport>
+      <tonode>node2</tonode> <toport>b</toport>
+   </stream>
+   <stream>
+      <fromnode>node2</fromnode> <fromport>ba</fromport>
+      <tonode>node1</tonode> <toport>aa</toport>
+   </stream>
+   <stream>
+      <fromnode>node2</fromnode> <fromport>bb</fromport>
+      <tonode>node1</tonode> <toport>ab</toport>
+   </stream>
+   <stream>
+      <fromnode>node2</fromnode> <fromport>bc</fromport>
+      <tonode>node1</tonode> <toport>ac</toport>
+   </stream>
+   <stream>
+      <fromnode>node2</fromnode> <fromport>bd</fromport>
+      <tonode>node1</tonode> <toport>ad</toport>
+   </stream>
+   <stream>
+      <fromnode>node2</fromnode> <fromport>be</fromport>
+      <tonode>node1</tonode> <toport>ae</toport>
+   </stream>
+   <stream>
+      <fromnode>node2</fromnode> <fromport>bf</fromport>
+      <tonode>node1</tonode> <toport>af</toport>
+   </stream>
+   <stream>
+      <fromnode>node2</fromnode> <fromport>bg</fromport>
+      <tonode>node1</tonode> <toport>ag</toport>
+   </stream>
+   <parameter>
+      <tonode>node1</tonode><toport>jdc</toport>
+      <value><objref>f.comm</objref></value>
+   </parameter>
+   <parameter>
+      <tonode>node1</tonode><toport>a</toport>
+      <value><double>23</double></value>
+   </parameter>
+   <parameter>
+      <tonode>node1</tonode><toport>b</toport>
+      <value><int>23</int></value>
+   </parameter>
+   <parameter>
+      <tonode>node1</tonode><toport>c</toport>
+      <value><string>hello</string></value>
+   </parameter>
+   <parameter>
+      <tonode>node2</tonode><toport>b</toport>
+      <value><int>23</int></value>
+   </parameter>
+   <parameter>
+      <tonode>node2</tonode><toport>c</toport>
+      <value><string>hello</string></value>
+   </parameter>
+   <presentation name="datain" x="1.75" y="168.25" width="158" height="63" expanded="1" expx="1.75" expy="168.25" expWidth="158" expHeight="63" shownState="0"/>
+   <presentation name="node1" x="389.75" y="33.25" width="158" height="333" expanded="1" expx="389.75" expy="33.25" expWidth="158" expHeight="333" shownState="0"/>
+   <presentation name="node2" x="195.75" y="46.75" width="158" height="306" expanded="1" expx="195.75" expy="46.75" expWidth="158" expHeight="306" shownState="0"/>
+   <presentation name="node98" x="583.75" y="208.25" width="158" height="63" expanded="1" expx="583.75" expy="208.25" expWidth="158" expHeight="63" shownState="0"/>
+   <presentation name="dataout" x="583.75" y="128.25" width="158" height="63" expanded="1" expx="583.75" expy="128.25" expWidth="158" expHeight="63" shownState="0"/>
+   <presentation name="__ROOT__" x="0" y="0" width="745.75" height="370.25" expanded="1" expx="0" expy="0" expWidth="745.75" expHeight="370.25" shownState="0"/>
 </proc>
-
diff --git a/Examples/ast2/coupling2.xml b/Examples/ast2/coupling2.xml
new file mode 100644 (file)
index 0000000..bed71be
--- /dev/null
@@ -0,0 +1,77 @@
+<?xml version='1.0' encoding='iso-8859-1' ?>
+<proc name="newSchema_1">
+   <property name="DefaultStudyID" value="1"/>
+   <type name="string" kind="string"/>
+   <struct name="Engines/dataref">
+      <member name="ref" type="string"/>
+   </struct>
+   <type name="bool" kind="bool"/>
+   <sequence name="boolvec" content="bool"/>
+   <type name="double" kind="double"/>
+   <sequence name="dblevec" content="double"/>
+   <objref name="file" id="file"/>
+   <type name="int" kind="int"/>
+   <sequence name="intvec" content="int"/>
+   <objref name="pyobj" id="python:obj:1.0"/>
+   <sequence name="stringvec" content="string"/>
+   <container name="DefaultContainer">
+      <property name="container_name" value="FactoryServer"/>
+      <property name="name" value="claui2c6"/>
+   </container>
+   <container name="container3">
+   </container>
+   <service name="s20">
+      <component>caster</component>
+      <load container="container3"/>
+      <method>s2</method>
+      <inport name="jdc" type="string"/>
+      <inport name="a" type="double"/>
+      <outport name="d" type="double"/>
+   </service>
+   <inline name="PyScript1">
+      <script><code><![CDATA[o2="""DEBUT(PAR_LOT="NON")
+print a
+d=2*a
+"""
+o4="""print a
+d=2*a
+"""
+]]></code></script>
+      <outport name="o2" type="string"/>
+      <outport name="o4" type="string"/>
+   </inline>
+   <service name="s200">
+      <node>s20</node>
+      <method>s2</method>
+      <inport name="jdc" type="string"/>
+      <inport name="a" type="double"/>
+      <outport name="d" type="double"/>
+   </service>
+   <control> <fromnode>s20</fromnode> <tonode>s200</tonode> </control>
+   <control> <fromnode>PyScript1</fromnode> <tonode>s20</tonode> </control>
+   <control> <fromnode>PyScript1</fromnode> <tonode>s200</tonode> </control>
+   <datalink control="false">
+      <fromnode>s20</fromnode> <fromport>d</fromport>
+      <tonode>s200</tonode> <toport>a</toport>
+   </datalink>
+   <datalink control="false">
+      <fromnode>PyScript1</fromnode> <fromport>o2</fromport>
+      <tonode>s20</tonode> <toport>jdc</toport>
+   </datalink>
+   <datalink control="false">
+      <fromnode>PyScript1</fromnode> <fromport>o4</fromport>
+      <tonode>s200</tonode> <toport>jdc</toport>
+   </datalink>
+   <parameter>
+      <tonode>s20</tonode><toport>a</toport>
+      <value><double>5.2</double></value>
+   </parameter>
+   <parameter>
+      <tonode>s200</tonode><toport>a</toport>
+      <value><double>5.2</double></value>
+   </parameter>
+   <presentation name="PyScript1" x="24" y="64" width="158" height="90" expanded="1" expx="24" expy="64" expWidth="158" expHeight="90" shownState="0"/>
+   <presentation name="s20" x="288.5" y="34" width="158" height="90" expanded="1" expx="288.5" expy="34" expWidth="158" expHeight="90" shownState="0"/>
+   <presentation name="s200" x="508" y="40" width="158" height="90" expanded="1" expx="508" expy="40" expWidth="158" expHeight="90" shownState="0"/>
+   <presentation name="__ROOT__" x="0" y="0" width="670" height="158" expanded="1" expx="0" expy="0" expWidth="670" expHeight="158" shownState="0"/>
+</proc>
diff --git a/Examples/ast2/exeaster b/Examples/ast2/exeaster
new file mode 100755 (executable)
index 0000000..a2b7d0f
--- /dev/null
@@ -0,0 +1,55 @@
+#!/bin/sh
+# Copyright (C) 2009-2012  EDF R&D
+#
+# 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
+#
+
+ROOT=/local/cchris/Salome/YACSGEN/V6/YACSGEN/Examples/ast2
+
+cat > temp.comm << END
+END
+
+cat > temp.export << END
+P actions make_etude
+P version STA10.3
+P nomjob salome
+P ncpus 1
+A memjeveux 4.000000
+P mem_aster 100
+A tpmax 60
+P memjob 32768
+P mpi_nbcpu 1
+P mpi_nbnoeud 1
+P tpsjob 1
+
+P mode batch
+
+P soumbtc oui
+P consbtc oui
+F conf $ROOT/install/share/salome/resources/astmod/caster_config.txt D 0
+F comm $PWD/temp.comm D 1
+F exec $ROOT/myaster/aster.exe D 0
+R cmde $ROOT/myaster/commande D 0
+F mess $PWD/messages R 6
+F resu $PWD/resu R 8
+F erre $PWD/erre R 9
+END
+
+/local/cchris/Aster/V10.3/aster/bin/as_run temp.export
+
+sleep 5
+echo "Fin du script"
index 0a8524d13d29291395bdf21c4d97ff7ef14582ed..f8a7a55b284475da62cf759a0ddc558125b26c65 100644 (file)
@@ -1,3 +1,4 @@
+DEBUT(PAR_LOT="NON")
 print a,b,c
 YACS_INIT(COMPO=component)
 
@@ -6,3 +7,4 @@ LECTURE_FORCE()
 
 d=36.5
 
+FIN()
index fb7aa91ffe1052e2cd302f92b242dcf239e60e5c..2b8535d9d5a152bb8a662dabf9dfefa0469739e8 100644 (file)
@@ -1,11 +1,28 @@
+# Copyright (C) 2009-2012  EDF R&D
+#
+# 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
+#
 
-FC=g77
-
-KERNEL_ROOT_DIR=/local/chris/SALOME2/RELEASES/Install/KERNEL_V5
+include ../../makefile.inc
 
 all:prog
 prog:compo.o
-       $(FC) -o prog compo.o -L../install/lib/salome -lcfortExelib
+       $(FC) -o prog compo.o -L../install/lib/salome -lcfortExelib -L$(KERNEL_ROOT_DIR)/lib/salome -lCalciumC
+
 compo.o:compo.f
        $(FC) -c compo.f -I$(KERNEL_ROOT_DIR)/include/salome -fexceptions
 
index a4423e47e3c956b540d8ea51a6f87b4d4e8989d4..e67a66857f3a809f0dff7a3b44f116f1ccb2c960 100644 (file)
@@ -1,3 +1,22 @@
+C Copyright (C) 2009-2012  EDF R&D
+C
+C This library is free software; you can redistribute it and/or
+C modify it under the terms of the GNU Lesser General Public
+C License as published by the Free Software Foundation; either
+C version 2.1 of the License.
+C
+C This library is distributed in the hope that it will be useful,
+C but WITHOUT ANY WARRANTY; without even the implied warranty of
+C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+C Lesser General Public License for more details.
+C
+C You should have received a copy of the GNU Lesser General Public
+C License along with this library; if not, write to the Free Software
+C Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+C
+C See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+C
+
        PROGRAM P
        CALL YACSINIT()
        END
index 7a7ea2c2ed77c45db82c7f2c684607beb1827235..7348553917ce62009ccb79f89dfc82e25fff373a 100644 (file)
@@ -1,7 +1,26 @@
+# Copyright (C) 2009-2012  EDF R&D
+#
+# 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
+#
 
-#ASTER
-ASTER_ROOT=/local/chris/ASTER/instals
+include ../../makefile.inc
 
 aster.exe:
-       ./make_exec $(ASTER_ROOT)/ASTK/ASTK_SERV/bin/as_run
+       ./make_exec $(ASTER_ROOT) $(ASTER_VERSION)
 
+clean:
+       rm -rf commande aster.exe make-exe
index b7cbc4f3be92e262064a08e147cea27482d36625..8cbf25745ad6f11df060b0b050007f6e757bea70 100644 (file)
@@ -1,3 +1,21 @@
+# Copyright (C) 2009-2012  EDF R&D
+#
+# 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
+#
 # Configuration file
 # $Id$
 # $Name$
@@ -12,6 +30,8 @@
 #  LINK       : linker command
 #  OPTL       : linker options
 #  CC         : C compiler command
+#  DEFS       : pre-processor #define commands separated by space or comma
+#               they will be added to all compilation options OPTx_x
 #  OPTC_D     : C compiler options using DEBUG mode
 #  OPTC_O     : C compiler options using NODEBUG mode
 #  INCL       : C include flags
 #  REPOUT     : tools directory
 #  MAKE_SURCH_OFFI/MAKE_CAPY_OFFI : Python modules to compiling elements catalogs
 #  CRP / CRS  : tools to check source files and programming rules
+#  ID_PERF    : a label to identify a group of machines (use by TEST_TEMPS command)
 #
-ENV_SH         | env     | -     | /local/chris/ASTER/instals/NEW9/profile.sh
+ID_PERF        | id      | -     | claui2c6
+#
+ENV_SH         | env     | -     | /local/cchris/Aster/V10.3/aster/STA10.3/profile.sh
 #
 LIB            | ar      | ?     | /usr/bin/ar -rv
 #
-#BIBL           | python  | 2.4   | -L/usr/lib/python2.4/config -lpython2.4
-BIBL           | python  | 2.4   | -lpython2.4
-BIBL           | med     | 2.3.5 | -Wl,-R -Wl,/local/chris/pkg/med235/install/lib -L/local/chris/pkg/med235/install/lib -lmed
-BIBL           | hdf5    | 1.6.5 | -lhdf5
-BIBL           | sys     | ?     | -Wl,--allow-multiple-definition -Wl,--export-dynamic -lieee -ldl -lpthread -lutil -lm /usr/lib/libz.a
-BIBL           | mpi     | 2     | -lmpi
-BIBL           | zmat    | 8.3   | 
-BIBL           | mumps   | 4.3.2 | 
-BIBL           | scotch  | 4.0   | -L/local/chris/ASTER/instals/public/scotch_4.0/bin -lscotch -lcommon -lscotcherr -lscotcherrcom
-BIBL           | math    | ?     | /usr/lib/liblapack.a /usr/lib/libblas.a /usr/lib/libg2c.a
-BIBL           | salome  | ?     | -L/local/chris/SALOME2/RELEASES/Install/KERNEL_V5/lib/salome -lCalciumC -lSalomeDSCSuperv -lSalomeDSCContainer -lSalomeDatastream -lSalomeDSCSupervBasic -Wl,--rpath -Wl,/local/chris/SALOME2/RELEASES/Install/KERNEL_V5/lib/salome
+BIBL           | python  | 2.4   | -L/local/cchris/pkg/python2.7/install/lib -L/local/cchris/pkg/python2.7/install/lib/python2.7/config -lpython2.7
+BIBL           | med     | 2.3.5 | -L/local/cchris/Aster/V10.3/aster/public/med-2.3.6/lib -lmed
+BIBL           | hdf5    | 1.6.5 | -L/local/cchris/Aster/V10.3/aster/public/hdf5-1.6.9/lib -lhdf5
+BIBL           | zmat    | 8.4   | 
+BIBL           | mumps   | ?     | /local/cchris/Aster/V10.3/aster/public/mumps-4.9.2/lib/libdmumps.a /local/cchris/Aster/V10.3/aster/public/mumps-4.9.2/lib/libzmumps.a /local/cchris/Aster/V10.3/aster/public/mumps-4.9.2/lib/libsmumps.a /local/cchris/Aster/V10.3/aster/public/mumps-4.9.2/lib/libcmumps.a /local/cchris/Aster/V10.3/aster/public/mumps-4.9.2/lib/libmumps_common.a /local/cchris/Aster/V10.3/aster/public/mumps-4.9.2/lib/libpord.a /local/cchris/Aster/V10.3/aster/public/mumps-4.9.2/lib/libmpiseq.a -L/local/cchris/Aster/V10.3/aster/public/metis-4.0/lib -lmetis
+BIBL           | scotch  | 4.0   | 
+BIBL           | math    | ?     | -L/usr/lib -llapack -L/usr/lib -lblas -L/usr/lib/gcc/x86_64-linux-gnu/4.3 -lgfortran
+BIBL           | mpi     | 2     | 
+BIBL           | c++     | ?     | -L/usr/lib/gcc/x86_64-linux-gnu/4.3 -lstdc++ -lsupc++
+BIBL           | sys     | ?     | -Wl,--allow-multiple-definition -Wl,--export-dynamic -ldl -lutil -lm -lpthread -lz
+BIBL           | salome  | ?     | -L/local/cchris/Salome/Install/KERNEL_V6/lib/salome -lCalciumC -lSalomeDSCSuperv -lSalomeDSCContainer -lSalomeDatastream -lSalomeDSCSupervBasic -Wl,--rpath -Wl,/local/cchris/Salome/Install/KERNEL_V6/lib/salome
+#
+DEFS           | defined | ?     | LINUX64 _HAVE_MUMPS _DISABLE_SCOTCH
 #
-NOBUILD        | option  | ?     |  bibfor/from_c
+NOBUILD        | option  | ?     | 
 #
-PYTHON         | python  | 2.4   | /usr/bin/python
+PYTHON         | python  | 2.4   | /local/cchris/Salome/envSalome6/spython/bin/python
 #
-LINK           | link    | ?     | /usr/bin/g77
-OPTL           | link    | ?     | -v
+LINK           | link    | ?     | /usr/bin/gfortran
+OPTL           | link    | ?     | -fopenmp
 #
 CC             | cc      | ?     | /usr/bin/gcc
-#OPTC_D         | cc      | ?     | -c -g -DP_LINUX  -D_USE_MPI
-OPTC_D         | cc      | ?     | -c -g -DP_LINUX 
-#OPTC_O         | cc      | ?     | -c -O2 -DP_LINUX -D_USE_MPI
-OPTC_O         | cc      | ?     | -c -O2 -DP_LINUX 
-INCL           | include | ?     | -I/local/chris/ASTER/instals/NEW9/bibc/include -I/usr/include/python2.4 -I/usr/include -I/usr/include/lam -I/local/chris/ASTER/instals/public/scotch_4.0/bin
-#
-F77            | f77     | ?     | /usr/bin/g77
-OPTF_D         | f77     | ?     | -c -g
-OPTF_O         | f77     | ?     | -c -O2 -I/usr/include/lam
-INCLF          | include | ?     | -I/local/chris/SALOME2/RELEASES/Install/KERNEL_V5/include/salome
-#
-F90            | f90     | ?     | 
-OPTF90_D       | f90     | ?     | -c -g
-OPTF90_O       | f90     | ?     | -c -O2
-INCLF90        | include | ?     | 
+OPTC_D         | cc      | ?     | -c -g  -fno-stack-protector -fPIC -fopenmp
+OPTC_O         | cc      | ?     | -c -O2 -fno-stack-protector -fPIC -fopenmp
+INCL           | include | ?     | -I/local/cchris/Aster/V10.3/aster/STA10.3/bibc/include -I/local/cchris/pkg/python2.7/install/include/python2.7 -I/local/cchris/Salome/envSalome6/spython/lib/python2.7/site-packages/numpy/core/include -I/local/cchris/Aster/V10.3/aster/public/hdf5-1.6.9/include
+#
+F77            | f77     | ?     | /usr/bin/gfortran
+OPTF_D         | f77     | ?     | -c -g  -fPIC  -fopenmp  -fdefault-double-8 -fdefault-integer-8 -fdefault-real-8
+OPTF_O         | f77     | ?     | -c -O2 -fPIC  -fopenmp  -fdefault-double-8 -fdefault-integer-8 -fdefault-real-8
+INCLF          | include | ?     | -I/local/cchris/Salome/Install/KERNEL_V6/include/salome
+#
+F90            | f90     | ?     | /usr/bin/gfortran
+OPTF90_D       | f90     | ?     | -c -g  -ffixed-line-length-0 -x f77-cpp-input -fPIC  -fopenmp  -fdefault-double-8 -fdefault-integer-8 -fdefault-real-8
+OPTF90_O       | f90     | ?     | -c -O2 -ffixed-line-length-0 -x f77-cpp-input -fPIC  -fopenmp  -fdefault-double-8 -fdefault-integer-8 -fdefault-real-8
+INCLF90        | include | ?     |  -I/local/cchris/Aster/V10.3/aster/STA10.3/bibf90/include_mumps-4.9.2
 #
 G77_AGLA       | g77     | ?     | unused
 #
 SRCFOR         | src     | 11-04 | bibfor
-#SRCF90         | src     | 11-04 | bibf90
+SRCF90         | src     | 11-04 | bibf90
 SRCFERM        | src     | 11-04 | fermetur
 SRCC           | src     | 11-04 | bibc
 SRCPY          | src     | 11-04 | bibpyt
@@ -107,22 +130,26 @@ ARGEXE         | exec    | 03-02 | -eficas_path ./Python
 MAKE_SURCH_OFFI | build  | 11-04 | Lecture_Cata_Ele/make_surch_offi.py
 MAKE_CAPY_OFFI  | build  | 11-04 | Lecture_Cata_Ele/make_capy_offi.py
 #
-REPOUT         | exec    | 11-04 | /local/chris/ASTER/instals/outils
-REPMAT         | exec    | 02-05 | /local/chris/ASTER/instals/NEW9/materiau
-REPDEX         | exec    | 02-05 | /local/chris/ASTER/instals/NEW9/datg
+REPOUT         | exec    | 11-04 | /local/cchris/Aster/V10.3/aster/outils
+REPMAT         | exec    | 02-05 | /local/cchris/Aster/V10.3/aster/STA10.3/materiau
+REPDEX         | exec    | 02-05 | /local/cchris/Aster/V10.3/aster/STA10.3/datg
 #
 SUPERV         | exec    | 03-02 | Accas
 SUPERV         | exec    | 03-02 | Build
+SUPERV         | exec    | 03-02 | Comportement
 SUPERV         | exec    | 03-02 | Execution
+SUPERV         | exec    | 03-02 | Intranet
 SUPERV         | exec    | 03-02 | Macro
-SUPERV         | exec    | 03-02 | Messages
+SUPERV         | exec    | 12-06 | Meidee
+SUPERV         | exec    | 09-06 | Messages
 SUPERV         | exec    | 03-02 | Noyau
-SUPERV         | exec    | 03-02 | Stanley
+SUPERV         | exec    | 05-04 | Outils
+SUPERV         | exec    | 01-07 | SD
+SUPERV         | exec    | 01-03 | Stanley
 SUPERV         | exec    | 03-02 | Utilitai
 SUPERV         | exec    | 03-02 | Validation
 #
 GZIP           | tool    | ?     | ?GZIP?
-CRP            | tool    | ?     | /local/chris/ASTER/instals/outils/CRPCRS/crp_aster.sh
-CRS            | tool    | ?     | /local/chris/ASTER/instals/outils/CRPCRS/crs.sh
 #
 I18N           | i18n    | -     | 
+
index 351c97a777641c1020863dc59486b2208c0221e1..676ad8484361439e1de4af6a312fd18f09e8b203 100755 (executable)
@@ -1,8 +1,27 @@
 #!/bin/sh
+# Copyright (C) 2009-2012  EDF R&D
+#
+# 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
+#
+
 cat >make-exe << END
 P actions make_exec
 P actions make_cmde
-P version NEW9
+P version $2
 P nomjob forma01a
 P ncpus 1
 A memjeveux 4.000000
@@ -23,5 +42,4 @@ R capy ${PWD}/catalo D 0
 R cmde ${PWD}/commande DR 0
 END
 
-
-$1 make-exe
+$1/bin/as_run  make-exe
index 9c669bd1d6823dc6957e5b0c4df06ddd7bce68ee..79bc96fb084624ac468ee725ed2e3b800f4bce08 100644 (file)
@@ -62,9 +62,9 @@ C
       COMMON/YACS/IFL
       include 'calcium.hf'
       real*8 tt,tp,t0,t1,ss,zz
-      real yr
+      real*4 yr
       CHARACTER*8 tch(2)
-      real tcp(2)
+      real*4 tcp(2)
       integer*4 tlo(3)
 
       write(6,*) '--> OP196 '
diff --git a/Examples/calcium1/Makefile b/Examples/calcium1/Makefile
new file mode 100644 (file)
index 0000000..bf7c92c
--- /dev/null
@@ -0,0 +1,30 @@
+# Copyright (C) 2009-2012  EDF R&D
+#
+# 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
+#
+
+include ../makefile.inc
+
+all:libcode1.so
+
+libcode1.so:code1.o
+         $(FC) -shared -fPIC -o libcode1.so code1.o
+code1.o:code1.f
+         $(FC) -c code1.f -fPIC -I$(KERNEL_ROOT_DIR)/include/salome -fexceptions
+
+clean:
+       rm -rf *.o *.so install install.bak traceExec_proc appli appli.bak pycompos_SRC pycompos_SRC.bak
diff --git a/Examples/calcium1/code1.f b/Examples/calcium1/code1.f
new file mode 100644 (file)
index 0000000..7d9b813
--- /dev/null
@@ -0,0 +1,270 @@
+C Copyright (C) 2009-2012  EDF R&D
+C
+C This library is free software; you can redistribute it and/or
+C modify it under the terms of the GNU Lesser General Public
+C License as published by the Free Software Foundation; either
+C version 2.1 of the License.
+C
+C This library is distributed in the hope that it will be useful,
+C but WITHOUT ANY WARRANTY; without even the implied warranty of
+C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+C Lesser General Public License for more details.
+C
+C You should have received a copy of the GNU Lesser General Public
+C License along with this library; if not, write to the Free Software
+C Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+C
+C See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+C
+
+       SUBROUTINE SERV1(compo,a,b,c)
+       include 'calcium.hf'
+       integer compo(2)
+       integer i, nval, info, z(10), l
+       integer*8 lz(10)
+       integer*4 z4(10),lo(10)
+
+       real*8 dd(10),a,b,c,ti,tf,t
+       real*4 u(20)
+       real*4 tti,ttf,tt
+       character*10 s(3)
+       character*20 rs(3)
+       character*64 instance
+
+       write(6,*)a,b
+       call cpcd(compo,instance,info)
+       write(6,*)"instance name=",instance
+
+C  write
+       tt=0.
+       t=0.
+       dd(1)=125.45
+       dd(2)=8.8
+       i=1
+       l=10
+       CALL cpedb(compo,CP_ITERATION,t,i,'ba',l,dd,info)
+       CALL cpedb(compo,CP_ITERATION,t,2,'ba',l,dd,info)
+       CALL cpedb(compo,CP_ITERATION,t,3,'ba',l,dd,info)
+       write(6,*)'info=',info
+       call flush(6)
+
+       s(1)="titi"
+       s(2)="tututu"
+       s(3)="tatatata"
+       write(6,*)'s=',s
+       l=3
+       CALL cpech(compo,CP_ITERATION,tt,i,'bb',l,s,info)
+       write(6,*)'info=',info
+       call flush(6)
+
+       z(1)=1
+       z(2)=8
+       z(3)=0
+       write(6,*)'z=',z(1)
+       write(6,*)'z=',z(2)
+       write(6,*)'z=',z(3)
+       l=10
+       CALL cpeen(compo,CP_ITERATION,tt,i,'bc',l,z,info)
+       write(6,*)'info=',info
+       call flush(6)
+
+       u(1)=1
+       u(2)=8
+       u(3)=4
+       u(4)=4
+       u(5)=5
+       u(6)=5
+       write(6,*)'u=',u(1)
+       write(6,*)'u=',u(2)
+       write(6,*)'u=',u(3)
+       write(6,*)'u=',u(4)
+       write(6,*)'u=',u(5)
+       write(6,*)'u=',u(6)
+       CALL cpecp(compo,CP_ITERATION,tt,i,'bd',l,u,info)
+       write(6,*)'info=',info
+       call flush(6)
+
+       u(1)=1.1
+       u(2)=8.8
+       u(3)=4.4
+       write(6,*)'u=',u(1)
+       write(6,*)'u=',u(2)
+       write(6,*)'u=',u(3)
+       CALL cpere(compo,CP_ITERATION,tt,i,'be',l,u,info)
+       write(6,*)'info=',info
+       call flush(6)
+
+       lo(1)=1
+       lo(2)=0
+       lo(3)=1
+       write(6,*)'lo=',lo(1)
+       write(6,*)'lo=',lo(2)
+       write(6,*)'lo=',lo(3)
+       CALL cpelo(compo,CP_ITERATION,tt,i,'bf',l,lo,info)
+       write(6,*)'info=',info
+       call flush(6)
+
+       lz(1)=11
+       lz(2)=22
+       lz(3)=33
+       write(6,*)'lz=',lz(1)
+       write(6,*)'lz=',lz(2)
+       write(6,*)'lz=',lz(3)
+       CALL cpeln(compo,CP_ITERATION,tt,i,'bg',l,lz,info)
+       write(6,*)'info=',info
+       call flush(6)
+
+       z4(1)=1
+       z4(2)=8
+       z4(3)=0
+       write(6,*)'z4=',z4(1)
+       write(6,*)'z4=',z4(2)
+       write(6,*)'z4=',z4(3)
+       CALL cpein(compo,CP_ITERATION,tt,i,'bh',l,z4,info)
+       write(6,*)'info=',info
+       call flush(6)
+
+       lz(1)=11
+       lz(2)=22
+       lz(3)=2**30
+       lz(3)=2**20*lz(3)
+       write(6,*)'lz=',lz(1)
+       write(6,*)'lz=',lz(2)
+       write(6,*)'lz=',lz(3)
+       CALL cpelg(compo,CP_ITERATION,tt,i,'bi',l,lz,info)
+       write(6,*)'info=',info
+       call flush(6)
+
+C  read 
+       ti=0.
+       tf=1.
+       i=1
+       dd(1)=0.
+       dd(2)=0.
+       dd(3)=0.
+       l=3
+       CALL cpldb(compo,CP_ITERATION,ti,tf,i,'aa',l,nval,dd,info)
+       write(6,*)'info=',info
+       write(6,*)'dd=',dd(1)
+       write(6,*)'dd=',dd(2)
+       write(6,*)'dd=',dd(3)
+       write(6,*)'nval=',nval
+       call flush(6)
+
+       tti=0.
+       ttf=1.
+       i=1
+       CALL cplch(compo,CP_ITERATION,tti,ttf,i,'ab',l,nval,rs,info)
+       write(6,*)'info=',info
+       write(6,*)'rs=',rs
+       write(6,*)'nval=',nval
+       call flush(6)
+
+       z(1)=0
+       z(2)=0
+       z(3)=0
+       CALL cplen(compo,CP_ITERATION,tti,ttf,i,'ac',l,nval,z,info)
+       write(6,*)'info=',info
+       write(6,*)'nval=',nval
+       write(6,*)'z=',z(1)
+       write(6,*)'z=',z(2)
+       write(6,*)'z=',z(3)
+       call flush(6)
+
+       u(1)=0
+       u(2)=0
+       u(3)=0
+       u(4)=0
+       u(5)=0
+       u(6)=0
+       CALL cplcp(compo,CP_ITERATION,tti,ttf,i,'ad',l,nval,u,info)
+       write(6,*)'info=',info
+       write(6,*)'nval=',nval
+       write(6,*)'u=',u(1)
+       write(6,*)'u=',u(2)
+       write(6,*)'u=',u(3)
+       write(6,*)'u=',u(4)
+       write(6,*)'u=',u(5)
+       write(6,*)'u=',u(6)
+       call flush(6)
+
+       u(1)=0
+       u(2)=0
+       u(3)=0
+       CALL cplre(compo,CP_ITERATION,tti,ttf,i,'ae',l,nval,u,info)
+       write(6,*)'info=',info
+       write(6,*)'nval=',nval
+       write(6,*)'u=',u(1)
+       write(6,*)'u=',u(2)
+       write(6,*)'u=',u(3)
+       call flush(6)
+
+       lo(1)=0
+       lo(2)=0
+       lo(3)=0
+       CALL cpllo(compo,CP_ITERATION,tti,ttf,i,'af',l,nval,lo,info)
+       write(6,*)'info=',info
+       write(6,*)'nval=',nval
+       write(6,*)'lo=',lo(1)
+       write(6,*)'lo=',lo(2)
+       write(6,*)'lo=',lo(3)
+       call flush(6)
+
+       lz(1)=0
+       lz(2)=0
+       lz(3)=0
+       CALL cplln(compo,CP_ITERATION,tti,ttf,i,'ag',l,nval,lz,info)
+       write(6,*)'info=',info
+       write(6,*)'nval=',nval
+       write(6,*)'lz=',lz(1)
+       write(6,*)'lz=',lz(2)
+       write(6,*)'lz=',lz(3)
+       call flush(6)
+
+       z4(1)=0
+       z4(2)=0
+       z4(3)=0
+       CALL cplin(compo,CP_ITERATION,tti,ttf,i,'ah',l,nval,z4,info)
+       write(6,*)'info=',info
+       write(6,*)'nval=',nval
+       write(6,*)'z4=',z4(1)
+       write(6,*)'z4=',z4(2)
+       write(6,*)'z4=',z4(3)
+       call flush(6)
+
+       lz(1)=0
+       lz(2)=0
+       lz(3)=0
+       CALL cpllg(compo,CP_ITERATION,tti,ttf,i,'ai',l,nval,lz,info)
+       write(6,*)'info=',info
+       write(6,*)'nval=',nval
+       write(6,*)'lz=',lz(1)
+       write(6,*)'lz=',lz(2)
+       write(6,*)'lz=',lz(3)
+       call flush(6)
+
+       call cpfini(compo,'aa',1,info)
+       write(6,*)'info=',info
+       call flush(6)
+
+       i=1
+       l=3
+       CALL cpldb(compo,CP_ITERATION,ti,tf,i,'aa',l,nval,dd,info)
+       write(6,*)'info=',info
+       call flush(6)
+
+       call cpeffi(compo,'aa',3,info)
+       write(6,*)'info=',info
+       call flush(6)
+
+       i=3
+       l=3
+       CALL cpldb(compo,CP_ITERATION,ti,tf,i,'aa',l,nval,dd,info)
+       write(6,*)'info=',info
+       call flush(6)
+
+       CALL cpfin(compo,CP_ARRET,info)
+
+       c=a+b
+       return 
+       end
diff --git a/Examples/calcium1/components.py b/Examples/calcium1/components.py
new file mode 100644 (file)
index 0000000..dbf9ce0
--- /dev/null
@@ -0,0 +1,465 @@
+# Copyright (C) 2009-2012  EDF R&D
+#
+# 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
+#
+
+import os
+#import context from ..
+execfile("../context.py")
+from module_generator import Generator,Module,Service,PYComponent,CPPComponent,F77Component
+
+# C++ component
+
+body="""
+std::cerr << "a: " << a << std::endl;
+std::cerr << "b: " << b << std::endl;
+int info;
+double t1,t2;
+float tt1,tt2;
+int i=1;
+int mval;
+double val[10],rval[10];
+int ival[10],rival[10];
+long lval[10],rlval[10];
+float cval[20],rcval[20];
+char* sval[]={"coucou","bonjour","salut"};
+char* rsval[3];
+char mystring1[10];
+char mystring2[10];
+char mystring3[10];
+rsval[0]=mystring1;
+rsval[1]=mystring2;
+rsval[2]=mystring3;
+
+char instance_name[72];
+info = cp_cd(component,instance_name);
+std::cerr << "instance_name: " << instance_name << std::endl;
+
+val[0]=3.2;
+val[1]=5.2;
+val[2]=9.8;
+std::cerr << "val: " << val[0] << std::endl;
+std::cerr << "val: " << val[1] << std::endl;
+std::cerr << "val: " << val[2] << std::endl;
+cp_edb(component,CP_ITERATION,0.,1,(char*)"ba",10,val);
+cp_edb(component,CP_ITERATION,0.,2,(char*)"ba",10,val);
+cp_edb(component,CP_ITERATION,0.,3,(char*)"ba",10,val);
+
+std::cerr << "sval: " << sval[0] << std::endl;
+std::cerr << "sval: " << sval[1] << std::endl;
+std::cerr << "sval: " << sval[2] << std::endl;
+cp_ech(component,CP_ITERATION,0.,1,(char*)"bb",3,sval,6);
+
+ival[0]=1;
+ival[1]=2;
+ival[2]=3;
+std::cerr << "ival: " << ival[0] << std::endl;
+std::cerr << "ival: " << ival[1] << std::endl;
+std::cerr << "ival: " << ival[2] << std::endl;
+cp_een(component,CP_ITERATION,0.,1,(char*)"bc",10,ival);
+
+cval[0]=1;
+cval[1]=2;
+cval[2]=3;
+cval[3]=4.5;
+cval[4]=5.6;
+cval[5]=7.8;
+std::cerr << "cval: " << cval[0] << std::endl;
+std::cerr << "cval: " << cval[1] << std::endl;
+std::cerr << "cval: " << cval[2] << std::endl;
+std::cerr << "cval: " << cval[3] << std::endl;
+std::cerr << "cval: " << cval[4] << std::endl;
+std::cerr << "cval: " << cval[5] << std::endl;
+cp_ecp(component,CP_ITERATION,0.,1,(char*)"bd",10,cval);
+
+cval[0]=1.1;
+cval[1]=2.2;
+cval[2]=3.3;
+std::cerr << "cval: " << cval[0] << std::endl;
+std::cerr << "cval: " << cval[1] << std::endl;
+std::cerr << "cval: " << cval[2] << std::endl;
+cp_ere(component,CP_ITERATION,0.,1,(char*)"be",10,cval);
+
+ival[0]=1;
+ival[1]=0;
+ival[2]=1;
+std::cerr << "ival: " << ival[0] << std::endl;
+std::cerr << "ival: " << ival[1] << std::endl;
+std::cerr << "ival: " << ival[2] << std::endl;
+cp_elo(component,CP_ITERATION,0.,1,(char*)"bf",10,ival);
+
+lval[0]=1;
+lval[1]=2;
+lval[2]=3;
+std::cerr << "lval: " << lval[0] << std::endl;
+std::cerr << "lval: " << lval[1] << std::endl;
+std::cerr << "lval: " << lval[2] << std::endl;
+cp_eln(component,CP_ITERATION,0.,1,(char*)"bg",10,lval);
+
+ival[0]=1;
+ival[1]=2;
+ival[2]=3;
+std::cerr << "ival: " << ival[0] << std::endl;
+std::cerr << "ival: " << ival[1] << std::endl;
+std::cerr << "ival: " << ival[2] << std::endl;
+cp_een(component,CP_ITERATION,0.,1,(char*)"bh",10,ival);
+
+lval[0]=1;
+lval[1]=2;
+lval[2]=3;
+std::cerr << "lval: " << lval[0] << std::endl;
+std::cerr << "lval: " << lval[1] << std::endl;
+std::cerr << "lval: " << lval[2] << std::endl;
+cp_elg(component,CP_ITERATION,0.,1,(char*)"bi",10,lval);
+
+/* read */
+info=cp_ldb(component,CP_ITERATION,&t1,&t2,&i,(char*)"aa",3,&mval,rval);
+std::cerr << "info: " << info << std::endl;
+std::cerr << "rval: " << rval[0] << std::endl;
+std::cerr << "rval: " << rval[1] << std::endl;
+std::cerr << "rval: " << rval[2] << std::endl;
+
+info=cp_lch(component,CP_ITERATION,&tt1,&tt2,&i,(char*)"ab",3,&mval,rsval,7);
+std::cerr << "info: " << info << std::endl;
+std::cerr << "rsval: " << rsval[0] << std::endl;
+std::cerr << "rsval: " << rsval[1] << std::endl;
+std::cerr << "rsval: " << rsval[2] << std::endl;
+
+info=cp_len(component,CP_ITERATION,&tt1,&tt2,&i,(char*)"ac",3,&mval,rival);
+std::cerr << "info: " << info << std::endl;
+std::cerr << "rival: " << rival[0] << std::endl;
+std::cerr << "rival: " << rival[1] << std::endl;
+std::cerr << "rival: " << rival[2] << std::endl;
+
+info=cp_lcp(component,CP_ITERATION,&tt1,&tt2,&i,(char*)"ad",3,&mval,rcval);
+std::cerr << "info: " << info << std::endl;
+std::cerr << "rcval: " << rcval[0] << std::endl;
+std::cerr << "rcval: " << rcval[1] << std::endl;
+std::cerr << "rcval: " << rcval[2] << std::endl;
+std::cerr << "rcval: " << rcval[3] << std::endl;
+std::cerr << "rcval: " << rcval[4] << std::endl;
+std::cerr << "rcval: " << rcval[5] << std::endl;
+
+rcval[0]=0.;
+rcval[1]=0.;
+rcval[2]=0.;
+info=cp_lre(component,CP_ITERATION,&tt1,&tt2,&i,(char*)"ae",3,&mval,rcval);
+std::cerr << "info: " << info << std::endl;
+std::cerr << "rcval: " << rcval[0] << std::endl;
+std::cerr << "rcval: " << rcval[1] << std::endl;
+std::cerr << "rcval: " << rcval[2] << std::endl;
+
+rival[0]=0;
+rival[1]=0;
+rival[2]=0;
+i=1;
+info=cp_llo(component,CP_ITERATION,&tt1,&tt2,&i,(char*)"af",3,&mval,rival);
+std::cerr << "info: " << info << std::endl;
+std::cerr << "rival: " << rival[0] << std::endl;
+std::cerr << "rival: " << rival[1] << std::endl;
+std::cerr << "rival: " << rival[2] << std::endl;
+
+info=cp_lln(component,CP_ITERATION,&tt1,&tt2,&i,(char*)"ag",3,&mval,rlval);
+std::cerr << "info: " << info << std::endl;
+std::cerr << "rlval: " << rlval[0] << std::endl;
+std::cerr << "rlval: " << rlval[1] << std::endl;
+std::cerr << "rlval: " << rlval[2] << std::endl;
+
+rival[0]=0;
+rival[1]=0;
+rival[2]=0;
+i=1;
+info=cp_len(component,CP_ITERATION,&tt1,&tt2,&i,(char*)"ah",3,&mval,rival);
+std::cerr << "info: " << info << std::endl;
+std::cerr << "rival: " << rival[0] << std::endl;
+std::cerr << "rival: " << rival[1] << std::endl;
+std::cerr << "rival: " << rival[2] << std::endl;
+
+info=cp_llg(component,CP_ITERATION,&tt1,&tt2,&i,(char*)"ai",3,&mval,rlval);
+std::cerr << "info: " << info << std::endl;
+std::cerr << "rlval: " << rlval[0] << std::endl;
+std::cerr << "rlval: " << rlval[1] << std::endl;
+std::cerr << "rlval: " << rlval[2] << std::endl;
+
+info=cp_fini(component,(char*)"aa",1);
+std::cerr << "info: " << info << std::endl;
+
+info=cp_effi(component,(char*)"aa",3);
+std::cerr << "info: " << info << std::endl;
+
+cp_fin(component,CP_ARRET);
+
+c=2*rval[0];
+std::cerr << "c: " << c << std::endl;
+"""
+c1=CPPComponent("compo1",services=[
+          Service("s1",inport=[("a","double"),("b","double")],
+                       outport=[("c","double")],
+                       instream=[("aa","CALCIUM_double","I"),
+                                 ("ab","CALCIUM_string","I"),
+                                 ("ac","CALCIUM_integer","I"),
+                                 ("ad","CALCIUM_complex","I"),
+                                 ("ae","CALCIUM_real","I"),
+                                 ("af","CALCIUM_logical","I"),
+                                 ("ag","CALCIUM_long","I"),
+                                 ("ah","CALCIUM_integer","I"),
+                                 ("ai","CALCIUM_integer","I"),
+                                ],
+                       outstream=[("ba","CALCIUM_double","I"),
+                                  ("bb","CALCIUM_string","I"),
+                                  ("bc","CALCIUM_integer","I"),
+                                  ("bd","CALCIUM_complex","I"),
+                                  ("be","CALCIUM_real","I"),
+                                  ("bf","CALCIUM_logical","I"),
+                                  ("bg","CALCIUM_long","I"),
+                                  ("bh","CALCIUM_integer","I"),
+                                  ("bi","CALCIUM_integer","I"),
+                                 ],
+                       defs="//def1",body=body,
+                 ),
+          ],
+         )
+
+# python component
+
+defs="""
+"""
+
+body="""
+#b1
+info,name= calcium.cp_cd(component)
+print "name=",name
+print "info=",info
+
+dep=calcium.CP_ITERATION
+
+#double
+val=numpy.zeros(10,'d')
+val[0]=7.7
+val[5]=a*b
+nval=10
+print "--------> Appel calcium.cp_edb",val
+info=calcium.cp_edb(component, dep, 0., 1, "ba", nval,val)
+info=calcium.cp_edb(component, dep, 0., 2, "ba", nval,val)
+info=calcium.cp_edb(component, dep, 0., 3, "ba", nval,val)
+
+#string
+val=numpy.array(["coucouc ","bonjour ","salut "])
+val=calcium.stringArray(3,8)
+val[0]="coucouc"
+val[1]="bonjour"
+val[2]="salut"
+print "--------> Appel calcium.cp_ech",val
+info=calcium.cp_ech(component, dep, 0., 1, "bb", 3,val)
+
+#int
+val=numpy.zeros(10,'i')
+val[0]=1
+val[1]=3
+print "--------> Appel calcium.cp_een",val
+info=calcium.cp_een(component, dep, 0., 1, "bc", 3,val)
+
+val=numpy.zeros(10,'F')
+val[0]=1+2j
+val[1]=3+2j
+print "--------> Appel calcium.cp_ecp",val
+info=calcium.cp_ecp(component, dep, 0., 1, "bd", 3,val)
+
+val=numpy.zeros(10,'f')
+val[0]=1.3
+val[1]=3.2
+print "--------> Appel calcium.cp_ere",val
+info=calcium.cp_ere(component, dep, 0., 1, "be", 3,val)
+
+val=numpy.zeros(10,'i')
+val[0]=True
+val[1]=False
+val[2]=False
+print "--------> Appel calcium.cp_elo",val
+info=calcium.cp_elo(component, dep, 0., 1, "bf", 3,val)
+
+val=numpy.zeros(10,'l')
+val[0]=1
+val[1]=3
+val[2]=333
+print "--------> Appel calcium.cp_eln",val
+info=calcium.cp_eln(component, dep, 0., 1, "bg", 3,val)
+
+val=numpy.zeros(10,'i')
+val[0]=1
+val[1]=3
+val[2]=4
+print "--------> Appel calcium.cp_een",val
+info=calcium.cp_een(component, dep, 0., 1, "bh", 3,val)
+
+val=numpy.zeros(10,'l')
+val[0]=1
+val[1]=3
+val[2]=333
+print "--------> Appel calcium.cp_elg",val
+info=calcium.cp_elg(component, dep, 0., 1, "bi", 3,val)
+print "info=",info
+
+#read
+val=numpy.zeros(10,'d')
+print "--------> Appel calcium.cp_ldb"
+info,tt,ii,mval=calcium.cp_ldb(component, dep, 0.,1., 1, "aa", 3,val)
+print mval,val
+
+val=numpy.array(["","","",], dtype='S13')
+print "--------> Appel calcium.cp_lch"
+info,tt,ii,mval=calcium.cp_lch(component, dep, 0.,1., 1, "ab", 3,val)
+print mval,val
+print val.dtype
+
+val=numpy.array(["            ","  ","  ",], dtype='S13')
+print "--------> Appel calcium.cp_lch"
+info,tt,ii,mval=calcium.cp_lch(component, dep, 0.,1., 1, "ab", 3,val)
+print mval,val
+print val.dtype
+
+val=calcium.stringArray(3,8)
+print "--------> Appel calcium.cp_lch"
+info,tt,ii,mval=calcium.cp_lch(component, dep, 0.,1., 1, "ab", 3,val)
+print mval,val
+print val[0]
+print val[1]
+print val[2]
+
+val=numpy.zeros(10,'i')
+print "--------> Appel calcium.cp_len"
+info,tt,ii,mval=calcium.cp_len(component, dep, 0.,1., 1, "ac", 3,val)
+print mval,val
+
+val=numpy.zeros(10,'F')
+print "--------> Appel calcium.cp_lcp"
+info,tt,ii,mval=calcium.cp_lcp(component, dep, 0.,1., 1, "ad", 3,val)
+print mval,val
+
+val=numpy.zeros(10,'f')
+print "--------> Appel calcium.cp_lre"
+info,tt,ii,mval=calcium.cp_lre(component, dep, 0.,1., 1, "ae", 3,val)
+print mval,val
+
+val=numpy.zeros(10,'i')
+print "--------> Appel calcium.cp_llo"
+info,tt,ii,mval=calcium.cp_llo(component, dep, 0.,1., 1, "af", 3,val)
+print mval,val
+
+val=numpy.zeros(10,'l')
+print "--------> Appel calcium.cp_lln"
+info,tt,ii,mval=calcium.cp_lln(component, dep, 0.,1., 1, "ag", 3,val)
+print mval,val
+
+val=numpy.zeros(10,'i')
+print "--------> Appel calcium.cp_len"
+info,tt,ii,mval=calcium.cp_len(component, dep, 0.,1., 1, "ah", 3,val)
+print mval,val
+
+val=numpy.zeros(10,'l')
+print "--------> Appel calcium.cp_llg"
+info,tt,ii,mval=calcium.cp_llg(component, dep, 0.,1., 1, "ai", 3,val)
+print "info=",info
+print mval,val
+
+info=calcium.cp_fini(component,"aa",1)
+print "info=",info
+
+info=calcium.cp_effi(component,"aa",3)
+print "info=",info
+
+import time
+time.sleep(15)
+
+c=a+b
+d=a-b
+err=calcium.cp_fin(component,calcium.CP_ARRET)
+print "err=",err
+"""
+c2=PYComponent("compo2",services=[
+          Service("s1",inport=[("a","double"),("b","double")],
+                       outport=[("c","double"),("d","double")],
+                       instream=[("aa","CALCIUM_double","I"),
+                                 ("ab","CALCIUM_string","I"),
+                                 ("ac","CALCIUM_integer","I"),
+                                 ("ad","CALCIUM_complex","I"),
+                                 ("ae","CALCIUM_real","I"),
+                                 ("af","CALCIUM_logical","I"),
+                                 ("ag","CALCIUM_long","I"),
+                                 ("ah","CALCIUM_integer","I"),
+                                 ("ai","CALCIUM_integer","I"),
+                                ],
+                       outstream=[("ba","CALCIUM_double","I"),
+                                  ("bb","CALCIUM_string","I"),
+                                  ("bc","CALCIUM_integer","I"),
+                                  ("bd","CALCIUM_complex","I"),
+                                  ("be","CALCIUM_real","I"),
+                                  ("bf","CALCIUM_logical","I"),
+                                  ("bg","CALCIUM_long","I"),
+                                  ("bh","CALCIUM_integer","I"),
+                                  ("bi","CALCIUM_integer","I"),
+                                 ],
+                       defs=defs,body=body,
+                 ),
+             ],
+         )
+
+#fortran component
+
+cwd=os.getcwd()
+
+c3=F77Component("fcode1", 
+                services=[
+                          Service("serv1",
+                                  inport=[("a","double"),("b","double")],
+                                  outport=[("c","double")],
+                                  instream=[("aa","CALCIUM_double","I"),
+                                            ("ab","CALCIUM_string","I"),
+                                            ("ac","CALCIUM_integer","I"),
+                                            ("ad","CALCIUM_complex","I"),
+                                            ("ae","CALCIUM_real","I"),
+                                            ("af","CALCIUM_logical","I"),
+                                            ("ag","CALCIUM_long","I"),
+                                            ("ah","CALCIUM_integer","I"),
+                                            ("ai","CALCIUM_integer","I"),
+                                           ],
+                                  outstream=[("ba","CALCIUM_double","I"),
+                                             ("bb","CALCIUM_string","I"),
+                                             ("bc","CALCIUM_integer","I"),
+                                             ("bd","CALCIUM_complex","I"),
+                                             ("be","CALCIUM_real","I"),
+                                             ("bf","CALCIUM_logical","I"),
+                                             ("bg","CALCIUM_long","I"),
+                                             ("bh","CALCIUM_integer","I"),
+                                             ("bi","CALCIUM_integer","I"),
+                                            ],
+                                 ),
+                         ],
+                libs="-L%s -lcode1" % cwd,
+                rlibs="-Wl,--rpath -Wl,%s" % cwd,
+               )
+
+g=Generator(Module("pycompos",components=[c1,c2,c3],prefix="./install",layout="multidir"),context)
+g.generate()
+g.bootstrap()
+g.configure()
+g.make()
+g.install()
+g.make_appli("appli", restrict=["KERNEL"], altmodules={"GUI":GUI_ROOT_DIR, "YACS":YACS_ROOT_DIR})
+
+
+
diff --git a/Examples/calcium1/coupling.xml b/Examples/calcium1/coupling.xml
new file mode 100644 (file)
index 0000000..7e3b245
--- /dev/null
@@ -0,0 +1,249 @@
+<?xml version='1.0' encoding='iso-8859-1' ?>
+<proc name="proc">
+   <property name="DefaultStudyID" value="1"/>
+   <objref name="CALCIUM_complex" id="IDL:Ports/Calcium_Ports/Calcium_Complex_Port:1.0"/>
+   <objref name="CALCIUM_double" id="IDL:Ports/Calcium_Ports/Calcium_Double_Port:1.0"/>
+   <objref name="CALCIUM_integer" id="IDL:Ports/Calcium_Ports/Calcium_Integer_Port:1.0"/>
+   <objref name="CALCIUM_logical" id="IDL:Ports/Calcium_Ports/Calcium_Logical_Port:1.0"/>
+   <objref name="CALCIUM_long" id="IDL:Ports/Calcium_Ports/Calcium_Long_Port:1.0"/>
+   <objref name="CALCIUM_real" id="IDL:Ports/Calcium_Ports/Calcium_Real_Port:1.0"/>
+   <objref name="CALCIUM_string" id="IDL:Ports/Calcium_Ports/Calcium_String_Port:1.0"/>
+   <type name="string" kind="string"/>
+   <struct name="Engines/dataref">
+      <member name="ref" type="string"/>
+   </struct>
+   <type name="bool" kind="bool"/>
+   <sequence name="boolvec" content="bool"/>
+   <type name="double" kind="double"/>
+   <sequence name="dblevec" content="double"/>
+   <objref name="file" id="file"/>
+   <type name="int" kind="int"/>
+   <sequence name="intvec" content="int"/>
+   <objref name="pyobj" id="python:obj:1.0"/>
+   <sequence name="stringvec" content="string"/>
+   <container name="A">
+   </container>
+   <container name="B">
+   </container>
+   <container name="C">
+   </container>
+   <container name="DefaultContainer">
+      <property name="container_name" value="FactoryServer"/>
+      <property name="name" value="clau5ckk"/>
+   </container>
+   <service name="node1">
+      <component>compo1</component>
+      <load container="A"/>
+      <method>s1</method>
+      <inport name="a" type="double"/>
+      <inport name="b" type="double"/>
+      <instream name="aa" type="CALCIUM_double"/>
+      <instream name="ab" type="CALCIUM_string"/>
+      <instream name="ac" type="CALCIUM_integer"/>
+      <instream name="ad" type="CALCIUM_complex"/>
+      <instream name="ae" type="CALCIUM_real"/>
+      <instream name="af" type="CALCIUM_logical"/>
+      <instream name="ag" type="CALCIUM_long"/>
+      <instream name="ah" type="CALCIUM_integer"/>
+      <instream name="ai" type="CALCIUM_integer"/>
+      <outport name="c" type="double"/>
+      <outstream name="ba" type="CALCIUM_double"/>
+      <outstream name="bb" type="CALCIUM_string"/>
+      <outstream name="bc" type="CALCIUM_integer"/>
+      <outstream name="bd" type="CALCIUM_complex"/>
+      <outstream name="be" type="CALCIUM_real"/>
+      <outstream name="bf" type="CALCIUM_logical"/>
+      <outstream name="bg" type="CALCIUM_long"/>
+      <outstream name="bh" type="CALCIUM_integer"/>
+      <outstream name="bi" type="CALCIUM_integer"/>
+   </service>
+   <service name="node2">
+      <component>compo2</component>
+      <load container="B"/>
+      <method>s1</method>
+      <inport name="a" type="double"/>
+      <inport name="b" type="double"/>
+      <instream name="aa" type="CALCIUM_double"/>
+      <instream name="ab" type="CALCIUM_string"/>
+      <instream name="ac" type="CALCIUM_integer"/>
+      <instream name="ad" type="CALCIUM_complex"/>
+      <instream name="ae" type="CALCIUM_real"/>
+      <instream name="af" type="CALCIUM_logical"/>
+      <instream name="ag" type="CALCIUM_long"/>
+      <instream name="ah" type="CALCIUM_integer"/>
+      <instream name="ai" type="CALCIUM_integer"/>
+      <outport name="c" type="double"/>
+      <outport name="d" type="double"/>
+      <outstream name="ba" type="CALCIUM_double"/>
+      <outstream name="bb" type="CALCIUM_string"/>
+      <outstream name="bc" type="CALCIUM_integer"/>
+      <outstream name="bd" type="CALCIUM_complex"/>
+      <outstream name="be" type="CALCIUM_real"/>
+      <outstream name="bf" type="CALCIUM_logical"/>
+      <outstream name="bg" type="CALCIUM_long"/>
+      <outstream name="bh" type="CALCIUM_integer"/>
+      <outstream name="bi" type="CALCIUM_integer"/>
+   </service>
+   <service name="node3">
+      <component>fcode1</component>
+      <load container="C"/>
+      <method>serv1</method>
+      <inport name="a" type="double"/>
+      <inport name="b" type="double"/>
+      <instream name="aa" type="CALCIUM_double"/>
+      <instream name="ab" type="CALCIUM_string"/>
+      <instream name="ac" type="CALCIUM_integer"/>
+      <instream name="ad" type="CALCIUM_complex"/>
+      <instream name="ae" type="CALCIUM_real"/>
+      <instream name="af" type="CALCIUM_logical"/>
+      <instream name="ag" type="CALCIUM_long"/>
+      <instream name="ah" type="CALCIUM_integer"/>
+      <instream name="ai" type="CALCIUM_integer"/>
+      <outport name="c" type="double"/>
+      <outstream name="ba" type="CALCIUM_double"/>
+      <outstream name="bb" type="CALCIUM_string"/>
+      <outstream name="bc" type="CALCIUM_integer"/>
+      <outstream name="bd" type="CALCIUM_complex"/>
+      <outstream name="be" type="CALCIUM_real"/>
+      <outstream name="bf" type="CALCIUM_logical"/>
+      <outstream name="bg" type="CALCIUM_long"/>
+      <outstream name="bh" type="CALCIUM_integer"/>
+      <outstream name="bi" type="CALCIUM_integer"/>
+   </service>
+   <stream>
+      <fromnode>node1</fromnode> <fromport>ba</fromport>
+      <tonode>node2</tonode> <toport>aa</toport>
+   </stream>
+   <stream>
+      <fromnode>node1</fromnode> <fromport>bb</fromport>
+      <tonode>node2</tonode> <toport>ab</toport>
+   </stream>
+   <stream>
+      <fromnode>node1</fromnode> <fromport>bc</fromport>
+      <tonode>node2</tonode> <toport>ac</toport>
+   </stream>
+   <stream>
+      <fromnode>node1</fromnode> <fromport>bd</fromport>
+      <tonode>node2</tonode> <toport>ad</toport>
+   </stream>
+   <stream>
+      <fromnode>node1</fromnode> <fromport>be</fromport>
+      <tonode>node2</tonode> <toport>ae</toport>
+   </stream>
+   <stream>
+      <fromnode>node1</fromnode> <fromport>bf</fromport>
+      <tonode>node2</tonode> <toport>af</toport>
+   </stream>
+   <stream>
+      <fromnode>node1</fromnode> <fromport>bg</fromport>
+      <tonode>node2</tonode> <toport>ag</toport>
+   </stream>
+   <stream>
+      <fromnode>node1</fromnode> <fromport>bh</fromport>
+      <tonode>node2</tonode> <toport>ah</toport>
+   </stream>
+   <stream>
+      <fromnode>node1</fromnode> <fromport>bi</fromport>
+      <tonode>node2</tonode> <toport>ai</toport>
+   </stream>
+   <stream>
+      <fromnode>node2</fromnode> <fromport>ba</fromport>
+      <tonode>node3</tonode> <toport>aa</toport>
+   </stream>
+   <stream>
+      <fromnode>node2</fromnode> <fromport>bb</fromport>
+      <tonode>node3</tonode> <toport>ab</toport>
+   </stream>
+   <stream>
+      <fromnode>node2</fromnode> <fromport>bc</fromport>
+      <tonode>node3</tonode> <toport>ac</toport>
+   </stream>
+   <stream>
+      <fromnode>node2</fromnode> <fromport>bd</fromport>
+      <tonode>node3</tonode> <toport>ad</toport>
+   </stream>
+   <stream>
+      <fromnode>node2</fromnode> <fromport>be</fromport>
+      <tonode>node3</tonode> <toport>ae</toport>
+   </stream>
+   <stream>
+      <fromnode>node2</fromnode> <fromport>bf</fromport>
+      <tonode>node3</tonode> <toport>af</toport>
+   </stream>
+   <stream>
+      <fromnode>node2</fromnode> <fromport>bg</fromport>
+      <tonode>node3</tonode> <toport>ag</toport>
+   </stream>
+   <stream>
+      <fromnode>node2</fromnode> <fromport>bh</fromport>
+      <tonode>node3</tonode> <toport>ah</toport>
+   </stream>
+   <stream>
+      <fromnode>node2</fromnode> <fromport>bi</fromport>
+      <tonode>node3</tonode> <toport>ai</toport>
+   </stream>
+   <stream>
+      <fromnode>node3</fromnode> <fromport>ba</fromport>
+      <tonode>node1</tonode> <toport>aa</toport>
+   </stream>
+   <stream>
+      <fromnode>node3</fromnode> <fromport>bb</fromport>
+      <tonode>node1</tonode> <toport>ab</toport>
+   </stream>
+   <stream>
+      <fromnode>node3</fromnode> <fromport>bc</fromport>
+      <tonode>node1</tonode> <toport>ac</toport>
+   </stream>
+   <stream>
+      <fromnode>node3</fromnode> <fromport>bd</fromport>
+      <tonode>node1</tonode> <toport>ad</toport>
+   </stream>
+   <stream>
+      <fromnode>node3</fromnode> <fromport>be</fromport>
+      <tonode>node1</tonode> <toport>ae</toport>
+   </stream>
+   <stream>
+      <fromnode>node3</fromnode> <fromport>bf</fromport>
+      <tonode>node1</tonode> <toport>af</toport>
+   </stream>
+   <stream>
+      <fromnode>node3</fromnode> <fromport>bg</fromport>
+      <tonode>node1</tonode> <toport>ag</toport>
+   </stream>
+   <stream>
+      <fromnode>node3</fromnode> <fromport>bh</fromport>
+      <tonode>node1</tonode> <toport>ah</toport>
+   </stream>
+   <stream>
+      <fromnode>node3</fromnode> <fromport>bi</fromport>
+      <tonode>node1</tonode> <toport>ai</toport>
+   </stream>
+   <parameter>
+      <tonode>node1</tonode><toport>a</toport>
+      <value><double>23</double></value>
+   </parameter>
+   <parameter>
+      <tonode>node1</tonode><toport>b</toport>
+      <value><double>53</double></value>
+   </parameter>
+   <parameter>
+      <tonode>node2</tonode><toport>a</toport>
+      <value><double>63</double></value>
+   </parameter>
+   <parameter>
+      <tonode>node2</tonode><toport>b</toport>
+      <value><double>73</double></value>
+   </parameter>
+   <parameter>
+      <tonode>node3</tonode><toport>a</toport>
+      <value><double>63</double></value>
+   </parameter>
+   <parameter>
+      <tonode>node3</tonode><toport>b</toport>
+      <value><double>73</double></value>
+   </parameter>
+   <presentation name="node1" x="1.75" y="33.25" width="158" height="333" expanded="1" expx="1.75" expy="33.25" expWidth="158" expHeight="333" shownState="0"/>
+   <presentation name="node2" x="195.75" y="166.25" width="158" height="333" expanded="1" expx="195.75" expy="166.25" expWidth="158" expHeight="333" shownState="0"/>
+   <presentation name="node3" x="389.75" y="33.25" width="158" height="333" expanded="1" expx="389.75" expy="33.25" expWidth="158" expHeight="333" shownState="0"/>
+   <presentation name="__ROOT__" x="0" y="0" width="551.75" height="503.25" expanded="1" expx="0" expy="0" expWidth="551.75" expHeight="503.25" shownState="0"/>
+</proc>
diff --git a/Examples/calcium2/Makefile b/Examples/calcium2/Makefile
new file mode 100644 (file)
index 0000000..bf7c92c
--- /dev/null
@@ -0,0 +1,30 @@
+# Copyright (C) 2009-2012  EDF R&D
+#
+# 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
+#
+
+include ../makefile.inc
+
+all:libcode1.so
+
+libcode1.so:code1.o
+         $(FC) -shared -fPIC -o libcode1.so code1.o
+code1.o:code1.f
+         $(FC) -c code1.f -fPIC -I$(KERNEL_ROOT_DIR)/include/salome -fexceptions
+
+clean:
+       rm -rf *.o *.so install install.bak traceExec_proc appli appli.bak pycompos_SRC pycompos_SRC.bak
diff --git a/Examples/calcium2/code1.f b/Examples/calcium2/code1.f
new file mode 100644 (file)
index 0000000..3f4afae
--- /dev/null
@@ -0,0 +1,272 @@
+C Copyright (C) 2009-2012  EDF R&D
+C
+C This library is free software; you can redistribute it and/or
+C modify it under the terms of the GNU Lesser General Public
+C License as published by the Free Software Foundation; either
+C version 2.1 of the License.
+C
+C This library is distributed in the hope that it will be useful,
+C but WITHOUT ANY WARRANTY; without even the implied warranty of
+C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+C Lesser General Public License for more details.
+C
+C You should have received a copy of the GNU Lesser General Public
+C License along with this library; if not, write to the Free Software
+C Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+C
+C See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+C
+
+       SUBROUTINE SERV1(compo,a,b,c)
+       include 'calcium.hf'
+       integer compo(2)
+       integer i, nval, info, z(10), l
+       integer*8 lz(10)
+       integer*4 z4(10),lo(10)
+
+       real*8 dd(10),a,b,c,ti,tf,t
+       real*4 u(20)
+       real*4 tti,ttf,tt
+       character*10 s(3)
+       character*20 rs(3)
+       character*64 instance
+
+       write(6,*)a,b
+       call cpcd(compo,instance,info)
+       write(6,*)"instance name=",instance
+
+C  write
+       tt=0.
+       t=0.
+       dd(1)=125.45
+       dd(2)=8.8
+       i=1
+       l=10
+       CALL cpedb(compo,CP_TEMPS,t,i,'ba',l,dd,info)
+       t=1.
+       CALL cpedb(compo,CP_TEMPS,t,i,'ba',l,dd,info)
+       t=2.
+       CALL cpedb(compo,CP_TEMPS,t,i,'ba',l,dd,info)
+       write(6,*)'info=',info
+       call flush(6)
+
+       s(1)="titi"
+       s(2)="tututu"
+       s(3)="tatatata"
+       write(6,*)'s=',s
+       l=3
+       CALL cpech(compo,CP_TEMPS,tt,i,'bb',l,s,info)
+       write(6,*)'info=',info
+       call flush(6)
+
+       z(1)=1
+       z(2)=8
+       z(3)=0
+       write(6,*)'z=',z(1)
+       write(6,*)'z=',z(2)
+       write(6,*)'z=',z(3)
+       l=10
+       CALL cpeen(compo,CP_TEMPS,tt,i,'bc',l,z,info)
+       write(6,*)'info=',info
+       call flush(6)
+
+       u(1)=1
+       u(2)=8
+       u(3)=4
+       u(4)=4
+       u(5)=5
+       u(6)=5
+       write(6,*)'u=',u(1)
+       write(6,*)'u=',u(2)
+       write(6,*)'u=',u(3)
+       write(6,*)'u=',u(4)
+       write(6,*)'u=',u(5)
+       write(6,*)'u=',u(6)
+       CALL cpecp(compo,CP_TEMPS,tt,i,'bd',l,u,info)
+       write(6,*)'info=',info
+       call flush(6)
+
+       u(1)=1.1
+       u(2)=8.8
+       u(3)=4.4
+       write(6,*)'u=',u(1)
+       write(6,*)'u=',u(2)
+       write(6,*)'u=',u(3)
+       CALL cpere(compo,CP_TEMPS,tt,i,'be',l,u,info)
+       write(6,*)'info=',info
+       call flush(6)
+
+       lo(1)=1
+       lo(2)=0
+       lo(3)=1
+       write(6,*)'lo=',lo(1)
+       write(6,*)'lo=',lo(2)
+       write(6,*)'lo=',lo(3)
+       CALL cpelo(compo,CP_TEMPS,tt,i,'bf',l,lo,info)
+       write(6,*)'info=',info
+       call flush(6)
+
+       lz(1)=11
+       lz(2)=22
+       lz(3)=33
+       write(6,*)'lz=',lz(1)
+       write(6,*)'lz=',lz(2)
+       write(6,*)'lz=',lz(3)
+       CALL cpeln(compo,CP_TEMPS,tt,i,'bg',l,lz,info)
+       write(6,*)'info=',info
+       call flush(6)
+
+       z4(1)=1
+       z4(2)=8
+       z4(3)=0
+       write(6,*)'z4=',z4(1)
+       write(6,*)'z4=',z4(2)
+       write(6,*)'z4=',z4(3)
+       CALL cpein(compo,CP_TEMPS,tt,i,'bh',l,z4,info)
+       write(6,*)'info=',info
+       call flush(6)
+
+       lz(1)=11
+       lz(2)=22
+       lz(3)=2**30
+       lz(3)=2**20*lz(3)
+       write(6,*)'lz=',lz(1)
+       write(6,*)'lz=',lz(2)
+       write(6,*)'lz=',lz(3)
+       CALL cpelg(compo,CP_TEMPS,tt,i,'bi',l,lz,info)
+       write(6,*)'info=',info
+       call flush(6)
+
+C  read 
+       ti=0.
+       tf=1.
+       i=1
+       dd(1)=0.
+       dd(2)=0.
+       dd(3)=0.
+       l=3
+       CALL cpldb(compo,CP_TEMPS,ti,tf,i,'aa',l,nval,dd,info)
+       write(6,*)'info=',info
+       write(6,*)'dd=',dd(1)
+       write(6,*)'dd=',dd(2)
+       write(6,*)'dd=',dd(3)
+       write(6,*)'nval=',nval
+       call flush(6)
+
+       tti=0.
+       ttf=1.
+       i=1
+       CALL cplch(compo,CP_TEMPS,tti,ttf,i,'ab',l,nval,rs,info)
+       write(6,*)'info=',info
+       write(6,*)'rs=',rs
+       write(6,*)'nval=',nval
+       call flush(6)
+
+       z(1)=0
+       z(2)=0
+       z(3)=0
+       CALL cplen(compo,CP_TEMPS,tti,ttf,i,'ac',l,nval,z,info)
+       write(6,*)'info=',info
+       write(6,*)'nval=',nval
+       write(6,*)'z=',z(1)
+       write(6,*)'z=',z(2)
+       write(6,*)'z=',z(3)
+       call flush(6)
+
+       u(1)=0
+       u(2)=0
+       u(3)=0
+       u(4)=0
+       u(5)=0
+       u(6)=0
+       CALL cplcp(compo,CP_TEMPS,tti,ttf,i,'ad',l,nval,u,info)
+       write(6,*)'info=',info
+       write(6,*)'nval=',nval
+       write(6,*)'u=',u(1)
+       write(6,*)'u=',u(2)
+       write(6,*)'u=',u(3)
+       write(6,*)'u=',u(4)
+       write(6,*)'u=',u(5)
+       write(6,*)'u=',u(6)
+       call flush(6)
+
+       u(1)=0
+       u(2)=0
+       u(3)=0
+       CALL cplre(compo,CP_TEMPS,tti,ttf,i,'ae',l,nval,u,info)
+       write(6,*)'info=',info
+       write(6,*)'nval=',nval
+       write(6,*)'u=',u(1)
+       write(6,*)'u=',u(2)
+       write(6,*)'u=',u(3)
+       call flush(6)
+
+       lo(1)=0
+       lo(2)=0
+       lo(3)=0
+       CALL cpllo(compo,CP_TEMPS,tti,ttf,i,'af',l,nval,lo,info)
+       write(6,*)'info=',info
+       write(6,*)'nval=',nval
+       write(6,*)'lo=',lo(1)
+       write(6,*)'lo=',lo(2)
+       write(6,*)'lo=',lo(3)
+       call flush(6)
+
+       lz(1)=0
+       lz(2)=0
+       lz(3)=0
+       CALL cplln(compo,CP_TEMPS,tti,ttf,i,'ag',l,nval,lz,info)
+       write(6,*)'info=',info
+       write(6,*)'nval=',nval
+       write(6,*)'lz=',lz(1)
+       write(6,*)'lz=',lz(2)
+       write(6,*)'lz=',lz(3)
+       call flush(6)
+
+       z4(1)=0
+       z4(2)=0
+       z4(3)=0
+       CALL cplin(compo,CP_TEMPS,tti,ttf,i,'ah',l,nval,z4,info)
+       write(6,*)'info=',info
+       write(6,*)'nval=',nval
+       write(6,*)'z4=',z4(1)
+       write(6,*)'z4=',z4(2)
+       write(6,*)'z4=',z4(3)
+       call flush(6)
+
+       lz(1)=0
+       lz(2)=0
+       lz(3)=0
+       CALL cpllg(compo,CP_TEMPS,tti,ttf,i,'ai',l,nval,lz,info)
+       write(6,*)'info=',info
+       write(6,*)'nval=',nval
+       write(6,*)'lz=',lz(1)
+       write(6,*)'lz=',lz(2)
+       write(6,*)'lz=',lz(3)
+       call flush(6)
+
+       call cpfint(compo,'aa',0.5,info)
+       write(6,*)'info=',info
+       call flush(6)
+
+       ti=0.
+       tf=0.
+       l=3
+       CALL cpldb(compo,CP_TEMPS,ti,tf,i,'aa',l,nval,dd,info)
+       write(6,*)'info=',info
+       call flush(6)
+
+       call cpefft(compo,'aa',1.5,info)
+       write(6,*)'info=',info
+       call flush(6)
+
+       ti=2.
+       tf=2.
+       l=3
+       CALL cpldb(compo,CP_TEMPS,ti,tf,i,'aa',l,nval,dd,info)
+       write(6,*)'info=',info
+       call flush(6)
+
+       c=a+b
+       return 
+       end
diff --git a/Examples/calcium2/components.py b/Examples/calcium2/components.py
new file mode 100644 (file)
index 0000000..6c36cd2
--- /dev/null
@@ -0,0 +1,463 @@
+# Copyright (C) 2009-2012  EDF R&D
+#
+# 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
+#
+
+import os
+
+#import context from ..
+execfile("../context.py")
+from module_generator import Generator,Module,Service,PYComponent,CPPComponent,F77Component
+
+# C++ component
+
+body="""
+std::cerr << "a: " << a << std::endl;
+std::cerr << "b: " << b << std::endl;
+int info;
+double t1,t2;
+float tt1,tt2;
+int i=1;
+int mval;
+double val[10],rval[10];
+int ival[10],rival[10];
+long lval[10],rlval[10];
+float cval[20],rcval[20];
+char* sval[]={"coucou","bonjour","salut"};
+char* rsval[3];
+char mystring1[10];
+char mystring2[10];
+char mystring3[10];
+rsval[0]=mystring1;
+rsval[1]=mystring2;
+rsval[2]=mystring3;
+
+val[0]=3.2;
+val[1]=5.2;
+val[2]=9.8;
+std::cerr << "val: " << val[0] << std::endl;
+std::cerr << "val: " << val[1] << std::endl;
+std::cerr << "val: " << val[2] << std::endl;
+cp_edb(component,CP_TEMPS,0.,1,(char*)"ba",10,val);
+cp_edb(component,CP_TEMPS,1.,2,(char*)"ba",10,val);
+cp_edb(component,CP_TEMPS,2.,3,(char*)"ba",10,val);
+
+std::cerr << "sval: " << sval[0] << std::endl;
+std::cerr << "sval: " << sval[1] << std::endl;
+std::cerr << "sval: " << sval[2] << std::endl;
+cp_ech(component,CP_TEMPS,0.,1,(char*)"bb",3,sval,6);
+
+ival[0]=1;
+ival[1]=2;
+ival[2]=3;
+std::cerr << "ival: " << ival[0] << std::endl;
+std::cerr << "ival: " << ival[1] << std::endl;
+std::cerr << "ival: " << ival[2] << std::endl;
+cp_een(component,CP_TEMPS,0.,1,(char*)"bc",10,ival);
+
+cval[0]=1;
+cval[1]=2;
+cval[2]=3;
+cval[3]=4.5;
+cval[4]=5.6;
+cval[5]=7.8;
+std::cerr << "cval: " << cval[0] << std::endl;
+std::cerr << "cval: " << cval[1] << std::endl;
+std::cerr << "cval: " << cval[2] << std::endl;
+std::cerr << "cval: " << cval[3] << std::endl;
+std::cerr << "cval: " << cval[4] << std::endl;
+std::cerr << "cval: " << cval[5] << std::endl;
+cp_ecp(component,CP_TEMPS,0.,1,(char*)"bd",10,cval);
+
+cval[0]=1.1;
+cval[1]=2.2;
+cval[2]=3.3;
+std::cerr << "cval: " << cval[0] << std::endl;
+std::cerr << "cval: " << cval[1] << std::endl;
+std::cerr << "cval: " << cval[2] << std::endl;
+cp_ere(component,CP_TEMPS,0.,1,(char*)"be",10,cval);
+
+ival[0]=1;
+ival[1]=0;
+ival[2]=1;
+std::cerr << "ival: " << ival[0] << std::endl;
+std::cerr << "ival: " << ival[1] << std::endl;
+std::cerr << "ival: " << ival[2] << std::endl;
+cp_elo(component,CP_TEMPS,0.,1,(char*)"bf",10,ival);
+
+lval[0]=1;
+lval[1]=2;
+lval[2]=3;
+std::cerr << "lval: " << lval[0] << std::endl;
+std::cerr << "lval: " << lval[1] << std::endl;
+std::cerr << "lval: " << lval[2] << std::endl;
+cp_eln(component,CP_TEMPS,0.,1,(char*)"bg",10,lval);
+
+ival[0]=1;
+ival[1]=2;
+ival[2]=3;
+std::cerr << "ival: " << ival[0] << std::endl;
+std::cerr << "ival: " << ival[1] << std::endl;
+std::cerr << "ival: " << ival[2] << std::endl;
+cp_een(component,CP_TEMPS,0.,1,(char*)"bh",10,ival);
+
+lval[0]=1;
+lval[1]=2;
+lval[2]=3;
+std::cerr << "lval: " << lval[0] << std::endl;
+std::cerr << "lval: " << lval[1] << std::endl;
+std::cerr << "lval: " << lval[2] << std::endl;
+cp_elg(component,CP_TEMPS,0.,1,(char*)"bi",10,lval);
+
+/* read */
+t1=0.;
+t2=1.;
+info=cp_ldb(component,CP_TEMPS,&t1,&t2,&i,(char*)"aa",3,&mval,rval);
+std::cerr << "info: " << info << std::endl;
+std::cerr << "rval: " << rval[0] << std::endl;
+std::cerr << "rval: " << rval[1] << std::endl;
+std::cerr << "rval: " << rval[2] << std::endl;
+
+tt1=0.;
+tt2=1.;
+info=cp_lch(component,CP_TEMPS,&tt1,&tt2,&i,(char*)"ab",3,&mval,rsval,7);
+std::cerr << "info: " << info << std::endl;
+std::cerr << "rsval: " << rsval[0] << std::endl;
+std::cerr << "rsval: " << rsval[1] << std::endl;
+std::cerr << "rsval: " << rsval[2] << std::endl;
+
+info=cp_len(component,CP_TEMPS,&tt1,&tt2,&i,(char*)"ac",3,&mval,rival);
+std::cerr << "info: " << info << std::endl;
+std::cerr << "rival: " << rival[0] << std::endl;
+std::cerr << "rival: " << rival[1] << std::endl;
+std::cerr << "rival: " << rival[2] << std::endl;
+
+info=cp_lcp(component,CP_TEMPS,&tt1,&tt2,&i,(char*)"ad",3,&mval,rcval);
+std::cerr << "info: " << info << std::endl;
+std::cerr << "rcval: " << rcval[0] << std::endl;
+std::cerr << "rcval: " << rcval[1] << std::endl;
+std::cerr << "rcval: " << rcval[2] << std::endl;
+std::cerr << "rcval: " << rcval[3] << std::endl;
+std::cerr << "rcval: " << rcval[4] << std::endl;
+std::cerr << "rcval: " << rcval[5] << std::endl;
+
+rcval[0]=0.;
+rcval[1]=0.;
+rcval[2]=0.;
+info=cp_lre(component,CP_TEMPS,&tt1,&tt2,&i,(char*)"ae",3,&mval,rcval);
+std::cerr << "info: " << info << std::endl;
+std::cerr << "rcval: " << rcval[0] << std::endl;
+std::cerr << "rcval: " << rcval[1] << std::endl;
+std::cerr << "rcval: " << rcval[2] << std::endl;
+
+rival[0]=0;
+rival[1]=0;
+rival[2]=0;
+i=1;
+info=cp_llo(component,CP_TEMPS,&tt1,&tt2,&i,(char*)"af",3,&mval,rival);
+std::cerr << "info: " << info << std::endl;
+std::cerr << "rival: " << rival[0] << std::endl;
+std::cerr << "rival: " << rival[1] << std::endl;
+std::cerr << "rival: " << rival[2] << std::endl;
+
+info=cp_lln(component,CP_TEMPS,&tt1,&tt2,&i,(char*)"ag",3,&mval,rlval);
+std::cerr << "info: " << info << std::endl;
+std::cerr << "rlval: " << rlval[0] << std::endl;
+std::cerr << "rlval: " << rlval[1] << std::endl;
+std::cerr << "rlval: " << rlval[2] << std::endl;
+
+rival[0]=0;
+rival[1]=0;
+rival[2]=0;
+i=1;
+info=cp_len(component,CP_TEMPS,&tt1,&tt2,&i,(char*)"ah",3,&mval,rival);
+std::cerr << "info: " << info << std::endl;
+std::cerr << "rival: " << rival[0] << std::endl;
+std::cerr << "rival: " << rival[1] << std::endl;
+std::cerr << "rival: " << rival[2] << std::endl;
+
+info=cp_llg(component,CP_TEMPS,&tt1,&tt2,&i,(char*)"ai",3,&mval,rlval);
+std::cerr << "info: " << info << std::endl;
+std::cerr << "rlval: " << rlval[0] << std::endl;
+std::cerr << "rlval: " << rlval[1] << std::endl;
+std::cerr << "rlval: " << rlval[2] << std::endl;
+
+info=cp_fint(component,(char*)"aa",0.5);
+std::cerr << "info: " << info << std::endl;
+
+info=cp_efft(component,(char*)"aa",1.5);
+std::cerr << "info: " << info << std::endl;
+
+c=2*rval[0];
+std::cerr << "c: " << c << std::endl;
+"""
+c1=CPPComponent("compo1",services=[
+          Service("s1",inport=[("a","double"),("b","double")],
+                       outport=[("c","double")],
+                       instream=[("aa","CALCIUM_double","T"),
+                                 ("ab","CALCIUM_string","T"),
+                                 ("ac","CALCIUM_integer","T"),
+                                 ("ad","CALCIUM_complex","T"),
+                                 ("ae","CALCIUM_real","T"),
+                                 ("af","CALCIUM_logical","T"),
+                                 ("ag","CALCIUM_long","T"),
+                                 ("ah","CALCIUM_integer","T"),
+                                 ("ai","CALCIUM_integer","T"),
+                                ],
+                       outstream=[("ba","CALCIUM_double","T"),
+                                  ("bb","CALCIUM_string","T"),
+                                  ("bc","CALCIUM_integer","T"),
+                                  ("bd","CALCIUM_complex","T"),
+                                  ("be","CALCIUM_real","T"),
+                                  ("bf","CALCIUM_logical","T"),
+                                  ("bg","CALCIUM_long","T"),
+                                  ("bh","CALCIUM_integer","T"),
+                                  ("bi","CALCIUM_integer","T"),
+                                 ],
+                       defs="//def1",body=body,
+                 ),
+          ],
+         )
+
+# python component
+
+defs="""
+"""
+
+body="""
+#b1
+info,name= calcium.cp_cd(component)
+print "name=",name
+print "info=",info
+dep=calcium.CP_TEMPS
+
+#double
+val=numpy.zeros(10,'d')
+val[0]=7.7
+val[5]=a*b
+nval=10
+print "--------> Appel calcium.cp_edb",val
+info=calcium.cp_edb(component, dep, 0., 1, "ba", nval,val)
+info=calcium.cp_edb(component, dep, 1., 2, "ba", nval,val)
+info=calcium.cp_edb(component, dep, 2., 3, "ba", nval,val)
+
+#string
+val=numpy.array(["coucouc ","bonjour ","salut "])
+val=calcium.stringArray(3,8)
+val[0]="coucouc"
+val[1]="bonjour"
+val[2]="salut"
+print "--------> Appel calcium.cp_ech",val
+info=calcium.cp_ech(component, dep, 0., 1, "bb", 3,val)
+
+#int
+val=numpy.zeros(10,'i')
+val[0]=1
+val[1]=3
+print "--------> Appel calcium.cp_een",val
+info=calcium.cp_een(component, dep, 0., 1, "bc", 3,val)
+
+val=numpy.zeros(10,'F')
+val[0]=1+2j
+val[1]=3+2j
+print "--------> Appel calcium.cp_ecp",val
+info=calcium.cp_ecp(component, dep, 0., 1, "bd", 3,val)
+
+val=numpy.zeros(10,'f')
+val[0]=1.3
+val[1]=3.2
+print "--------> Appel calcium.cp_ere",val
+info=calcium.cp_ere(component, dep, 0., 1, "be", 3,val)
+
+val=numpy.zeros(10,'i')
+val[0]=True
+val[1]=False
+val[2]=False
+print "--------> Appel calcium.cp_elo",val
+info=calcium.cp_elo(component, dep, 0., 1, "bf", 3,val)
+
+val=numpy.zeros(10,'l')
+val[0]=1
+val[1]=3
+val[2]=333
+print "--------> Appel calcium.cp_eln",val
+info=calcium.cp_eln(component, dep, 0., 1, "bg", 3,val)
+
+val=numpy.zeros(10,'i')
+val[0]=1
+val[1]=3
+val[2]=4
+print "--------> Appel calcium.cp_een",val
+info=calcium.cp_een(component, dep, 0., 1, "bh", 3,val)
+
+val=numpy.zeros(10,'l')
+val[0]=1
+val[1]=3
+val[2]=333
+print "--------> Appel calcium.cp_elg",val
+info=calcium.cp_elg(component, dep, 0., 1, "bi", 3,val)
+print "info=",info
+
+#read
+val=numpy.zeros(10,'d')
+print "--------> Appel calcium.cp_ldb"
+info,tt,ii,mval=calcium.cp_ldb(component, dep, 0.,1., 1, "aa", 3,val)
+print mval,val
+
+val=numpy.array(["","","",], dtype='S13')
+print "--------> Appel calcium.cp_lch"
+info,tt,ii,mval=calcium.cp_lch(component, dep, 0.,1., 1, "ab", 3,val)
+print mval,val
+print val.dtype
+
+val=numpy.array(["            ","  ","  ",], dtype='S13')
+print "--------> Appel calcium.cp_lch"
+info,tt,ii,mval=calcium.cp_lch(component, dep, 0.,1., 1, "ab", 3,val)
+print mval,val
+print val.dtype
+
+val=calcium.stringArray(3,8)
+print "--------> Appel calcium.cp_lch"
+info,tt,ii,mval=calcium.cp_lch(component, dep, 0.,1., 1, "ab", 3,val)
+print mval,val
+print val[0]
+print val[1]
+print val[2]
+
+val=numpy.zeros(10,'i')
+print "--------> Appel calcium.cp_len"
+info,tt,ii,mval=calcium.cp_len(component, dep, 0.,1., 1, "ac", 3,val)
+print mval,val
+
+val=numpy.zeros(10,'F')
+print "--------> Appel calcium.cp_lcp"
+info,tt,ii,mval=calcium.cp_lcp(component, dep, 0.,1., 1, "ad", 3,val)
+print mval,val
+
+val=numpy.zeros(10,'f')
+print "--------> Appel calcium.cp_lre"
+info,tt,ii,mval=calcium.cp_lre(component, dep, 0.,1., 1, "ae", 3,val)
+print mval,val
+
+val=numpy.zeros(10,'i')
+print "--------> Appel calcium.cp_llo"
+info,tt,ii,mval=calcium.cp_llo(component, dep, 0.,1., 1, "af", 3,val)
+print mval,val
+
+val=numpy.zeros(10,'l')
+print "--------> Appel calcium.cp_lln"
+info,tt,ii,mval=calcium.cp_lln(component, dep, 0.,1., 1, "ag", 3,val)
+print mval,val
+
+val=numpy.zeros(10,'i')
+print "--------> Appel calcium.cp_len"
+info,tt,ii,mval=calcium.cp_len(component, dep, 0.,1., 1, "ah", 3,val)
+print mval,val
+
+val=numpy.zeros(10,'l')
+print "--------> Appel calcium.cp_llg"
+info,tt,ii,mval=calcium.cp_llg(component, dep, 0.,1., 1, "ai", 3,val)
+print "info=",info
+print mval,val
+
+info=calcium.cp_fint(component,"aa",0.5)
+print "info=",info
+
+info=calcium.cp_efft(component,"aa",1.5)
+print "info=",info
+
+import time
+time.sleep(15)
+
+c=a+b
+d=a-b
+err=calcium.cp_fin(component,calcium.CP_ARRET)
+print "err=",err
+"""
+c2=PYComponent("compo2",services=[
+          Service("s1",inport=[("a","double"),("b","double")],
+                       outport=[("c","double"),("d","double")],
+                       instream=[("aa","CALCIUM_double","T"),
+                                 ("ab","CALCIUM_string","T"),
+                                 ("ac","CALCIUM_integer","T"),
+                                 ("ad","CALCIUM_complex","T"),
+                                 ("ae","CALCIUM_real","T"),
+                                 ("af","CALCIUM_logical","T"),
+                                 ("ag","CALCIUM_long","T"),
+                                 ("ah","CALCIUM_integer","T"),
+                                 ("ai","CALCIUM_integer","T"),
+                                ],
+                       outstream=[("ba","CALCIUM_double","T"),
+                                  ("bb","CALCIUM_string","T"),
+                                  ("bc","CALCIUM_integer","T"),
+                                  ("bd","CALCIUM_complex","T"),
+                                  ("be","CALCIUM_real","T"),
+                                  ("bf","CALCIUM_logical","T"),
+                                  ("bg","CALCIUM_long","T"),
+                                  ("bh","CALCIUM_integer","T"),
+                                  ("bi","CALCIUM_integer","T"),
+                                 ],
+                       defs=defs,body=body,
+                 ),
+             ],
+         )
+
+#fortran component
+
+cwd=os.getcwd()
+
+c3=F77Component("fcode1", 
+                services=[
+                          Service("serv1",
+                                  inport=[("a","double"),("b","double")],
+                                  outport=[("c","double")],
+                                  instream=[("aa","CALCIUM_double","T"),
+                                            ("ab","CALCIUM_string","T"),
+                                            ("ac","CALCIUM_integer","T"),
+                                            ("ad","CALCIUM_complex","T"),
+                                            ("ae","CALCIUM_real","T"),
+                                            ("af","CALCIUM_logical","T"),
+                                            ("ag","CALCIUM_long","T"),
+                                            ("ah","CALCIUM_integer","T"),
+                                            ("ai","CALCIUM_integer","T"),
+                                           ],
+                                  outstream=[("ba","CALCIUM_double","T"),
+                                             ("bb","CALCIUM_string","T"),
+                                             ("bc","CALCIUM_integer","T"),
+                                             ("bd","CALCIUM_complex","T"),
+                                             ("be","CALCIUM_real","T"),
+                                             ("bf","CALCIUM_logical","T"),
+                                             ("bg","CALCIUM_long","T"),
+                                             ("bh","CALCIUM_integer","T"),
+                                             ("bi","CALCIUM_integer","T"),
+                                            ],
+                                 ),
+                         ],
+                libs="-L%s -lcode1" % cwd,
+                rlibs="-Wl,--rpath -Wl,%s" % cwd,
+               )
+
+g=Generator(Module("pycompos",components=[c1,c2,c3],prefix="./install",layout="multidir"),context)
+g.generate()
+g.bootstrap()
+g.configure()
+g.make()
+g.install()
+g.make_appli("appli", restrict=["KERNEL"], altmodules={"GUI":GUI_ROOT_DIR, "YACS":YACS_ROOT_DIR})
+
+
+
diff --git a/Examples/calcium2/coupling.xml b/Examples/calcium2/coupling.xml
new file mode 100644 (file)
index 0000000..7e3b245
--- /dev/null
@@ -0,0 +1,249 @@
+<?xml version='1.0' encoding='iso-8859-1' ?>
+<proc name="proc">
+   <property name="DefaultStudyID" value="1"/>
+   <objref name="CALCIUM_complex" id="IDL:Ports/Calcium_Ports/Calcium_Complex_Port:1.0"/>
+   <objref name="CALCIUM_double" id="IDL:Ports/Calcium_Ports/Calcium_Double_Port:1.0"/>
+   <objref name="CALCIUM_integer" id="IDL:Ports/Calcium_Ports/Calcium_Integer_Port:1.0"/>
+   <objref name="CALCIUM_logical" id="IDL:Ports/Calcium_Ports/Calcium_Logical_Port:1.0"/>
+   <objref name="CALCIUM_long" id="IDL:Ports/Calcium_Ports/Calcium_Long_Port:1.0"/>
+   <objref name="CALCIUM_real" id="IDL:Ports/Calcium_Ports/Calcium_Real_Port:1.0"/>
+   <objref name="CALCIUM_string" id="IDL:Ports/Calcium_Ports/Calcium_String_Port:1.0"/>
+   <type name="string" kind="string"/>
+   <struct name="Engines/dataref">
+      <member name="ref" type="string"/>
+   </struct>
+   <type name="bool" kind="bool"/>
+   <sequence name="boolvec" content="bool"/>
+   <type name="double" kind="double"/>
+   <sequence name="dblevec" content="double"/>
+   <objref name="file" id="file"/>
+   <type name="int" kind="int"/>
+   <sequence name="intvec" content="int"/>
+   <objref name="pyobj" id="python:obj:1.0"/>
+   <sequence name="stringvec" content="string"/>
+   <container name="A">
+   </container>
+   <container name="B">
+   </container>
+   <container name="C">
+   </container>
+   <container name="DefaultContainer">
+      <property name="container_name" value="FactoryServer"/>
+      <property name="name" value="clau5ckk"/>
+   </container>
+   <service name="node1">
+      <component>compo1</component>
+      <load container="A"/>
+      <method>s1</method>
+      <inport name="a" type="double"/>
+      <inport name="b" type="double"/>
+      <instream name="aa" type="CALCIUM_double"/>
+      <instream name="ab" type="CALCIUM_string"/>
+      <instream name="ac" type="CALCIUM_integer"/>
+      <instream name="ad" type="CALCIUM_complex"/>
+      <instream name="ae" type="CALCIUM_real"/>
+      <instream name="af" type="CALCIUM_logical"/>
+      <instream name="ag" type="CALCIUM_long"/>
+      <instream name="ah" type="CALCIUM_integer"/>
+      <instream name="ai" type="CALCIUM_integer"/>
+      <outport name="c" type="double"/>
+      <outstream name="ba" type="CALCIUM_double"/>
+      <outstream name="bb" type="CALCIUM_string"/>
+      <outstream name="bc" type="CALCIUM_integer"/>
+      <outstream name="bd" type="CALCIUM_complex"/>
+      <outstream name="be" type="CALCIUM_real"/>
+      <outstream name="bf" type="CALCIUM_logical"/>
+      <outstream name="bg" type="CALCIUM_long"/>
+      <outstream name="bh" type="CALCIUM_integer"/>
+      <outstream name="bi" type="CALCIUM_integer"/>
+   </service>
+   <service name="node2">
+      <component>compo2</component>
+      <load container="B"/>
+      <method>s1</method>
+      <inport name="a" type="double"/>
+      <inport name="b" type="double"/>
+      <instream name="aa" type="CALCIUM_double"/>
+      <instream name="ab" type="CALCIUM_string"/>
+      <instream name="ac" type="CALCIUM_integer"/>
+      <instream name="ad" type="CALCIUM_complex"/>
+      <instream name="ae" type="CALCIUM_real"/>
+      <instream name="af" type="CALCIUM_logical"/>
+      <instream name="ag" type="CALCIUM_long"/>
+      <instream name="ah" type="CALCIUM_integer"/>
+      <instream name="ai" type="CALCIUM_integer"/>
+      <outport name="c" type="double"/>
+      <outport name="d" type="double"/>
+      <outstream name="ba" type="CALCIUM_double"/>
+      <outstream name="bb" type="CALCIUM_string"/>
+      <outstream name="bc" type="CALCIUM_integer"/>
+      <outstream name="bd" type="CALCIUM_complex"/>
+      <outstream name="be" type="CALCIUM_real"/>
+      <outstream name="bf" type="CALCIUM_logical"/>
+      <outstream name="bg" type="CALCIUM_long"/>
+      <outstream name="bh" type="CALCIUM_integer"/>
+      <outstream name="bi" type="CALCIUM_integer"/>
+   </service>
+   <service name="node3">
+      <component>fcode1</component>
+      <load container="C"/>
+      <method>serv1</method>
+      <inport name="a" type="double"/>
+      <inport name="b" type="double"/>
+      <instream name="aa" type="CALCIUM_double"/>
+      <instream name="ab" type="CALCIUM_string"/>
+      <instream name="ac" type="CALCIUM_integer"/>
+      <instream name="ad" type="CALCIUM_complex"/>
+      <instream name="ae" type="CALCIUM_real"/>
+      <instream name="af" type="CALCIUM_logical"/>
+      <instream name="ag" type="CALCIUM_long"/>
+      <instream name="ah" type="CALCIUM_integer"/>
+      <instream name="ai" type="CALCIUM_integer"/>
+      <outport name="c" type="double"/>
+      <outstream name="ba" type="CALCIUM_double"/>
+      <outstream name="bb" type="CALCIUM_string"/>
+      <outstream name="bc" type="CALCIUM_integer"/>
+      <outstream name="bd" type="CALCIUM_complex"/>
+      <outstream name="be" type="CALCIUM_real"/>
+      <outstream name="bf" type="CALCIUM_logical"/>
+      <outstream name="bg" type="CALCIUM_long"/>
+      <outstream name="bh" type="CALCIUM_integer"/>
+      <outstream name="bi" type="CALCIUM_integer"/>
+   </service>
+   <stream>
+      <fromnode>node1</fromnode> <fromport>ba</fromport>
+      <tonode>node2</tonode> <toport>aa</toport>
+   </stream>
+   <stream>
+      <fromnode>node1</fromnode> <fromport>bb</fromport>
+      <tonode>node2</tonode> <toport>ab</toport>
+   </stream>
+   <stream>
+      <fromnode>node1</fromnode> <fromport>bc</fromport>
+      <tonode>node2</tonode> <toport>ac</toport>
+   </stream>
+   <stream>
+      <fromnode>node1</fromnode> <fromport>bd</fromport>
+      <tonode>node2</tonode> <toport>ad</toport>
+   </stream>
+   <stream>
+      <fromnode>node1</fromnode> <fromport>be</fromport>
+      <tonode>node2</tonode> <toport>ae</toport>
+   </stream>
+   <stream>
+      <fromnode>node1</fromnode> <fromport>bf</fromport>
+      <tonode>node2</tonode> <toport>af</toport>
+   </stream>
+   <stream>
+      <fromnode>node1</fromnode> <fromport>bg</fromport>
+      <tonode>node2</tonode> <toport>ag</toport>
+   </stream>
+   <stream>
+      <fromnode>node1</fromnode> <fromport>bh</fromport>
+      <tonode>node2</tonode> <toport>ah</toport>
+   </stream>
+   <stream>
+      <fromnode>node1</fromnode> <fromport>bi</fromport>
+      <tonode>node2</tonode> <toport>ai</toport>
+   </stream>
+   <stream>
+      <fromnode>node2</fromnode> <fromport>ba</fromport>
+      <tonode>node3</tonode> <toport>aa</toport>
+   </stream>
+   <stream>
+      <fromnode>node2</fromnode> <fromport>bb</fromport>
+      <tonode>node3</tonode> <toport>ab</toport>
+   </stream>
+   <stream>
+      <fromnode>node2</fromnode> <fromport>bc</fromport>
+      <tonode>node3</tonode> <toport>ac</toport>
+   </stream>
+   <stream>
+      <fromnode>node2</fromnode> <fromport>bd</fromport>
+      <tonode>node3</tonode> <toport>ad</toport>
+   </stream>
+   <stream>
+      <fromnode>node2</fromnode> <fromport>be</fromport>
+      <tonode>node3</tonode> <toport>ae</toport>
+   </stream>
+   <stream>
+      <fromnode>node2</fromnode> <fromport>bf</fromport>
+      <tonode>node3</tonode> <toport>af</toport>
+   </stream>
+   <stream>
+      <fromnode>node2</fromnode> <fromport>bg</fromport>
+      <tonode>node3</tonode> <toport>ag</toport>
+   </stream>
+   <stream>
+      <fromnode>node2</fromnode> <fromport>bh</fromport>
+      <tonode>node3</tonode> <toport>ah</toport>
+   </stream>
+   <stream>
+      <fromnode>node2</fromnode> <fromport>bi</fromport>
+      <tonode>node3</tonode> <toport>ai</toport>
+   </stream>
+   <stream>
+      <fromnode>node3</fromnode> <fromport>ba</fromport>
+      <tonode>node1</tonode> <toport>aa</toport>
+   </stream>
+   <stream>
+      <fromnode>node3</fromnode> <fromport>bb</fromport>
+      <tonode>node1</tonode> <toport>ab</toport>
+   </stream>
+   <stream>
+      <fromnode>node3</fromnode> <fromport>bc</fromport>
+      <tonode>node1</tonode> <toport>ac</toport>
+   </stream>
+   <stream>
+      <fromnode>node3</fromnode> <fromport>bd</fromport>
+      <tonode>node1</tonode> <toport>ad</toport>
+   </stream>
+   <stream>
+      <fromnode>node3</fromnode> <fromport>be</fromport>
+      <tonode>node1</tonode> <toport>ae</toport>
+   </stream>
+   <stream>
+      <fromnode>node3</fromnode> <fromport>bf</fromport>
+      <tonode>node1</tonode> <toport>af</toport>
+   </stream>
+   <stream>
+      <fromnode>node3</fromnode> <fromport>bg</fromport>
+      <tonode>node1</tonode> <toport>ag</toport>
+   </stream>
+   <stream>
+      <fromnode>node3</fromnode> <fromport>bh</fromport>
+      <tonode>node1</tonode> <toport>ah</toport>
+   </stream>
+   <stream>
+      <fromnode>node3</fromnode> <fromport>bi</fromport>
+      <tonode>node1</tonode> <toport>ai</toport>
+   </stream>
+   <parameter>
+      <tonode>node1</tonode><toport>a</toport>
+      <value><double>23</double></value>
+   </parameter>
+   <parameter>
+      <tonode>node1</tonode><toport>b</toport>
+      <value><double>53</double></value>
+   </parameter>
+   <parameter>
+      <tonode>node2</tonode><toport>a</toport>
+      <value><double>63</double></value>
+   </parameter>
+   <parameter>
+      <tonode>node2</tonode><toport>b</toport>
+      <value><double>73</double></value>
+   </parameter>
+   <parameter>
+      <tonode>node3</tonode><toport>a</toport>
+      <value><double>63</double></value>
+   </parameter>
+   <parameter>
+      <tonode>node3</tonode><toport>b</toport>
+      <value><double>73</double></value>
+   </parameter>
+   <presentation name="node1" x="1.75" y="33.25" width="158" height="333" expanded="1" expx="1.75" expy="33.25" expWidth="158" expHeight="333" shownState="0"/>
+   <presentation name="node2" x="195.75" y="166.25" width="158" height="333" expanded="1" expx="195.75" expy="166.25" expWidth="158" expHeight="333" shownState="0"/>
+   <presentation name="node3" x="389.75" y="33.25" width="158" height="333" expanded="1" expx="389.75" expy="33.25" expWidth="158" expHeight="333" shownState="0"/>
+   <presentation name="__ROOT__" x="0" y="0" width="551.75" height="503.25" expanded="1" expx="0" expy="0" expWidth="551.75" expHeight="503.25" shownState="0"/>
+</proc>
diff --git a/Examples/context.py b/Examples/context.py
new file mode 100644 (file)
index 0000000..a264b14
--- /dev/null
@@ -0,0 +1,41 @@
+# Copyright (C) 2009-2012  EDF R&D
+#
+# 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
+#
+
+import os,sys
+sys.path.insert(0,"../..")
+
+SALOME_ROOT=os.path.expanduser("~/Salome/Install")
+SALOME_PREREQ=os.path.expanduser("~/.packages.d/envSalome6main")
+
+KERNEL_ROOT_DIR=os.getenv("KERNEL_ROOT_DIR",os.path.join(SALOME_ROOT,"KERNEL_V6"))
+GUI_ROOT_DIR=os.getenv("GUI_ROOT_DIR",os.path.join(SALOME_ROOT,"GUI_V6"))
+YACS_ROOT_DIR=os.getenv("YACS_ROOT_DIR",os.path.join(SALOME_ROOT,"YACS_V6"))
+GEOM_ROOT_DIR=os.getenv("GEOM_ROOT_DIR",os.path.join(SALOME_ROOT,"GEOM_V6"))
+
+context={'update':1,
+         "makeflags":"",
+         "prerequisites":SALOME_PREREQ,
+         "kernel":KERNEL_ROOT_DIR,
+         "gui":GUI_ROOT_DIR,
+         "geom":GEOM_ROOT_DIR,
+        }
+
+
+aster_home=os.path.expanduser("~/Aster/V10.3/aster")
+aster_version="STA10.3"
diff --git a/Examples/cpp1/Makefile b/Examples/cpp1/Makefile
new file mode 100644 (file)
index 0000000..8c036b0
--- /dev/null
@@ -0,0 +1,21 @@
+# Copyright (C) 2009-2012  EDF R&D
+#
+# 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
+#
+
+clean:
+       rm -rf *.o *.so cppcompos_SRC cppcompos_SRC.bak appli appli.bak install install.bak traceExec_proc
index efa5554ecce118e2eb631d4d6c693fa95fe7f240..6703a6225a34a1edc86ac4bc24547e0199e452ff 100644 (file)
@@ -1,19 +1,19 @@
 A C++ component dynamically loadable
 =========================================
 
-To build this example, modify the components.py file
+To build this example, modify the ../context.py file
 to take into account your configuration.
 
 1- your prerequisite file 
 2- your KERNEL_ROOT_DIR
 
-Then set the environment (including PYTHONPATH for YACGEN, ../.. from here and execute components.py ::
+Then set the environment (including PYTHONPATH for YACSGEN, ../.. from here and execute components.py ::
 
   source <your prerequisite file>
   python components.py
 
 You should get a SALOME module in source form (cppcompos_SRC), its installation (install) and
-a SALOME application (appli) composed of modules KERNEL, GUI, YACS and cppcompos.
+a SALOME application (appli) composed of modules KERNEL, GUI, YACS and the new module cppcompos.
 
 To run a coupling:
 
index fa1a3bbdc23d4eb3ab43d08234e2e7002d682d2f..58c9da973b4b3a4493df78de049af301a1dbaeeb 100644 (file)
@@ -1,10 +1,27 @@
+# Copyright (C) 2009-2012  EDF R&D
+#
+# 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
+#
+
 import os
-from module_generator import Generator,Module,Service,CPPComponent
 
-context={'update':1,
-         "prerequisites":"/local/cchris/.packages.d/envSalome50",
-         "kernel":"/local/chris/SALOME2/RELEASES/Install/KERNEL_V5",
-        }
+#import context from ..
+execfile("../context.py")
+from module_generator import Generator,Module,Service,CPPComponent
 
 cwd=os.getcwd()
 
@@ -32,6 +49,7 @@ c1=CPPComponent("compo1",services=[
                  ),
           ],
          includes="-I/usr/include",
+         calciumextendedinterface=1,
          )
 
 
@@ -41,5 +59,5 @@ g.bootstrap()
 g.configure()
 g.make()
 g.install()
-g.make_appli("appli",restrict=["KERNEL","GUI","YACS"])
+g.make_appli("appli", restrict=["KERNEL"], altmodules={"GUI":GUI_ROOT_DIR, "YACS":YACS_ROOT_DIR})
 
index 07b3a2671d3dbcbe8b81aa4a120c2208c62d6a3c..bf6dbfc769e84b11267a6c2cf02c08952d04e152 100644 (file)
@@ -1,63 +1,73 @@
-
-<proc>
-
-<!-- types -->
-
-
-<container name="A">
-</container>
-
-<container name="B">
-</container>
-
-<service name="node1" >
-  <component>compo1</component>
-  <method>s1</method>
-  <load container="A"/>
-  <inport name="a" type="double"/>
-  <inport name="b" type="double"/>
-  <outport name="c" type="double"/>
-  <instream name="aa" type="CALCIUM_double"/>
-  <outstream name="ba" type="CALCIUM_double"/>
-</service>
-
-<service name="node2" >
-  <component>compo1</component>
-  <method>s1</method>
-  <load container="B"/>
-  <inport name="a" type="double"/>
-  <inport name="b" type="double"/>
-  <outport name="c" type="double"/>
-  <instream name="aa" type="CALCIUM_double"/>
-  <outstream name="ba" type="CALCIUM_double"/>
-</service>
-
-<!--datalinks -->
-<stream>
-  <fromnode>node1</fromnode><fromport>ba</fromport>
-  <tonode>node2</tonode><toport>aa</toport>
-</stream>
-<stream>
-  <fromnode>node2</fromnode><fromport>ba</fromport>
-  <tonode>node1</tonode><toport>aa</toport>
-</stream>
-
-<parameter>
-  <tonode>node1</tonode> <toport>a</toport>
-  <value><double>23</double> </value>
-</parameter>
-<parameter>
-  <tonode>node1</tonode> <toport>b</toport>
-  <value><double>53</double> </value>
-</parameter>
-<parameter>
-  <tonode>node2</tonode> <toport>a</toport>
-  <value><double>63</double> </value>
-</parameter>
-<parameter>
-  <tonode>node2</tonode> <toport>b</toport>
-  <value><double>73</double> </value>
-</parameter>
-
+<?xml version='1.0' encoding='iso-8859-1' ?>
+<proc name="proc">
+   <property name="DefaultStudyID" value="1"/>
+   <objref name="CALCIUM_double" id="IDL:Ports/Calcium_Ports/Calcium_Double_Port:1.0"/>
+   <type name="string" kind="string"/>
+   <struct name="Engines/dataref">
+      <member name="ref" type="string"/>
+   </struct>
+   <type name="bool" kind="bool"/>
+   <sequence name="boolvec" content="bool"/>
+   <type name="double" kind="double"/>
+   <sequence name="dblevec" content="double"/>
+   <objref name="file" id="file"/>
+   <type name="int" kind="int"/>
+   <sequence name="intvec" content="int"/>
+   <objref name="pyobj" id="python:obj:1.0"/>
+   <sequence name="stringvec" content="string"/>
+   <container name="A">
+   </container>
+   <container name="B">
+   </container>
+   <container name="DefaultContainer">
+      <property name="container_name" value="FactoryServer"/>
+      <property name="name" value="localhost"/>
+   </container>
+   <service name="node1">
+      <component>compo1</component>
+      <load container="A"/>
+      <method>s1</method>
+      <inport name="a" type="double"/>
+      <inport name="b" type="double"/>
+      <instream name="aa" type="CALCIUM_double"/>
+      <outport name="c" type="double"/>
+      <outstream name="ba" type="CALCIUM_double"/>
+   </service>
+   <service name="node2">
+      <component>compo1</component>
+      <load container="B"/>
+      <method>s1</method>
+      <inport name="a" type="double"/>
+      <inport name="b" type="double"/>
+      <instream name="aa" type="CALCIUM_double"/>
+      <outport name="c" type="double"/>
+      <outstream name="ba" type="CALCIUM_double"/>
+   </service>
+   <stream>
+      <fromnode>node1</fromnode> <fromport>ba</fromport>
+      <tonode>node2</tonode> <toport>aa</toport>
+   </stream>
+   <stream>
+      <fromnode>node2</fromnode> <fromport>ba</fromport>
+      <tonode>node1</tonode> <toport>aa</toport>
+   </stream>
+   <parameter>
+      <tonode>node1</tonode><toport>a</toport>
+      <value><double>23</double></value>
+   </parameter>
+   <parameter>
+      <tonode>node1</tonode><toport>b</toport>
+      <value><double>53</double></value>
+   </parameter>
+   <parameter>
+      <tonode>node2</tonode><toport>a</toport>
+      <value><double>63</double></value>
+   </parameter>
+   <parameter>
+      <tonode>node2</tonode><toport>b</toport>
+      <value><double>73</double></value>
+   </parameter>
+   <presentation name="node1" x="1.75" y="33.25" width="158" height="117" expanded="1" expx="1.75" expy="33.25" expWidth="158" expHeight="117" shownState="0"/>
+   <presentation name="node2" x="195.75" y="33.25" width="158" height="117" expanded="1" expx="195.75" expy="33.25" expWidth="158" expHeight="117" shownState="0"/>
+   <presentation name="__ROOT__" x="0" y="0" width="357.75" height="154.25" expanded="1" expx="0" expy="0" expWidth="357.75" expHeight="154.25" shownState="0"/>
 </proc>
-
index 88544a1a30fa1b9122cb45e3ad3576c660b985cf..4600aefe357d62ff8efb80c77bf875625c3424e0 100644 (file)
@@ -1,5 +1,25 @@
+# Copyright (C) 2009-2012  EDF R&D
+#
+# 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
+#
 
-KERNEL_ROOT_DIR=/local/chris/SALOME2/RELEASES/Install/KERNEL_V5
+include ../makefile.inc
 
 prog:prog.cxx
        g++ -o prog prog.cxx -L./install/lib/salome -lcompo1Exelib
+clean:
+       rm -rf *.o prog install install.bak appli appli.bak cppcompos_SRC cppcompos_SRC.bak compo1_inst_1 traceExec_proc
index 38890cb377891e8619061255267c33908e2e846f..d167aa3bd1b67f23dcb48fe10aefc714aa39c31d 100644 (file)
@@ -1,23 +1,23 @@
 A C++ standalone component (executable form)
 =================================================
 
-To build this example, modify the components.py and Makefile files
+To build this example, modify the ../context.py file
 to take into account your configuration.
 
 1- your prerequisite file 
 2- your KERNEL_ROOT_DIR
 
-Then set the environment (including PYTHONPATH for YACGEN, ../.. from here and execute components.py ::
+Then set the environment (including PYTHONPATH for YACSGEN, ../.. from here and execute components.py ::
 
   source <your prerequisite file>
   python components.py
 
 You should get a SALOME module in source form (cppcompos_SRC), its installation (install) and
-a SALOME application (appli) composed of modules KERNEL, GUI, YACS and cppcompos.
+a SALOME application (appli) composed of modules KERNEL, GUI, YACS and the new module cppcompos.
 
-To build the standalone component, run::
+To build the standalone component (executable named prog), execute the Makefile in the SALOME application environment::
 
-  make
+  ./appli/runSession make
 
 To run a coupling:
 
index b0085760e1b57aed2eee1be4624cc079d5018093..24828f30b68b38d8fcbd302961456ad5fb9abcab 100644 (file)
@@ -1,10 +1,27 @@
+# Copyright (C) 2009-2012  EDF R&D
+#
+# 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
+#
+
 import os
-from module_generator import Generator,Module,Service,CPPComponent
 
-context={'update':1,
-         "prerequisites":"/local/cchris/.packages.d/envSalome50",
-         "kernel":"/local/chris/SALOME2/RELEASES/Install/KERNEL_V5",
-        }
+#import context from ..
+execfile("../context.py")
+from module_generator import Generator,Module,Service,CPPComponent
 
 cwd=os.getcwd()
 
@@ -43,5 +60,4 @@ g.bootstrap()
 g.configure()
 g.make()
 g.install()
-g.make_appli("appli",restrict=["KERNEL","GUI","YACS"])
-
+g.make_appli("appli", restrict=["KERNEL"], altmodules={"GUI":GUI_ROOT_DIR, "YACS":YACS_ROOT_DIR})
index 363c6974521a0069fa3979e8ddabd3b2cb5be423..6b6fe9f598d033538a93ebcc85c737a0f57a9ce3 100644 (file)
@@ -1,3 +1,21 @@
+// Copyright (C) 2009-2012  EDF R&D
+//
+// 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
+//
 
 extern "C" void yacsinit();
 
diff --git a/Examples/cppgui1/Makefile b/Examples/cppgui1/Makefile
new file mode 100644 (file)
index 0000000..8c036b0
--- /dev/null
@@ -0,0 +1,21 @@
+# Copyright (C) 2009-2012  EDF R&D
+#
+# 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
+#
+
+clean:
+       rm -rf *.o *.so cppcompos_SRC cppcompos_SRC.bak appli appli.bak install install.bak traceExec_proc
diff --git a/Examples/cppgui1/components.py b/Examples/cppgui1/components.py
new file mode 100644 (file)
index 0000000..f31ff14
--- /dev/null
@@ -0,0 +1,127 @@
+# Copyright (C) 2009-2012  EDF R&D
+#
+# 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
+#
+
+#import context from ..
+execfile("../context.py")
+
+import os
+from module_generator import *
+
+idldefs="""
+#include "myinterface.idl"
+"""
+
+compodefs=r"""
+
+
+class A: public virtual POA_Idl_A
+{
+public:
+  void createObject(::SALOMEDS::Study_ptr theStudy, const char* name){};
+
+  // Driver interface
+  virtual SALOMEDS::TMPFile* Save(SALOMEDS::SComponent_ptr theComponent, const char* theURL, bool isMultiFile){return 0;};
+  virtual SALOMEDS::TMPFile* SaveASCII(SALOMEDS::SComponent_ptr theComponent, const char* theURL, bool isMultiFile){return 0;};
+  virtual bool Load(SALOMEDS::SComponent_ptr theComponent, const SALOMEDS::TMPFile& theStream, const char* theURL, bool isMultiFile){return 0;};
+  virtual bool LoadASCII(SALOMEDS::SComponent_ptr theComponent, const SALOMEDS::TMPFile& theStream, const char* theURL, bool isMultiFile){return 0;};
+  virtual void Close(SALOMEDS::SComponent_ptr IORSComponent){};
+  virtual char* ComponentDataType(){return "cppcompos";};
+  virtual char* IORToLocalPersistentID(SALOMEDS::SObject_ptr theSObject, const char* IORString, CORBA::Boolean isMultiFile, CORBA::Boolean isASCII){return 0;};
+  virtual char* LocalPersistentIDToIOR(SALOMEDS::SObject_ptr theSObject, const char* aLocalPersistentID, CORBA::Boolean isMultiFile,
+                                       CORBA::Boolean isASCII){return 0;};
+  virtual bool  CanPublishInStudy(CORBA::Object_ptr theIOR){return 0;};
+  virtual SALOMEDS::SObject_ptr PublishInStudy(SALOMEDS::Study_ptr theStudy,SALOMEDS::SObject_ptr theSObject,CORBA::Object_ptr theObject,
+                                               const char* theName){return 0;};
+  virtual CORBA::Boolean CanCopy(SALOMEDS::SObject_ptr theObject){return 0;};
+  virtual SALOMEDS::TMPFile* CopyFrom(SALOMEDS::SObject_ptr theObject, CORBA::Long& theObjectID){return 0;};
+  virtual CORBA::Boolean CanPaste(const char* theComponentName, CORBA::Long theObjectID){return 0;};
+  virtual SALOMEDS::SObject_ptr PasteInto(const SALOMEDS::TMPFile& theStream, CORBA::Long theObjectID, SALOMEDS::SObject_ptr theObject){return 0;};
+};
+
+"""
+
+compomethods=r"""
+
+  Engines::TMPFile* DumpPython(CORBA::Object_ptr theStudy,
+                               CORBA::Boolean isPublished,
+                               CORBA::Boolean isMultiFile,
+                               CORBA::Boolean& isValidScript)
+  {
+    std::cerr << "je suis dans le dump:" << __LINE__ << std::endl;
+    SALOMEDS::Study_var aStudy = SALOMEDS::Study::_narrow(theStudy);
+    if(CORBA::is_nil(aStudy))
+      return new Engines::TMPFile(0);
+
+    SALOMEDS::SObject_var aSO = aStudy->FindComponent("cppcompos");
+    if(CORBA::is_nil(aSO))
+       return new Engines::TMPFile(0);
+
+    std::string Script = "import cppcompos_ORB\n";
+    Script += "import salome\n";
+    Script += "compo = salome.lcc.FindOrLoadComponent('FactoryServer','cppcompos')\n";
+    Script += "def RebuildData(theStudy):\n";
+    Script += "  compo.SetCurrentStudy(theStudy)\n";
+    const char* aScript=Script.c_str();
+
+    char* aBuffer = new char[strlen(aScript)+1];
+    strcpy(aBuffer, aScript);
+    CORBA::Octet* anOctetBuf =  (CORBA::Octet*)aBuffer;
+    int aBufferSize = strlen(aBuffer)+1;
+    Engines::TMPFile_var aStreamFile = new Engines::TMPFile(aBufferSize, aBufferSize, anOctetBuf, 1);
+    isValidScript = true;
+    return aStreamFile._retn();
+  }
+
+
+"""
+
+body="""
+std::cerr << "a: " << a << std::endl;
+std::cerr << "b: " << b << std::endl;
+c=a+b;
+std::cerr << "c: " << c << std::endl;
+"""
+c1=CPPComponent("cppcompos",services=[
+          Service("s1",inport=[("a","double"),("b","double")],
+                       outport=[("c","double")],
+                       defs="//def1",body=body,
+                 ),
+          ],
+         includes="-I/usr/include",
+         idls=["*.idl"],
+         interfacedefs=idldefs,
+         inheritedinterface="Idl_A",
+         compodefs=compodefs,
+         inheritedclass="A",
+         addedmethods=compomethods,
+         )
+
+modul=Module("cppcompos",components=[c1],prefix="./install",
+             doc=["*.rst",],
+             gui=["cppcomposGUI.cxx","cppcomposGUI.h","demo.ui","*.png"],
+            )
+
+g=Generator(modul,context)
+g.generate()
+g.bootstrap()
+g.configure()
+g.make()
+g.install()
+g.make_appli("appli", restrict=["KERNEL"], altmodules={"GUI":GUI_ROOT_DIR, "YACS":YACS_ROOT_DIR})
+
diff --git a/Examples/cppgui1/cppcompos.png b/Examples/cppgui1/cppcompos.png
new file mode 100644 (file)
index 0000000..16a20c1
Binary files /dev/null and b/Examples/cppgui1/cppcompos.png differ
diff --git a/Examples/cppgui1/cppcomposGUI.cxx b/Examples/cppgui1/cppcomposGUI.cxx
new file mode 100644 (file)
index 0000000..1d20a61
--- /dev/null
@@ -0,0 +1,163 @@
+// Copyright (C) 2009-2012  EDF R&D
+//
+// 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
+//
+
+#include "cppcomposGUI.h"
+#include <SUIT_MessageBox.h>
+#include <SUIT_ResourceMgr.h>
+#include <SUIT_Desktop.h>
+#include <SUIT_Study.h>
+#include <SalomeApp_Application.h>
+#include <SALOME_LifeCycleCORBA.hxx>
+
+#include <SALOMEconfig.h>
+#include CORBA_CLIENT_HEADER(cppcompos)
+#include CORBA_CLIENT_HEADER(SALOMEDS)
+#include CORBA_CLIENT_HEADER(SALOMEDS_Attributes)
+
+// QT Includes
+#include <QInputDialog>
+#include <QIcon>
+
+// Export the module
+extern "C" {
+  CAM_Module* createModule()
+  {
+    return new cppcomposGUI();
+  }
+}
+
+// Constructor
+cppcomposGUI::cppcomposGUI() :
+  SalomeApp_Module( "cppcompos" ), // default name
+  LightApp_Module( "cppcompos" )
+{
+}
+
+static cppcompos_ORB::cppcompos_var engine;
+
+// Module's initialization
+void cppcomposGUI::initialize( CAM_Application* app )
+{
+
+  SalomeApp_Module::initialize( app );
+
+  Engines::EngineComponent_var comp = dynamic_cast<SalomeApp_Application*>(app)->lcc()->FindOrLoad_Component( "FactoryServer","cppcompos" );
+  engine = cppcompos_ORB::cppcompos::_narrow(comp);
+
+  QWidget* aParent = application()->desktop();
+  SUIT_ResourceMgr* aResourceMgr = app->resourceMgr();
+
+  // create actions
+  QPixmap aPixmap = aResourceMgr->loadPixmap( "cppcompos","exec.png" );
+  createAction( 901, "Banner", QIcon( aPixmap ), "Banner", "Banner", 0, aParent, false, this, SLOT( OnGetBanner() ) );
+  createAction( 902, "Designer", QIcon( aPixmap ), "Designer", "Designer", 0, aParent, false, this, SLOT( OnDesigner() ) );
+
+  // create menus
+  int aMenuId;
+  aMenuId = createMenu( "cppcompos", -1, -1, 30 );
+  createMenu( 901, aMenuId, 10 );
+
+  // create toolbars
+  int aToolId = createTool ( "cppcompos" );
+  createTool( 901, aToolId );
+  createTool( 902, aToolId );
+}
+
+// Get compatible dockable windows.
+void cppcomposGUI::windows( QMap<int, int>& theMap ) const
+{
+  theMap.clear();
+  theMap.insert( SalomeApp_Application::WT_ObjectBrowser, Qt::LeftDockWidgetArea );
+  theMap.insert( SalomeApp_Application::WT_PyConsole,     Qt::BottomDockWidgetArea );
+}
+
+// Module's engine IOR
+QString cppcomposGUI::engineIOR() const
+{
+  return "bidon";
+}
+
+// Module's activation
+bool cppcomposGUI::activateModule( SUIT_Study* theStudy )
+{
+  bool bOk = SalomeApp_Module::activateModule( theStudy );
+
+  setMenuShown( true );
+  setToolShown( true );
+
+  SALOME_NamingService *aNamingService = SalomeApp_Application::namingService();
+  CORBA::Object_var aSMObject = aNamingService->Resolve("/myStudyManager");
+  SALOMEDS::StudyManager_var aStudyManager = SALOMEDS::StudyManager::_narrow(aSMObject);
+  SALOMEDS::Study_var aDSStudy = aStudyManager->GetStudyByID(theStudy->id());
+
+  SALOMEDS::SComponent_var aFather = aDSStudy->FindComponent("cppcompos");
+  if (aFather->_is_nil())
+    {
+      SALOMEDS::StudyBuilder_var aStudyBuilder = aDSStudy->NewBuilder();
+      aFather = aStudyBuilder->NewComponent("cppcompos");
+      SALOMEDS::GenericAttribute_var anAttr = aStudyBuilder->FindOrCreateAttribute(aFather, "AttributeName");
+      SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(anAttr);
+      aName->SetValue("cppcompos");
+      aName->UnRegister();
+      aStudyBuilder->DefineComponentInstance(aFather, engine);
+    }
+  CORBA::Boolean valid;
+  engine->DumpPython(aDSStudy,1,0,valid);
+
+  return bOk;
+}
+
+// Module's deactivation
+bool cppcomposGUI::deactivateModule( SUIT_Study* theStudy )
+{
+  setMenuShown( false );
+  setToolShown( false );
+
+  return SalomeApp_Module::deactivateModule( theStudy );
+}
+
+// Action slot
+void cppcomposGUI::OnGetBanner()
+{
+  // Dialog to get the Name
+  bool ok = FALSE;
+  QString myName = QInputDialog::getText( getApp()->desktop(), "label", "name", QLineEdit::Normal, QString::null, &ok );
+
+  if ( ok && !myName.isEmpty()) 
+  {
+    ::CORBA::Double c;
+    engine->s1(1.,2.,c);
+    std::cerr << c << std::endl;
+    QString banner = "Hello " + myName;
+    SUIT_MessageBox::information( getApp()->desktop(), "info", banner, "OK" );
+  }
+}
+
+// Action slot
+void cppcomposGUI::OnDesigner()
+{
+  QWidget* wid= new MyDemo(getApp()->desktop());
+  wid->show();
+}
+
+MyDemo::MyDemo(QWidget *parent)
+        :QDialog(parent)
+{
+  ui.setupUi(this);
+}
diff --git a/Examples/cppgui1/cppcomposGUI.h b/Examples/cppgui1/cppcomposGUI.h
new file mode 100644 (file)
index 0000000..c096c91
--- /dev/null
@@ -0,0 +1,58 @@
+// Copyright (C) 2009-2012  EDF R&D
+//
+// 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
+//
+
+#ifndef _cppcomposGUI_H_
+#define _cppcomposGUI_H_
+
+#include <SalomeApp_Module.h>
+#include "ui_demo.h"
+
+class cppcomposGUI: public SalomeApp_Module
+{
+  Q_OBJECT
+
+public:
+  cppcomposGUI();
+  void    initialize( CAM_Application* );
+  QString engineIOR() const;
+  virtual void  windows( QMap<int, int>& theMap ) const;
+
+public slots:
+  bool    deactivateModule( SUIT_Study* );
+  bool    activateModule( SUIT_Study* );
+
+protected slots:
+  void            OnGetBanner();
+  void            OnDesigner();
+
+};
+
+class MyDemo: public QDialog
+{
+  Q_OBJECT
+
+public:
+  MyDemo(QWidget *parent = 0);
+
+private:
+  Ui::DemoDialog ui;
+
+};
+
+#endif
diff --git a/Examples/cppgui1/demo.ui b/Examples/cppgui1/demo.ui
new file mode 100644 (file)
index 0000000..69e4ac0
--- /dev/null
@@ -0,0 +1,146 @@
+<ui version="4.0" >
+ <author></author>
+ <comment></comment>
+ <exportmacro></exportmacro>
+ <class>DemoDialog</class>
+ <widget class="QDialog" name="DemoDialog" >
+  <property name="geometry" >
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>400</width>
+    <height>300</height>
+   </rect>
+  </property>
+  <property name="windowTitle" >
+   <string>PyUIC4 Demo Dialog</string>
+  </property>
+  <layout class="QGridLayout" >
+   <property name="margin" >
+    <number>9</number>
+   </property>
+   <property name="spacing" >
+    <number>6</number>
+   </property>
+   <item row="2" column="0" >
+    <spacer>
+     <property name="orientation" >
+      <enum>Qt::Vertical</enum>
+     </property>
+     <property name="sizeHint" >
+      <size>
+       <width>20</width>
+       <height>40</height>
+      </size>
+     </property>
+    </spacer>
+   </item>
+   <item row="0" column="0" >
+    <spacer>
+     <property name="orientation" >
+      <enum>Qt::Vertical</enum>
+     </property>
+     <property name="sizeHint" >
+      <size>
+       <width>20</width>
+       <height>40</height>
+      </size>
+     </property>
+    </spacer>
+   </item>
+   <item rowspan="3" row="0" column="1" >
+    <widget class="QListWidget" name="list" />
+   </item>
+   <item row="1" column="0" >
+    <layout class="QVBoxLayout" >
+     <property name="margin" >
+      <number>0</number>
+     </property>
+     <property name="spacing" >
+      <number>6</number>
+     </property>
+     <item>
+      <widget class="QPushButton" name="button1" >
+       <property name="text" >
+        <string>Add items</string>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QPushButton" name="button2" >
+       <property name="text" >
+        <string>Clear list</string>
+       </property>
+      </widget>
+     </item>
+    </layout>
+   </item>
+   <item row="3" column="0" colspan="2" >
+    <layout class="QHBoxLayout" >
+     <property name="margin" >
+      <number>0</number>
+     </property>
+     <property name="spacing" >
+      <number>6</number>
+     </property>
+     <item>
+      <spacer>
+       <property name="orientation" >
+        <enum>Qt::Horizontal</enum>
+       </property>
+       <property name="sizeHint" >
+        <size>
+         <width>131</width>
+         <height>31</height>
+        </size>
+       </property>
+      </spacer>
+     </item>
+     <item>
+      <widget class="QPushButton" name="okButton" >
+       <property name="text" >
+        <string>OK</string>
+       </property>
+      </widget>
+     </item>
+    </layout>
+   </item>
+  </layout>
+ </widget>
+ <pixmapfunction></pixmapfunction>
+ <resources/>
+ <connections>
+  <connection>
+   <sender>okButton</sender>
+   <signal>clicked()</signal>
+   <receiver>DemoDialog</receiver>
+   <slot>accept()</slot>
+   <hints>
+    <hint type="sourcelabel" >
+     <x>369</x>
+     <y>256</y>
+    </hint>
+    <hint type="destinationlabel" >
+     <x>96</x>
+     <y>254</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>button2</sender>
+   <signal>clicked()</signal>
+   <receiver>list</receiver>
+   <slot>clear()</slot>
+   <hints>
+    <hint type="sourcelabel" >
+     <x>92</x>
+     <y>112</y>
+    </hint>
+    <hint type="destinationlabel" >
+     <x>279</x>
+     <y>123</y>
+    </hint>
+   </hints>
+  </connection>
+ </connections>
+</ui>
diff --git a/Examples/cppgui1/exec.png b/Examples/cppgui1/exec.png
new file mode 100644 (file)
index 0000000..16a20c1
Binary files /dev/null and b/Examples/cppgui1/exec.png differ
diff --git a/Examples/cppgui1/index.rst b/Examples/cppgui1/index.rst
new file mode 100644 (file)
index 0000000..e5ebde0
--- /dev/null
@@ -0,0 +1,23 @@
+.. cppcompos documentation master file, created by
+   sphinx-quickstart on Sun Sep 19 16:20:14 2010.
+   You can adapt this file completely to your liking, but it should at least
+   contain the root `toctree` directive.
+
+Welcome to cppcompos's documentation!
+=======================================
+
+Contents:
+
+.. toctree::
+   :maxdepth: 2
+
+   using.rst
+
+
+Indices and tables
+==================
+
+* :ref:`genindex`
+* :ref:`modindex`
+* :ref:`search`
+
diff --git a/Examples/cppgui1/myinterface.idl b/Examples/cppgui1/myinterface.idl
new file mode 100644 (file)
index 0000000..e5f5a91
--- /dev/null
@@ -0,0 +1,27 @@
+// Copyright (C) 2009-2012  EDF R&D
+//
+// 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
+//
+
+#include "SALOMEDS.idl"
+#include "SALOME_Exception.idl"
+
+interface Idl_A : SALOMEDS::Driver
+{
+  void createObject(in SALOMEDS::Study theStudy, in string name) raises (SALOME::SALOME_Exception);
+};
+
diff --git a/Examples/cppgui1/using.rst b/Examples/cppgui1/using.rst
new file mode 100644 (file)
index 0000000..f28347d
--- /dev/null
@@ -0,0 +1,17 @@
+
+GUI components
+===================
+
+Object Browser
+--------------
+The Object Browser is a reusable GUI component.
+
+The Object Browser is only used to publish the run of the schema as a whole.
+
+
+.. centered:: **Object Browser tab**
+
+The Object Browser is in a tab, with tree_view
+
+Other
+----------
index 1e65c874034f32f6efc9271fe610cfca62718fd8..7831c46df4123882fa6e34b0bea375b1ea476514 100644 (file)
@@ -1,17 +1,33 @@
+# Copyright (C) 2009-2012  EDF R&D
+#
+# 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
+#
 
-FC=g77
-
-KERNEL_ROOT_DIR=/local/chris/SALOME2/RELEASES/Install/KERNEL_V5
+include ../makefile.inc
 
 all:libcode1.so libcode2.so
 libcode1.so:code1.o
-         $(FC) -shared -o libcode1.so code1.o
+         $(FC) -shared -fPIC -o libcode1.so code1.o
 code1.o:code1.f
-         $(FC) -c code1.f -I$(KERNEL_ROOT_DIR)/include/salome -fexceptions
+         $(FC) -c code1.f -fPIC -I$(KERNEL_ROOT_DIR)/include/salome -fexceptions
 libcode2.so:code2.o
-         $(FC) -shared -o libcode2.so code2.o
+         $(FC) -shared -fPIC -o libcode2.so code2.o
 code2.o:code2.f
-         $(FC) -c code2.f -I$(KERNEL_ROOT_DIR)/include/salome -fexceptions
+         $(FC) -c code2.f -fPIC -I$(KERNEL_ROOT_DIR)/include/salome -fexceptions
 
 clean:
-       rm -rf *.o *.so 
+       rm -rf *.o *.so fcompos_SRC  install fcompos_SRC.bak traceExec_proc appli appli.bak install.bak
index 1d24124d3570cf2ae751ad3972f004c5a25ecc7c..846cd4c3aef02765e284734975a296f3c904571d 100644 (file)
@@ -1,13 +1,14 @@
 A Fortran component dynamically loadable
 =============================================
 
-To build this example, modify the components.py and Makefile files
+To build this example, modify the ../context.py, ../makefile.inc and Makefile files
 to take into account your configuration.
 
 1- your prerequisite file 
 2- your KERNEL_ROOT_DIR
+3- your FORTRAN compiler
 
-Then set the environment (including PYTHONPATH for YACGEN, ../.. from here)::
+Then set the environment (including PYTHONPATH for YACSGEN, ../.. from here)::
 
   source <your prerequisite file>
 
@@ -20,7 +21,7 @@ and process components.py ::
   python components.py
 
 You should get a SALOME module in source form (fcompos_SRC), its installation (install) and
-a SALOME application (appli) composed of modules KERNEL, GUI, YACS and fcompos.
+a SALOME application (appli) composed of modules KERNEL, GUI, YACS and the new module fcompos.
 
 To run a coupling:
 
index 64011d9ab30c117c2fa4831ca5594eb16812637f..1cb9fc7a5b7ab49450bf7873d6fbc6c59d4f3586 100644 (file)
@@ -1,3 +1,22 @@
+C Copyright (C) 2009-2012  EDF R&D
+C
+C This library is free software; you can redistribute it and/or
+C modify it under the terms of the GNU Lesser General Public
+C License as published by the Free Software Foundation; either
+C version 2.1 of the License.
+C
+C This library is distributed in the hope that it will be useful,
+C but WITHOUT ANY WARRANTY; without even the implied warranty of
+C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+C Lesser General Public License for more details.
+C
+C You should have received a copy of the GNU Lesser General Public
+C License along with this library; if not, write to the Free Software
+C Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+C
+C See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+C
+
       subroutine bidul()
       write(6,*)"coucou"
       return
index 37a4fa11d4d764c0f609d38feed30214c98bb5fe..76fb5cb86500e0880b826c54e7c7082746324559 100644 (file)
@@ -1,3 +1,22 @@
+C Copyright (C) 2009-2012  EDF R&D
+C
+C This library is free software; you can redistribute it and/or
+C modify it under the terms of the GNU Lesser General Public
+C License as published by the Free Software Foundation; either
+C version 2.1 of the License.
+C
+C This library is distributed in the hope that it will be useful,
+C but WITHOUT ANY WARRANTY; without even the implied warranty of
+C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+C Lesser General Public License for more details.
+C
+C You should have received a copy of the GNU Lesser General Public
+C License along with this library; if not, write to the Free Software
+C Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+C
+C See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+C
+
        SUBROUTINE SERV1(compo,a,b,c)
        include 'calcium.hf'
        integer compo(2)
index d5ab3b1bc9a0fa90d00d68d1272a7332070cecc8..b34fd38e8b73cfa43d21f4a3ad410b094daef3c8 100644 (file)
@@ -1,3 +1,22 @@
+C Copyright (C) 2009-2012  EDF R&D
+C
+C This library is free software; you can redistribute it and/or
+C modify it under the terms of the GNU Lesser General Public
+C License as published by the Free Software Foundation; either
+C version 2.1 of the License.
+C
+C This library is distributed in the hope that it will be useful,
+C but WITHOUT ANY WARRANTY; without even the implied warranty of
+C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+C Lesser General Public License for more details.
+C
+C You should have received a copy of the GNU Lesser General Public
+C License along with this library; if not, write to the Free Software
+C Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+C
+C See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+C
+
        SUBROUTINE SERV1(compo,a,b,c)
        include 'calcium.hf'
        integer compo(2),nval
index 3c44fda040313a25d579741679897287f6aaddf3..77d49df9c2d0298a77ed037e3d55a1b282a471ef 100644 (file)
@@ -1,17 +1,37 @@
+# Copyright (C) 2009-2012  EDF R&D
+#
+# 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
+#
+
 import os
-from module_generator import Generator,Module,Service,F77Component
 
-context={'update':1,
-         "prerequisites":"/local/cchris/.packages.d/envSalome50",
-         "kernel":"/local/chris/SALOME2/RELEASES/Install/KERNEL_V5",
-        }
+#import context from ..
+execfile("../context.py")
+from module_generator import Generator,Module,Service,F77Component
 
 cwd=os.getcwd()
 
 c1=F77Component("fcode1", services=[Service("serv1",inport=[("a","double"),("b","double")],
                          outport=[("c","double")],
                          outstream=[("PARAM","CALCIUM_double","I")],), ],
-               libs="-L%s -lcode1" % cwd)
+                libs="-L%s -lcode1" % cwd,
+                rlibs="-Wl,--rpath -Wl,%s" % cwd,
+               )
+
 c2=F77Component("fcode2", services=[Service("serv1",inport=[("a","double"),("b","double")],
                          outport=[("c","double")],
                          instream=[("PARAM","CALCIUM_double","I")],), ],
@@ -23,5 +43,5 @@ g.bootstrap()
 g.configure()
 g.make()
 g.install()
-g.make_appli("appli",restrict=["KERNEL","GUI","YACS"])
+g.make_appli("appli", restrict=["KERNEL"], altmodules={"GUI":GUI_ROOT_DIR, "YACS":YACS_ROOT_DIR})
 
index c3d4ef8a0486ec5dbd0b9641f51a99eec5bbd3ac..8c0e5519690818213f85507dbc4e37aa3dac2b49 100644 (file)
@@ -1,59 +1,67 @@
-
-<proc>
-
-<!-- types -->
-
-
-<container name="A">
-</container>
-
-<container name="B">
-</container>
-
-<service name="node1" >
-  <component>fcode1</component>
-  <method>serv1</method>
-  <load container="A"/>
-  <inport name="a" type="double"/>
-  <inport name="b" type="double"/>
-  <outport name="c" type="double"/>
-  <outstream name="PARAM" type="CALCIUM_double"/>
-</service>
-
-<service name="node2" >
-  <component>fcode2</component>
-  <method>serv1</method>
-  <load container="B"/>
-  <inport name="a" type="double"/>
-  <inport name="b" type="double"/>
-  <outport name="c" type="double"/>
-  <instream name="PARAM" type="CALCIUM_double"/>
-</service>
-
-
-<!--datalinks -->
-<stream>
-  <fromnode>node1</fromnode><fromport>PARAM</fromport>
-  <tonode>node2</tonode><toport>PARAM</toport>
-</stream>
-
-<parameter>
-  <tonode>node1</tonode> <toport>a</toport>
-  <value><double>23</double> </value>
-</parameter>
-<parameter>
-  <tonode>node1</tonode> <toport>b</toport>
-  <value><double>53</double> </value>
-</parameter>
-<parameter>
-  <tonode>node2</tonode> <toport>a</toport>
-  <value><double>63</double> </value>
-</parameter>
-<parameter>
-  <tonode>node2</tonode> <toport>b</toport>
-  <value><double>73</double> </value>
-</parameter>
-
-
+<?xml version='1.0' encoding='iso-8859-1' ?>
+<proc name="proc">
+   <property name="DefaultStudyID" value="1"/>
+   <objref name="CALCIUM_double" id="IDL:Ports/Calcium_Ports/Calcium_Double_Port:1.0"/>
+   <type name="string" kind="string"/>
+   <struct name="Engines/dataref">
+      <member name="ref" type="string"/>
+   </struct>
+   <type name="bool" kind="bool"/>
+   <sequence name="boolvec" content="bool"/>
+   <type name="double" kind="double"/>
+   <sequence name="dblevec" content="double"/>
+   <objref name="file" id="file"/>
+   <type name="int" kind="int"/>
+   <sequence name="intvec" content="int"/>
+   <objref name="pyobj" id="python:obj:1.0"/>
+   <sequence name="stringvec" content="string"/>
+   <container name="A">
+   </container>
+   <container name="B">
+   </container>
+   <container name="DefaultContainer">
+      <property name="container_name" value="FactoryServer"/>
+      <property name="name" value="localhost"/>
+   </container>
+   <service name="node1">
+      <component>fcode1</component>
+      <load container="A"/>
+      <method>serv1</method>
+      <inport name="a" type="double"/>
+      <inport name="b" type="double"/>
+      <outport name="c" type="double"/>
+      <outstream name="PARAM" type="CALCIUM_double"/>
+   </service>
+   <service name="node2">
+      <component>fcode2</component>
+      <load container="B"/>
+      <method>serv1</method>
+      <inport name="a" type="double"/>
+      <inport name="b" type="double"/>
+      <instream name="PARAM" type="CALCIUM_double"/>
+      <outport name="c" type="double"/>
+   </service>
+   <stream>
+      <fromnode>node1</fromnode> <fromport>PARAM</fromport>
+      <tonode>node2</tonode> <toport>PARAM</toport>
+   </stream>
+   <parameter>
+      <tonode>node1</tonode><toport>a</toport>
+      <value><double>23</double></value>
+   </parameter>
+   <parameter>
+      <tonode>node1</tonode><toport>b</toport>
+      <value><double>53</double></value>
+   </parameter>
+   <parameter>
+      <tonode>node2</tonode><toport>a</toport>
+      <value><double>63</double></value>
+   </parameter>
+   <parameter>
+      <tonode>node2</tonode><toport>b</toport>
+      <value><double>73</double></value>
+   </parameter>
+   <presentation name="node1" x="1.75" y="46.75" width="158" height="90" expanded="1" expx="1.75" expy="46.75" expWidth="158" expHeight="90" shownState="0"/>
+   <presentation name="node2" x="195.75" y="33.25" width="158" height="117" expanded="1" expx="195.75" expy="33.25" expWidth="158" expHeight="117" shownState="0"/>
+   <presentation name="__ROOT__" x="0" y="0" width="357.75" height="154.25" expanded="1" expx="0" expy="0" expWidth="357.75" expHeight="154.25" shownState="0"/>
 </proc>
-
index b5b693e6bbfa98526a542b7230e852e4d43aed1c..2d3286d5a6ab6c7c9a0c7413a0bb174ed99c7388 100644 (file)
@@ -1,18 +1,34 @@
+# Copyright (C) 2009-2012  EDF R&D
+#
+# 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
+#
 
-FC=g77
-
-KERNEL_ROOT_DIR=/local/chris/SALOME2/RELEASES/Install/KERNEL_V5
+include ../makefile.inc
 
 all:prog1 prog2
 prog1:code1.o
-         $(FC) -o prog1 code1.o -L./install/lib/salome -lfcode1Exelib
+         $(FC) -o prog1 code1.o -L./install/lib/salome -lfcode1Exelib -L$(KERNEL_ROOT_DIR)/lib/salome -lCalciumC
 code1.o:code1.f
          $(FC) -c code1.f -I$(KERNEL_ROOT_DIR)/include/salome -fexceptions 
 
 prog2:code2.o
-         $(FC) -o prog2 code2.o -L./install/lib/salome -lfcode2Exelib
+         $(FC) -o prog2 code2.o -L./install/lib/salome -lfcode2Exelib -L$(KERNEL_ROOT_DIR)/lib/salome -lCalciumC
 code2.o:code2.f
          $(FC) -c code2.f -I$(KERNEL_ROOT_DIR)/include/salome -fexceptions 
 
 clean:
-       rm -rf *.o prog1 prog2
+       rm -rf *.o prog1 prog2 fcode1_inst_1  fcode2_inst_1  fcompos_SRC  install traceExec_proc install.bak fcompos_SRC.bak appli appli.bak
index f2ae7120b8c3be3333ce28e8216e430274044ee9..ded462078635d1de823ca08ffa9a580b70359be0 100644 (file)
@@ -1,13 +1,14 @@
 A Fortran standalone component
 =================================
 
-To build this example, modify the components.py and Makefile files
+To build this example, modify the ../context.py, ../makefile.inc and Makefile files
 to take into account your configuration.
 
 1- your prerequisite file 
 2- your KERNEL_ROOT_DIR
+3- your FORTRAN compiler
 
-Then set the environment (including PYTHONPATH for YACGEN, ../.. from here)::
+Then set the environment (including PYTHONPATH for YACSGEN, ../.. from here)::
 
   source <your prerequisite file>
 
@@ -16,11 +17,11 @@ and process components.py ::
   python components.py
 
 You should get a SALOME module in source form (fcompos_SRC), its installation (install) and
-a SALOME application (appli) composed of modules KERNEL, GUI, YACS and fcompos.
+a SALOME application (appli) composed of modules KERNEL, GUI, YACS and the new module fcompos.
 
-Build the code1 et code2 executables ::
+Build the code1 et code2 executables under the SALOME application environment::
 
-  make
+  ./appli/runSession make
 
 To run a coupling:
 
index ac9543a4bd9026d7bcedd0906379a66d583d3b7f..f4c37ac03f65bfacaed9831a47a11aa09237dbf1 100644 (file)
@@ -1,3 +1,22 @@
+C Copyright (C) 2009-2012  EDF R&D
+C
+C This library is free software; you can redistribute it and/or
+C modify it under the terms of the GNU Lesser General Public
+C License as published by the Free Software Foundation; either
+C version 2.1 of the License.
+C
+C This library is distributed in the hope that it will be useful,
+C but WITHOUT ANY WARRANTY; without even the implied warranty of
+C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+C Lesser General Public License for more details.
+C
+C You should have received a copy of the GNU Lesser General Public
+C License along with this library; if not, write to the Free Software
+C Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+C
+C See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+C
+
        PROGRAM P
        CALL YACSINIT()
        END
index 1a5c65444df3b08abb45673bdc35ae5e264ebb92..00886d8ad4205cac78fa33b5270a14d5be1f9199 100644 (file)
@@ -1,3 +1,22 @@
+C Copyright (C) 2009-2012  EDF R&D
+C
+C This library is free software; you can redistribute it and/or
+C modify it under the terms of the GNU Lesser General Public
+C License as published by the Free Software Foundation; either
+C version 2.1 of the License.
+C
+C This library is distributed in the hope that it will be useful,
+C but WITHOUT ANY WARRANTY; without even the implied warranty of
+C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+C Lesser General Public License for more details.
+C
+C You should have received a copy of the GNU Lesser General Public
+C License along with this library; if not, write to the Free Software
+C Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+C
+C See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+C
+
        PROGRAM P
        CALL YACSINIT()
        END
index b92f78deb56e027c517b2376e13cf5b1bc68752f..aed1b22d9a7196d6b3b3d12278aa24e6c2afc8fc 100644 (file)
@@ -1,10 +1,27 @@
+# Copyright (C) 2009-2012  EDF R&D
+#
+# 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
+#
+
 import os
-from module_generator import Generator,Module,Service,F77Component
 
-context={'update':1,
-         "prerequisites":"/local/cchris/.packages.d/envSalome50",
-         "kernel":"/local/chris/SALOME2/RELEASES/Install/KERNEL_V5",
-        }
+#import context from ..
+execfile("../context.py")
+from module_generator import Generator,Module,Service,F77Component
 
 cwd=os.getcwd()
 
@@ -12,13 +29,13 @@ c1=F77Component("fcode1", services=[Service("serv1",inport=[("a","double"),("b",
                          outport=[("c","double")],
                          outstream=[("PARAM","CALCIUM_double","I")],), ],
                kind="exe",
-               exe_path=os.path.join(cwd,"prog1"),
+               exe_path=os.path.join(cwd,"prog1.sh"),
                )
 c2=F77Component("fcode2", services=[Service("serv1",inport=[("a","double"),("b","double")],
                          outport=[("c","double")],
                          instream=[("PARAM","CALCIUM_double","I")],), ],
                kind="exe",
-               exe_path=os.path.join(cwd,"prog2"),
+               exe_path=os.path.join(cwd,"prog2.sh"),
                )
 
 g=Generator(Module("fcompos",components=[c1,c2],prefix="./install"),context)
@@ -27,5 +44,5 @@ g.bootstrap()
 g.configure()
 g.make()
 g.install()
-g.make_appli("appli",restrict=["KERNEL","GUI","YACS"])
+g.make_appli("appli", restrict=["KERNEL"], altmodules={"GUI":GUI_ROOT_DIR, "YACS":YACS_ROOT_DIR})
 
diff --git a/Examples/fort2/prog1.sh b/Examples/fort2/prog1.sh
new file mode 100755 (executable)
index 0000000..4f1f3d0
--- /dev/null
@@ -0,0 +1,7 @@
+#!/bin/bash
+
+script_path=$(dirname $(readlink -f $0))
+$script_path/prog1
+
+echo "End of shell"
+
diff --git a/Examples/fort2/prog2.sh b/Examples/fort2/prog2.sh
new file mode 100755 (executable)
index 0000000..8299c97
--- /dev/null
@@ -0,0 +1,7 @@
+#!/bin/bash
+script_path=$(dirname $(readlink -f $0))
+$script_path/prog2
+
+echo "End of shell"
+
+
diff --git a/Examples/hxx1/Makefile b/Examples/hxx1/Makefile
new file mode 100644 (file)
index 0000000..82beac2
--- /dev/null
@@ -0,0 +1,21 @@
+# Copyright (C) 2009-2012  EDF R&D
+#
+# 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
+#
+
+clean:
+       rm -rf *.o *.so hxxcompos_SRC hxxcompos_SRC.bak appli appli.bak install install.bak traceExec_proc COMPONENTCPP_INSTALL COMPONENTCPP_SRC COMPONENTCPP_BUILD parse_result parse_type_result
diff --git a/Examples/hxx1/README b/Examples/hxx1/README
new file mode 100644 (file)
index 0000000..2c5154f
--- /dev/null
@@ -0,0 +1,23 @@
+to run this example, one has first to untar the cpp_component archive, compile it, 
+and install it in directory COMPONENTCPP_INSTALL
+
+ tar xvfz cpp_component.tgz
+ mkdir COMPONENTCPP_INSTALL COMPONENTCPP_BUILD
+ cd COMPONENTCPP_SRC
+ ./build_configure
+ cd ../COMPONENTCPP_BUILD
+ ../COMPONENTCPP_SRC/configure --prefix=...
+ make
+ make install
+
+
+Generate the components with :
+
+  python component.py
+
+
+Test them with 
+
+  appli/runAppli -u test_compohxx.py
+
+
diff --git a/Examples/hxx1/component.py b/Examples/hxx1/component.py
new file mode 100644 (file)
index 0000000..34602c3
--- /dev/null
@@ -0,0 +1,88 @@
+# Copyright (C) 2009-2012  EDF R&D
+#
+# 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
+#
+
+import os
+from module_generator import Generator,Module,Service
+from module_generator import CPPComponent,PYComponent,HXX2SALOMEComponent
+class Invalid(Exception):
+    pass
+
+kernel_root_dir=os.environ["KERNEL_ROOT_DIR"]
+gui_root_dir=os.environ["GUI_ROOT_DIR"]
+yacs_root_dir=os.environ["YACS_ROOT_DIR"]
+med_root_dir=os.environ["MED_ROOT_DIR"]
+geom_root_dir=os.environ["GEOM_ROOT_DIR"]
+prereq_file=os.path.join(kernel_root_dir,"..","env_products.sh")
+if not os.path.exists(prereq_file):
+    prereq_file=os.path.join(kernel_root_dir,"..","..","env_products.sh")
+if not os.path.exists(prereq_file):
+    raise Invalid("prerequisite file env_products.sh not found. please replace it manually in component.py")
+
+#import context from ..
+context={'update':1,
+         "makeflags":"",
+         "prerequisites":prereq_file,
+         "kernel":kernel_root_dir,
+         "gui":gui_root_dir,
+         "geom":geom_root_dir,
+         "med":med_root_dir,
+         "yacs":yacs_root_dir,
+        }
+
+cwd=os.getcwd()
+cpppath=os.path.join(cwd,"COMPONENTCPP_INSTALL")
+
+    
+# PUT HERE DEFINITIONS OF THE COMPONENTS AND THE SERVICES
+
+
+os.environ["CALCULCPP_ROOT_DIR"]=cpppath
+os.environ["MEDCALCCPP_ROOT_DIR"]=cpppath
+os.environ["TESTMEDCPP_ROOT_DIR"]=cpppath
+os.environ["ICOCOCPP_ROOT_DIR"]=cpppath
+os.environ["TESTMEMCPP_ROOT_DIR"]=cpppath
+c1=HXX2SALOMEComponent("CALCUL.hxx","libCALCULCXX.so" , cpppath )
+c2=HXX2SALOMEComponent("MEDCALC.hxx","libMEDCALCCXX.so" , cpppath )
+c3=HXX2SALOMEComponent("TESTMED.hxx","libTESTMEDCXX.so" , cpppath )
+c4=HXX2SALOMEComponent("ICOCO.hxx","libICOCOCXX.so" , cpppath )
+c5=HXX2SALOMEComponent("TESTMEM.hxx","libTESTMEMCXX.so" , cpppath )
+
+
+g=Generator(Module("hxxcompos",components=[c4,c1,c2,c3,c5],prefix="./install"),context)
+g.generate()
+g.bootstrap()
+g.configure()
+g.make()
+g.install()
+g.make_appli("appli",
+             restrict=["KERNEL","GUI","YACS"],
+             altmodules={"GUI":gui_root_dir,
+                         "MED":med_root_dir,
+                         "YACS":yacs_root_dir,
+                         "GEOM":geom_root_dir})
+cppenv=""" export CALCULCPP_ROOT_DIR=%(cpppath)s
+export MEDCALCCPP_ROOT_DIR=%(cpppath)s
+export TESTMEDCPP_ROOT_DIR=%(cpppath)s
+export ICOCOCPP_ROOT_DIR=%(cpppath)s
+export TESTMEMCPP_ROOT_DIR=%(cpppath)s"""  % {"cpppath" : cpppath}
+
+cppenvfile=open("appli/env.d/cppEnv.sh","w")
+cppenvfile.write(cppenv)
+cppenvfile.close()
+
diff --git a/Examples/hxx1/cpp_component.tgz b/Examples/hxx1/cpp_component.tgz
new file mode 100644 (file)
index 0000000..2298007
Binary files /dev/null and b/Examples/hxx1/cpp_component.tgz differ
diff --git a/Examples/hxx1/test_compohxx.py b/Examples/hxx1/test_compohxx.py
new file mode 100644 (file)
index 0000000..5403e6e
--- /dev/null
@@ -0,0 +1,129 @@
+#==============================================================================
+#  File      : CALCUL_test.py
+#  Created   :
+#  Author    :
+#  Project   : SALOME
+#  Copyright : CEA 2005
+#==============================================================================
+#
+# Test du composant CALCUL
+#
+import SALOME
+import salome
+salome.salome_init()
+print "Test du composant CALCUL genere par hxx2salome"
+import hxxcompos_ORB
+myCalc = salome.lcc.FindOrLoadComponent("FactoryServer", "CALCUL")
+print "10+15 = ",myCalc.add(10,15)
+print "10x15 = ",myCalc.mul(10,15)
+#print "6!    = ",myCalc.fact(6)
+res1,res2 = myCalc.sqr2(12.0)
+print "12*12 = ",res1," ",res2
+j=1
+i1,i2,i3 = myCalc.return_3_int(j)
+assert (i1 == j+1),'Erreur dans la fonction return_3_int'
+assert (i2 == j+2),'Erreur dans la fonction return_3_int'
+assert (i3 == j+3),'Erreur dans la fonction return_3_int'
+print 'return_3_int : ',j,' ',i1,' ',i2,' ',i3
+print "True && True  = ",myCalc.And(True,True)
+print "True && False = ",myCalc.And(True,False)
+print "True || False = ",myCalc.Or(True,False)
+from math import fabs
+assert (fabs(res1-144.0)<1.0e-6 ), 'Erreur dans la fonction myCalc.sqr2 : 12*12 = '+str(res1)
+assert ( myCalc.And(True,True)==True ) , 'Erreur dans la fonction And(True,True)'
+assert ( myCalc.And(True,False)==False ) , 'Erreur dans la fonction And(True,False)'
+assert ( myCalc.Or(True,False)==True ) , 'Erreur dans la fonction Or(True,False)'
+print "Fin test hxx2salome/001/A1"
+#
+#
+myTestMed = salome.lcc.FindOrLoadComponent("FactoryServerTM", "TESTMED")
+myMedCalc = salome.lcc.FindOrLoadComponent("FactoryServerMC", "MEDCALC")
+#
+banner = myTestMed.getBanner()
+print "Banner = ",banner
+assert  banner == "Hello" , 'erreur dans la fonction getBanner() : mauvaise valeur'
+#
+print "Creation et tests des supports :"
+supportName=myTestMed.getSupportName(myTestMed.getSupport())
+print "Support name : ",supportName
+assert supportName == "SupportOnAll_MED_MAILLE"
+#
+from libMEDClient import FIELDDOUBLEClient
+f_loc=FIELDDOUBLEClient(myTestMed.getVolume(myTestMed.getSupport()))
+assert f_loc.getNumberOfValues() == 16 , 'created field has incorrect size'
+from math import fabs
+assert fabs(f_loc.norm2()-6.39444)<1.0e-5  , 'created field has incorrect norm 2'
+##
+# CNC bug Medclient  myTestMed.affiche_fieldT(myTestMed.getVolume(myTestMed.getSupport()))
+myTestMed.printSupportEntity(myTestMed.getSupport())
+myMedCalc.printSupport(myTestMed.getSupport())
+myMedCalc.printSupport(myTestMed.getPartialSupport())
+f_part=FIELDDOUBLEClient(myTestMed.getVolume(myTestMed.getPartialSupport()))
+assert f_part.getNumberOfValues() == 3, 'created field on partial support has incorrect size'
+assert fabs(f_part.norm2()-1.15470)<1.0e-5  , 'created field on partial support has incorrect norm 2'
+print "Fin test hxx2salome/003/A1"
+#
+banner = myTestMed.getBanner()
+print "Banner = ",banner
+assert  banner == "Hello" , 'erreur dans la fonction getBanner() : mauvaise valeur'
+#
+theMesh= myTestMed.getMesh()
+theField = myTestMed.getField()
+(theField1,theField2) = myTestMed.create2DoubleField()
+#CNC  bug Medclient  myTestMed.affiche_fieldT(theField1)
+mynorm=myTestMed.getNormMax(theField)
+from math import fabs
+assert fabs(mynorm-3.0)<1.0e-10  , 'created field has incorrect norm 1'
+print "Norm of the Field : " , mynorm
+
+field1 = myTestMed.getConstFieldDouble( 3.0 , "field1" )
+# CNC bug Medclient myTestMed.affiche_fieldT(field1)
+print "Creation tableau :"
+size=12
+myTab = myTestMed.createDoubleTab(size)
+myTabInt = myTestMed.createIntVector(size)
+myTestMed.printDoubleTab(myTab)
+print "Create a matrix"
+myTestMed.printMatrix(myTestMed.createMatrix(size,size))
+print "Fin test hxx2salome/002/A1"
+
+#
+# test of exception mechanism
+from SALOME_MED import SUPPORT, MED_NODE, FIELDDOUBLE
+test_exception=False
+f_cell = myTestMed.getField()
+f_node = myTestMed.getFieldOnNode()
+try:
+        f_wrong=myMedCalc.add(f_cell,f_node)
+except SALOME.SALOME_Exception, ex:
+        test_exception=True
+       print "wrong addition was correctly catched"
+       print "Exception is : ",ex
+
+assert test_exception, 'Error in the exception management  : the wrong MED addition was not correctly catched'
+print "Fin test hxx2salome/003/A2"
+
+myCoco = salome.lcc.FindOrLoadComponent("FactoryServerI", "ICOCO")
+#
+liste_champs = myCoco.getInputFieldsNames()
+nb_champs=len(liste_champs)
+print "Nombre de champs = ",nb_champs
+assert  nb_champs == 2 , 'erreur dans le nombre de champs, different de 2!'
+#
+print "Champ 1 (SourceField) : ",liste_champs[0]
+print "Champ 2 (TargetField) : ",liste_champs[1]
+assert liste_champs[0] == "SourceField", 'erreur dans le nom du champ 1'
+assert liste_champs[1] == "TargetField", 'erreur dans le nom du champ 2'
+#
+print "Fin test hxx2salome/ICOCO/A1"
+myCoco1 = salome.lcc.FindOrLoadComponent("FactoryServerI1", "ICOCO")
+myCoco2 = salome.lcc.FindOrLoadComponent("FactoryServerI2", "ICOCO")
+#
+myCoco1.initialize()
+m=myCoco1.getInputFieldTemplate("TargetField")
+myCoco1.solve()  #to test with 5.1.5
+f=myCoco1.getOutputField("SourceField")
+myCoco2.printField(f)
+#
+print "##################################"
+print "Fin test hxx2salome/ICOCO/A2"
diff --git a/Examples/makefile.inc b/Examples/makefile.inc
new file mode 100644 (file)
index 0000000..1732347
--- /dev/null
@@ -0,0 +1,26 @@
+# Copyright (C) 2009-2012  EDF R&D
+#
+# 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
+#
+
+KERNEL_ROOT_DIR=$(HOME)/Salome/Install/KERNEL_V6
+MED2HOME=/temp
+
+ASTER_ROOT=$(HOME)/Aster/V10.3/aster
+ASTER_VERSION=STA10.3
+
+FC=gfortran
diff --git a/Examples/paco1/Makefile b/Examples/paco1/Makefile
new file mode 100644 (file)
index 0000000..f289145
--- /dev/null
@@ -0,0 +1,21 @@
+# Copyright (C) 2009-2012  EDF R&D
+#
+# 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
+#
+
+clean:
+       rm -rf *.o *.so *.pyc pacocompos_SRC pacocompos_SRC.bak appli appli.bak install install.bak traceExec_proc
diff --git a/Examples/paco1/README.txt b/Examples/paco1/README.txt
new file mode 100644 (file)
index 0000000..9fbbca0
--- /dev/null
@@ -0,0 +1,26 @@
+A C++ component dynamically loadable
+=========================================
+
+To build this example, modify the components.py file
+to take into account your configuration.
+
+1- your prerequisite file 
+2- your KERNEL_ROOT_DIR
+3- your PaCO++ installed
+
+Then set the environment (including PYTHONPATH for YACGEN, ../.. from here and execute components.py ::
+
+  source <your prerequisite file>
+  python components.py
+
+You should get a SALOME module in source form (cppcompos_SRC), its installation (install) and
+a SALOME application (appli) composed of modules KERNEL, GUI, YACS and cppcompos.
+
+To run a coupling:
+
+ 1. start SALOME in background : ./appli/runAppli -t
+ 2. start a SALOME session : ./appli/runSession
+ 3. start YACS coupler with coupling file : driver coupling.xml
+ 4. examine output files in /tmp
+ 5. shutdown SALOME : shutdowSalome.py
+ 6. exit session : CTRL-D (or exit)
diff --git a/Examples/paco1/components.py b/Examples/paco1/components.py
new file mode 100644 (file)
index 0000000..7b98056
--- /dev/null
@@ -0,0 +1,51 @@
+# Copyright (C) 2009-2012  EDF R&D
+#
+# 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
+#
+
+import os
+
+#import context from ..
+execfile("../pacocontext.py")
+from module_generator import Generator,Module,Service,PACOComponent
+
+cwd=os.getcwd()
+
+body="""
+c = a + b;
+"""
+
+c1=PACOComponent("paco1",
+                 "dummy",
+                 services=[
+                   Service("run",inport=[("a","double"),("b","double")],
+                           outport=[("c","double")],
+                           body=body,
+                           impl_type="parallel"
+                          ),
+                ],
+               )
+
+
+g=Generator(Module("pacocompos",components=[c1],prefix="./install"),context)
+g.generate()
+g.bootstrap()
+g.configure()
+g.make()
+g.install()
+g.make_appli("appli", restrict=["KERNEL"], altmodules={"GUI":GUI_ROOT_DIR, "YACS":YACS_ROOT_DIR})
+
diff --git a/Examples/paco1/coupling.xml b/Examples/paco1/coupling.xml
new file mode 100644 (file)
index 0000000..06b7840
--- /dev/null
@@ -0,0 +1,34 @@
+<?xml version='1.0'?>
+<proc>
+   <type name="bool" kind="bool"/>
+   <type name="double" kind="double"/>
+   <objref name="file" id="file"/>
+   <type name="int" kind="int"/>
+   <type name="string" kind="string"/>
+   <container name="DefaultContainer">
+      <property name="container_name" value="FactoryServer"/>
+      <property name="hostname" value="localhost"/>
+   </container>
+   <container name="DummyContainer">
+      <property name="nb_component_nodes" value="1"/>
+      <property name="parallelLib" value="Dummy"/>
+   </container>
+   <service name="run0">
+      <component>paco1</component>
+      <load container="DummyContainer"/>
+      <method>run</method>
+      <inport name="a" type="double"/>
+      <inport name="b" type="double"/>
+      <outport name="c" type="double"/>
+   </service>
+   <parameter>
+      <tonode>run0</tonode><toport>a</toport>
+      <value><double>5</double></value>
+   </parameter>
+   <parameter>
+      <tonode>run0</tonode><toport>b</toport>
+      <value><double>4</double></value>
+   </parameter>
+   <presentation name="run0" x="9" y="80.5" width="227.5" height="139"/>
+   <presentation name="__ROOT__" x="0" y="0" width="246" height="228.5"/>
+</proc>
diff --git a/Examples/paco2/Makefile b/Examples/paco2/Makefile
new file mode 100644 (file)
index 0000000..f289145
--- /dev/null
@@ -0,0 +1,21 @@
+# Copyright (C) 2009-2012  EDF R&D
+#
+# 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
+#
+
+clean:
+       rm -rf *.o *.so *.pyc pacocompos_SRC pacocompos_SRC.bak appli appli.bak install install.bak traceExec_proc
diff --git a/Examples/paco2/README.txt b/Examples/paco2/README.txt
new file mode 100644 (file)
index 0000000..efa5554
--- /dev/null
@@ -0,0 +1,25 @@
+A C++ component dynamically loadable
+=========================================
+
+To build this example, modify the components.py file
+to take into account your configuration.
+
+1- your prerequisite file 
+2- your KERNEL_ROOT_DIR
+
+Then set the environment (including PYTHONPATH for YACGEN, ../.. from here and execute components.py ::
+
+  source <your prerequisite file>
+  python components.py
+
+You should get a SALOME module in source form (cppcompos_SRC), its installation (install) and
+a SALOME application (appli) composed of modules KERNEL, GUI, YACS and cppcompos.
+
+To run a coupling:
+
+ 1. start SALOME in background : ./appli/runAppli -t
+ 2. start a SALOME session : ./appli/runSession
+ 3. start YACS coupler with coupling file : driver coupling.xml
+ 4. examine output files in /tmp
+ 5. shutdown SALOME : shutdowSalome.py
+ 6. exit session : CTRL-D (or exit)
diff --git a/Examples/paco2/components.py b/Examples/paco2/components.py
new file mode 100644 (file)
index 0000000..2fe920e
--- /dev/null
@@ -0,0 +1,51 @@
+# Copyright (C) 2009-2012  EDF R&D
+#
+# 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
+#
+
+import os
+
+#import context from ..
+execfile("../pacocontext.py")
+from module_generator import Generator,Module,Service,PACOComponent
+
+cwd=os.getcwd()
+
+body="""
+c = a + b;
+"""
+
+c1=PACOComponent("paco1",
+                 "mpi",
+                 services=[
+                   Service("run",inport=[("a","double"),("b","double")],
+                           outport=[("c","double")],
+                           body=body,
+                           impl_type="parallel"
+                          ),
+                ],
+               )
+
+
+g=Generator(Module("pacocompos",components=[c1],prefix="./install"),context)
+g.generate()
+g.bootstrap()
+g.configure()
+g.make()
+g.install()
+g.make_appli("appli", restrict=["KERNEL"], altmodules={"GUI":GUI_ROOT_DIR, "YACS":YACS_ROOT_DIR})
+
diff --git a/Examples/paco2/coupling.xml b/Examples/paco2/coupling.xml
new file mode 100644 (file)
index 0000000..704d919
--- /dev/null
@@ -0,0 +1,34 @@
+<?xml version='1.0'?>
+<proc>
+   <type name="bool" kind="bool"/>
+   <type name="double" kind="double"/>
+   <objref name="file" id="file"/>
+   <type name="int" kind="int"/>
+   <type name="string" kind="string"/>
+   <container name="DefaultContainer">
+      <property name="container_name" value="FactoryServer"/>
+      <property name="hostname" value="localhost"/>
+   </container>
+   <container name="MpiContainer">
+      <property name="nb_component_nodes" value="2"/>
+      <property name="parallelLib" value="Mpi"/>
+   </container>
+   <service name="run0">
+      <component>paco1</component>
+      <load container="MpiContainer"/>
+      <method>run</method>
+      <inport name="a" type="double"/>
+      <inport name="b" type="double"/>
+      <outport name="c" type="double"/>
+   </service>
+   <parameter>
+      <tonode>run0</tonode><toport>a</toport>
+      <value><double>5</double></value>
+   </parameter>
+   <parameter>
+      <tonode>run0</tonode><toport>b</toport>
+      <value><double>4</double></value>
+   </parameter>
+   <presentation name="run0" x="10" y="80.5" width="227.5" height="139"/>
+   <presentation name="__ROOT__" x="0" y="0" width="246" height="228.5"/>
+</proc>
diff --git a/Examples/paco3/Makefile b/Examples/paco3/Makefile
new file mode 100644 (file)
index 0000000..18fe4f9
--- /dev/null
@@ -0,0 +1,21 @@
+# Copyright (C) 2009-2012  EDF R&D
+#
+# 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
+#
+
+clean:
+       rm -rf *.o *.so *.pyc DSC_PARALLEL_PARAM_SRC DSC_PARALLEL_PARAM_SRC.bak appli appli.bak install install.bak traceExec_proc
diff --git a/Examples/paco3/README.txt b/Examples/paco3/README.txt
new file mode 100644 (file)
index 0000000..efa5554
--- /dev/null
@@ -0,0 +1,25 @@
+A C++ component dynamically loadable
+=========================================
+
+To build this example, modify the components.py file
+to take into account your configuration.
+
+1- your prerequisite file 
+2- your KERNEL_ROOT_DIR
+
+Then set the environment (including PYTHONPATH for YACGEN, ../.. from here and execute components.py ::
+
+  source <your prerequisite file>
+  python components.py
+
+You should get a SALOME module in source form (cppcompos_SRC), its installation (install) and
+a SALOME application (appli) composed of modules KERNEL, GUI, YACS and cppcompos.
+
+To run a coupling:
+
+ 1. start SALOME in background : ./appli/runAppli -t
+ 2. start a SALOME session : ./appli/runSession
+ 3. start YACS coupler with coupling file : driver coupling.xml
+ 4. examine output files in /tmp
+ 5. shutdown SALOME : shutdowSalome.py
+ 6. exit session : CTRL-D (or exit)
diff --git a/Examples/paco3/components.py b/Examples/paco3/components.py
new file mode 100644 (file)
index 0000000..de0b1fd
--- /dev/null
@@ -0,0 +1,96 @@
+# -*- coding: utf-8 *-
+# Copyright (C) 2009-2012  EDF R&D
+#
+# 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
+#
+
+import os
+
+#import context from ..
+execfile("../pacocontext.py")
+from module_generator import Generator,Module,Service,PACOComponent
+
+cwd=os.getcwd()
+
+master_body="""
+  // Init data
+  Ports::Param_Double_Port::seq_double data;
+  data.length(10);
+  for (double i=0; i< 10; i++) 
+    data[i] = i; 
+  _master_port_port->configure_port_method_put(10);
+  _master_port_port->put(data);
+
+  Ports::Param_Double_Port::seq_double * results;
+  _master_port_port->get_results(results);
+  std::cerr << "Master receive a sequence of length = " << results->length() << std::endl;
+  for (int i = 0; i < results->length(); i++)
+    std::cerr << "Master receive data : " << (*results)[i] << std::endl;
+  delete results;
+"""
+
+worker_body="""
+  // Réception des données
+  Ports::Param_Double_Port::seq_double * data = _worker_port_port->get_data();
+  std::cerr << "Node " << getMyRank() << " receive a sequence of length = " << data->length() << std::endl;
+  for (int i = 0; i < data->length(); i++)
+    std::cerr << "Node " << getMyRank() << " receive data : " << (*data)[i] << std::endl;
+  delete data;
+
+  // Envoi des données
+  data = new Ports::Param_Double_Port::seq_double();
+  data->length(5);
+  for (double i=0; i< 5; i++) 
+  {
+    (*data)[i] = i + i + (getMyRank() * 20);
+  }
+  _worker_port_port->configure_set_data(5, 5*getTotalNode(), 5*getMyRank());
+  _worker_port_port->set_data(data);
+  delete data;
+"""
+
+c1=PACOComponent("MASTER",
+                 "dummy",
+                 services=[
+                   Service("StartMaster",
+                           parallel_outstream=[("master_port", "Param_Double_Port")],
+                           body=master_body,
+                           impl_type="parallel"
+                          ),
+                ],
+               )
+
+c2=PACOComponent("WORKER",
+                 "mpi",
+                 services=[
+                   Service("StartWorker",
+                           parallel_instream=[("worker_port", "Param_Double_Port")],
+                           body=worker_body,
+                           impl_type="parallel"
+                          ),
+                ],
+               )
+
+
+g=Generator(Module("DSC_PARALLEL_PARAM",components=[c1, c2],prefix="./install"),context)
+g.generate()
+g.bootstrap()
+g.configure()
+g.make()
+g.install()
+g.make_appli("appli", restrict=["KERNEL"], altmodules={"GUI":GUI_ROOT_DIR, "YACS":YACS_ROOT_DIR})
+
diff --git a/Examples/paco3/coupling.xml b/Examples/paco3/coupling.xml
new file mode 100644 (file)
index 0000000..6c35b5b
--- /dev/null
@@ -0,0 +1,52 @@
+<?xml version='1.0'?>
+<proc>
+   <objref name="Param_Double_Port" id="IDL:Ports/Param_Double_Port:1.0"/>
+   <type name="bool" kind="bool"/>
+   <type name="double" kind="double"/>
+   <objref name="file" id="file"/>
+   <type name="int" kind="int"/>
+   <type name="string" kind="string"/>
+   <container name="DefaultContainer">
+      <property name="container_name" value="FactoryServer"/>
+      <property name="hostname" value="localhost"/>
+   </container>
+   <container name="MasterContainer">
+      <property name="hostname" value="localhost"/>
+      <property name="nb_component_nodes" value="1"/>
+      <property name="parallelLib" value="Dummy"/>
+   </container>
+   <container name="WorkerContainer">
+      <property name="hostname" value="localhost"/>
+      <property name="nb_component_nodes" value="2"/>
+      <property name="parallelLib" value="Mpi"/>
+   </container>
+   <forloop name="ForLoop0" nsteps="10">
+      <bloc name="Bloc1">
+         <service name="StartMaster2">
+            <component>MASTER</component>
+            <load container="MasterContainer"/>
+            <method>StartMaster</method>
+            <outstream name="master_port" type="Param_Double_Port"/>
+         </service>
+         <service name="StartWorker3">
+            <component>WORKER</component>
+            <load container="WorkerContainer"/>
+            <method>StartWorker</method>
+            <instream name="worker_port" type="Param_Double_Port"/>
+         </service>
+         <stream>
+            <fromnode>StartMaster2</fromnode> <fromport>master_port</fromport>
+            <tonode>StartWorker3</tonode> <toport>worker_port</toport>
+         </stream>
+      </bloc>
+   </forloop>
+   <parameter>
+      <tonode>ForLoop0</tonode><toport>nsteps</toport>
+      <value><int>10</int></value>
+   </parameter>
+   <presentation name="ForLoop0" x="9" y="80.5" width="495.5" height="319"/>
+   <presentation name="ForLoop0.Bloc1" x="9" y="109.5" width="477" height="200.5"/>
+   <presentation name="ForLoop0.Bloc1.StartMaster2" x="9" y="81.5" width="227.5" height="110"/>
+   <presentation name="ForLoop0.Bloc1.StartWorker3" x="245.5" y="80.5" width="222" height="110"/>
+   <presentation name="__ROOT__" x="0" y="0" width="514" height="408.5"/>
+</proc>
diff --git a/Examples/pacocontext.py b/Examples/pacocontext.py
new file mode 100644 (file)
index 0000000..5c3ad4e
--- /dev/null
@@ -0,0 +1,40 @@
+# Copyright (C) 2009-2012  EDF R&D
+#
+# 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
+#
+
+import os
+
+KERNEL_ROOT_DIR=os.getenv("KERNEL_ROOT_DIR","/local/cchris/Salome/Install/KERNEL_V5")
+GUI_ROOT_DIR=os.getenv("GUI_ROOT_DIR","/local/cchris/Salome/Install/GUI_V5")
+YACS_ROOT_DIR=os.getenv("YACS_ROOT_DIR","/local/cchris/Salome/Install/YACS_V5_1_main")
+
+context={'update':1,
+         "makeflags":"",
+         "prerequisites":"/local/cchris/.packages.d/envSalome5",
+         "kernel":KERNEL_ROOT_DIR,
+         "paco":"/local/cchris/pkg/paco/install",
+         "mpi":"/usr/lib/openmpi",
+        }
+
+
+aster_home="/local/cchris/Aster/V10.1/aster"
+aster_version="STA10.1"
+#aster_home="/local/cchris/Aster/V10/Install"
+#aster_version="STA10.0"
+
+
diff --git a/Examples/pydoc1/Makefile b/Examples/pydoc1/Makefile
new file mode 100644 (file)
index 0000000..864b877
--- /dev/null
@@ -0,0 +1,21 @@
+# Copyright (C) 2009-2012  EDF R&D
+#
+# 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
+#
+
+clean:
+       rm -rf *.pyc pycompos_SRC pycompos_SRC.bak appli appli.bak install install.bak traceExec_proc
diff --git a/Examples/pydoc1/components.py b/Examples/pydoc1/components.py
new file mode 100644 (file)
index 0000000..72c35f2
--- /dev/null
@@ -0,0 +1,55 @@
+# Copyright (C) 2009-2012  EDF R&D
+#
+# 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
+#
+
+import os
+
+#import context from ..
+execfile("../context.py")
+
+from module_generator import *
+
+defs="""
+"""
+
+body="""
+      c=a+b
+      d=a-b
+"""
+
+c1=PYComponent("pycompos",services=[
+          Service("s1",inport=[("a","double"),("b","double")],
+                       outport=[("c","double"),("d","double")],
+                       defs=defs,body=body,
+                 ),
+         ],
+         )
+
+modul=Module("pycompos",components=[c1],prefix="./install",
+              doc=["*.rst","*.png",],
+            )
+
+g=Generator(modul,context)
+g.generate()
+g.bootstrap()
+g.configure()
+g.make()
+g.install()
+g.make_appli("appli", restrict=["KERNEL"], altmodules={"GUI":GUI_ROOT_DIR, "YACS":YACS_ROOT_DIR})
+
+
diff --git a/Examples/pydoc1/exec.png b/Examples/pydoc1/exec.png
new file mode 100644 (file)
index 0000000..16a20c1
Binary files /dev/null and b/Examples/pydoc1/exec.png differ
diff --git a/Examples/pydoc1/index.rst b/Examples/pydoc1/index.rst
new file mode 100644 (file)
index 0000000..ff84846
--- /dev/null
@@ -0,0 +1,23 @@
+.. pycompos documentation master file, created by
+   sphinx-quickstart on Sun Sep 19 16:20:14 2010.
+   You can adapt this file completely to your liking, but it should at least
+   contain the root `toctree` directive.
+
+Welcome to pycompos's documentation!
+=======================================
+
+Contents:
+
+.. toctree::
+   :maxdepth: 2
+
+   using.rst
+
+
+Indices and tables
+==================
+
+* :ref:`genindex`
+* :ref:`modindex`
+* :ref:`search`
+
diff --git a/Examples/pydoc1/using.rst b/Examples/pydoc1/using.rst
new file mode 100644 (file)
index 0000000..8321bf3
--- /dev/null
@@ -0,0 +1,20 @@
+
+GUI components
+===================
+
+Object Browser
+--------------
+The Object Browser is a reusable GUI component.
+
+The Object Browser is only used to publish the run of the schema as a whole.
+
+
+.. centered:: **Object Browser tab**
+
+The Object Browser is in a tab, with tree_view
+
+Other
+----------
+.. image:: exec.png
+  :align: center
+
diff --git a/Examples/pygui1/Makefile b/Examples/pygui1/Makefile
new file mode 100644 (file)
index 0000000..864b877
--- /dev/null
@@ -0,0 +1,21 @@
+# Copyright (C) 2009-2012  EDF R&D
+#
+# 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
+#
+
+clean:
+       rm -rf *.pyc pycompos_SRC pycompos_SRC.bak appli appli.bak install install.bak traceExec_proc
diff --git a/Examples/pygui1/README.txt b/Examples/pygui1/README.txt
new file mode 100644 (file)
index 0000000..fb47288
--- /dev/null
@@ -0,0 +1,19 @@
+A Python component dynamically loadable
+===============================================
+
+To build this example, modify the ../context.py file
+to take into account your configuration.
+
+1- your prerequisite file 
+2- your KERNEL_ROOT_DIR
+
+Then set the environment (including PYTHONPATH for YACSGEN, ../.. from here and execute components.py ::
+
+  source <your prerequisite file>
+  python components.py
+
+You should get a SALOME module in source form (pycompos_SRC), its installation (install) and
+a SALOME application (appli) composed of modules KERNEL, GUI, YACS and the new module pycompos.
+
+Launch SALOME : ./appli/runAppli -k
+activate the pycompos module, look at the doc, activate commands, ...
diff --git a/Examples/pygui1/components.py b/Examples/pygui1/components.py
new file mode 100644 (file)
index 0000000..d19cea1
--- /dev/null
@@ -0,0 +1,118 @@
+# Copyright (C) 2009-2012  EDF R&D
+#
+# 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
+#
+
+import os
+
+#import context from ..
+execfile("../context.py")
+
+from module_generator import *
+
+defs="""
+"""
+
+body="""
+      c=a+b
+      d=a-b
+"""
+
+idldefs="""
+#include "myinterface.idl"
+"""
+
+compodefs=r"""
+import SALOME_DriverPy
+import traceback
+
+class A(SALOME_DriverPy.SALOME_DriverPy_i):
+    def __init__(self):
+      SALOME_DriverPy.SALOME_DriverPy_i.__init__(self,"pycompos")
+      return
+
+    def createObject( self, study, name ):
+      "Create object.  "
+      try:
+        print study,name
+        builder = study.NewBuilder()
+        father = study.FindComponent( "pycompos" )
+        if father is None:
+            father = builder.NewComponent( "pycompos" )
+            attr = builder.FindOrCreateAttribute( father, "AttributeName" )
+            attr.SetValue( "pycompos" )
+
+        object  = builder.NewObject( father )
+        attr    = builder.FindOrCreateAttribute( object, "AttributeName" )
+        attr.SetValue( name )
+      except:
+        traceback.print_exc()
+
+    def DumpPython( self, study, isPublished ):
+       abuffer = []
+       abuffer.append( "def RebuildData( theStudy ):" )
+       names = []
+       father = study.FindComponent( "pycompos" )
+       if father:
+           iter = study.NewChildIterator( father )
+           while iter.More():
+               name = iter.Value().GetName()
+               if name: names.append( name )
+               iter.Next()
+               pass
+           pass
+       if names:
+           abuffer += [ "  from salome import lcc" ]
+           abuffer += [ "  import pycompos_ORB" ]
+           abuffer += [ "  " ]
+           abuffer += [ "  compo = lcc.FindOrLoadComponent( 'FactoryServerPy', 'pycompos' )" ]
+           abuffer += [ "  " ]
+           abuffer += [ "  compo.createObject( theStudy, '%s' )" % name for name in names ]
+           pass
+       abuffer += [ "  " ]
+
+       return ("\n".join( abuffer ), 1)
+
+"""
+
+c1=PYComponent("pycompos",services=[
+          Service("s1",inport=[("a","double"),("b","double")],
+                       outport=[("c","double"),("d","double")],
+                       defs=defs,body=body,
+                 ),
+         ],
+              idls=["*.idl"],
+              interfacedefs=idldefs,
+              inheritedinterface="Idl_A",
+              compodefs=compodefs,
+              inheritedclass="A",
+         )
+
+modul=Module("pycompos",components=[c1],prefix="./install",
+              doc=["*.rst","*.png"],
+              gui=["pycomposGUI.py","demo.ui","*.png"],
+            )
+
+g=Generator(modul,context)
+g.generate()
+g.bootstrap()
+g.configure()
+g.make()
+g.install()
+g.make_appli("appli", restrict=["KERNEL"], altmodules={"GUI":GUI_ROOT_DIR, "YACS":YACS_ROOT_DIR})
+
+
diff --git a/Examples/pygui1/demo.ui b/Examples/pygui1/demo.ui
new file mode 100644 (file)
index 0000000..69e4ac0
--- /dev/null
@@ -0,0 +1,146 @@
+<ui version="4.0" >
+ <author></author>
+ <comment></comment>
+ <exportmacro></exportmacro>
+ <class>DemoDialog</class>
+ <widget class="QDialog" name="DemoDialog" >
+  <property name="geometry" >
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>400</width>
+    <height>300</height>
+   </rect>
+  </property>
+  <property name="windowTitle" >
+   <string>PyUIC4 Demo Dialog</string>
+  </property>
+  <layout class="QGridLayout" >
+   <property name="margin" >
+    <number>9</number>
+   </property>
+   <property name="spacing" >
+    <number>6</number>
+   </property>
+   <item row="2" column="0" >
+    <spacer>
+     <property name="orientation" >
+      <enum>Qt::Vertical</enum>
+     </property>
+     <property name="sizeHint" >
+      <size>
+       <width>20</width>
+       <height>40</height>
+      </size>
+     </property>
+    </spacer>
+   </item>
+   <item row="0" column="0" >
+    <spacer>
+     <property name="orientation" >
+      <enum>Qt::Vertical</enum>
+     </property>
+     <property name="sizeHint" >
+      <size>
+       <width>20</width>
+       <height>40</height>
+      </size>
+     </property>
+    </spacer>
+   </item>
+   <item rowspan="3" row="0" column="1" >
+    <widget class="QListWidget" name="list" />
+   </item>
+   <item row="1" column="0" >
+    <layout class="QVBoxLayout" >
+     <property name="margin" >
+      <number>0</number>
+     </property>
+     <property name="spacing" >
+      <number>6</number>
+     </property>
+     <item>
+      <widget class="QPushButton" name="button1" >
+       <property name="text" >
+        <string>Add items</string>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QPushButton" name="button2" >
+       <property name="text" >
+        <string>Clear list</string>
+       </property>
+      </widget>
+     </item>
+    </layout>
+   </item>
+   <item row="3" column="0" colspan="2" >
+    <layout class="QHBoxLayout" >
+     <property name="margin" >
+      <number>0</number>
+     </property>
+     <property name="spacing" >
+      <number>6</number>
+     </property>
+     <item>
+      <spacer>
+       <property name="orientation" >
+        <enum>Qt::Horizontal</enum>
+       </property>
+       <property name="sizeHint" >
+        <size>
+         <width>131</width>
+         <height>31</height>
+        </size>
+       </property>
+      </spacer>
+     </item>
+     <item>
+      <widget class="QPushButton" name="okButton" >
+       <property name="text" >
+        <string>OK</string>
+       </property>
+      </widget>
+     </item>
+    </layout>
+   </item>
+  </layout>
+ </widget>
+ <pixmapfunction></pixmapfunction>
+ <resources/>
+ <connections>
+  <connection>
+   <sender>okButton</sender>
+   <signal>clicked()</signal>
+   <receiver>DemoDialog</receiver>
+   <slot>accept()</slot>
+   <hints>
+    <hint type="sourcelabel" >
+     <x>369</x>
+     <y>256</y>
+    </hint>
+    <hint type="destinationlabel" >
+     <x>96</x>
+     <y>254</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>button2</sender>
+   <signal>clicked()</signal>
+   <receiver>list</receiver>
+   <slot>clear()</slot>
+   <hints>
+    <hint type="sourcelabel" >
+     <x>92</x>
+     <y>112</y>
+    </hint>
+    <hint type="destinationlabel" >
+     <x>279</x>
+     <y>123</y>
+    </hint>
+   </hints>
+  </connection>
+ </connections>
+</ui>
diff --git a/Examples/pygui1/exec.png b/Examples/pygui1/exec.png
new file mode 100644 (file)
index 0000000..16a20c1
Binary files /dev/null and b/Examples/pygui1/exec.png differ
diff --git a/Examples/pygui1/index.rst b/Examples/pygui1/index.rst
new file mode 100644 (file)
index 0000000..ff84846
--- /dev/null
@@ -0,0 +1,23 @@
+.. pycompos documentation master file, created by
+   sphinx-quickstart on Sun Sep 19 16:20:14 2010.
+   You can adapt this file completely to your liking, but it should at least
+   contain the root `toctree` directive.
+
+Welcome to pycompos's documentation!
+=======================================
+
+Contents:
+
+.. toctree::
+   :maxdepth: 2
+
+   using.rst
+
+
+Indices and tables
+==================
+
+* :ref:`genindex`
+* :ref:`modindex`
+* :ref:`search`
+
diff --git a/Examples/pygui1/myinterface.idl b/Examples/pygui1/myinterface.idl
new file mode 100644 (file)
index 0000000..e5f5a91
--- /dev/null
@@ -0,0 +1,27 @@
+// Copyright (C) 2009-2012  EDF R&D
+//
+// 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
+//
+
+#include "SALOMEDS.idl"
+#include "SALOME_Exception.idl"
+
+interface Idl_A : SALOMEDS::Driver
+{
+  void createObject(in SALOMEDS::Study theStudy, in string name) raises (SALOME::SALOME_Exception);
+};
+
diff --git a/Examples/pygui1/pycompos.png b/Examples/pygui1/pycompos.png
new file mode 100644 (file)
index 0000000..16a20c1
Binary files /dev/null and b/Examples/pygui1/pycompos.png differ
diff --git a/Examples/pygui1/pycomposGUI.py b/Examples/pygui1/pycomposGUI.py
new file mode 100644 (file)
index 0000000..d32817a
--- /dev/null
@@ -0,0 +1,144 @@
+# Copyright (C) 2009-2012  EDF R&D
+#
+# 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
+#
+
+import os
+
+from PyQt4.QtCore import *
+from PyQt4.QtGui import *
+from PyQt4.QtWebKit import *
+from PyQt4 import QtCore, QtGui, uic
+
+import salome
+import pycompos_ORB
+
+# Get SALOME PyQt interface
+import SalomePyQt
+sgPyQt = SalomePyQt.SalomePyQt()
+
+# Get SALOME Swig interface
+import libSALOME_Swig
+sg = libSALOME_Swig.SALOMEGUI_Swig()
+
+# object counter
+__objectid__ = 0
+
+###
+# get active study ID
+###
+def _getStudyId():
+    return sgPyQt.getStudyId()
+
+###
+# get active study
+###
+def _getStudy():
+    studyId = _getStudyId()
+    study = salome.myStudyManager.GetStudyByID( studyId )
+    return study
+
+# called when module is initialized
+# return map of popup windows to be used by the module
+def windows():
+  wm = {}
+  wm[SalomePyQt.WT_ObjectBrowser] = Qt.LeftDockWidgetArea
+  wm[SalomePyQt.WT_PyConsole]     = Qt.BottomDockWidgetArea
+  return wm
+
+# called when module is initialized
+# return list of 2d/3d views to be used ny the module
+def views():
+  return []
+
+# called when module is activated
+# returns True if activating is successfull and False otherwise
+def activate():
+  # create top-level menu
+  mid = sgPyQt.createMenu( "pycompos", -1, 90, sgPyQt.defaultMenuGroup() )
+  # create toolbar
+  tid = sgPyQt.createTool( "pycompos" )
+  # create actions and fill menu and toolbar with actions
+  a = sgPyQt.createAction( 941, "Hello", "Hello", "Show hello dialog box" ,"exec.png")
+  sgPyQt.createMenu( a, mid )
+  sgPyQt.createTool( a, tid )
+  a = sgPyQt.createAction( 942, "Hello2", "Hello2", "Show hello2 dialog box" ,"exec.png")
+  sgPyQt.createMenu( a, mid )
+  sgPyQt.createTool( a, tid )
+  a = sgPyQt.createAction( 943, "Create object", "Create object", "Create object","exec.png" )
+  sgPyQt.createMenu( a, mid )
+  sgPyQt.createTool( a, tid )
+
+  return True
+
+# called when module is deactivated
+def deactivate():
+  pass
+
+_engine=None
+def getEngine():
+  global _engine
+  if not _engine:
+    _engine= salome.lcc.FindOrLoadComponent( "FactoryServerPy", "pycompos" )
+  return _engine
+
+###
+# Create new object
+###
+def CreateObject():
+    global __objectid__
+    default_name = str( sgPyQt.stringSetting( "pycompos", "def_obj_name", "Object" ).trimmed() )
+    # generate object name
+    __objectid__  = __objectid__ + 1
+    name = "%s_%d" % ( default_name, __objectid__ )
+    if not name: return
+    getEngine().createObject( _getStudy(), name )
+    print getEngine().s1(4,5)
+    print getEngine().ComponentDataType()
+    sg.updateObjBrowser( True )
+
+class DemoImpl(QtGui.QDialog):
+    def __init__(self, *args):
+        super(DemoImpl, self).__init__(*args)
+
+        uic.loadUi(os.path.join(os.environ["pycompos_ROOT_DIR"],"share","salome","resources","pycompos","demo.ui"), self)
+
+    @QtCore.pyqtSlot()
+    def on_button1_clicked(self):
+        for s in "This is a demo".split(" "):
+            self.list.addItem(s)
+
+# called when GUI action is activated
+# action ID is passed as parameter
+def OnGUIEvent( commandID ):
+  print "pycompos.OnGUIEvent(): command = %d" % commandID
+  if commandID==941:
+    widget=QMainWindow(sgPyQt.getDesktop())
+    web = QWebView(widget)
+    page=os.path.join(os.environ["pycompos_ROOT_DIR"],"share","doc","salome","gui","pycompos","index.html")
+    web.load(QUrl(page))
+    widget.setCentralWidget(web)
+    widget.show()
+
+  elif commandID==942:
+    widget = DemoImpl(sgPyQt.getDesktop())
+    widget.show()
+
+  elif commandID==943:
+    CreateObject()
+
+
diff --git a/Examples/pygui1/using.rst b/Examples/pygui1/using.rst
new file mode 100644 (file)
index 0000000..8321bf3
--- /dev/null
@@ -0,0 +1,20 @@
+
+GUI components
+===================
+
+Object Browser
+--------------
+The Object Browser is a reusable GUI component.
+
+The Object Browser is only used to publish the run of the schema as a whole.
+
+
+.. centered:: **Object Browser tab**
+
+The Object Browser is in a tab, with tree_view
+
+Other
+----------
+.. image:: exec.png
+  :align: center
+
diff --git a/Examples/pyth1/Makefile b/Examples/pyth1/Makefile
new file mode 100644 (file)
index 0000000..3e39fc7
--- /dev/null
@@ -0,0 +1,21 @@
+# Copyright (C) 2009-2012  EDF R&D
+#
+# 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
+#
+
+clean:
+       rm -rf *.o *.so *.pyc pycompos_SRC pycompos_SRC.bak appli appli.bak install install.bak traceExec_proc
index 54d263bd5d67df6c7e071a94fe2ebf3dd5f00079..0b89847b9388d4cb388fa391e69e61bf19acf967 100644 (file)
@@ -1,19 +1,19 @@
 A Python component dynamically loadable
 ===============================================
 
-To build this example, modify the components.py file
+To build this example, modify the ../context.py file
 to take into account your configuration.
 
 1- your prerequisite file 
 2- your KERNEL_ROOT_DIR
 
-Then set the environment (including PYTHONPATH for YACGEN, ../.. from here and execute components.py ::
+Then set the environment (including PYTHONPATH for YACSGEN, ../.. from here and execute components.py ::
 
   source <your prerequisite file>
   python components.py
 
 You should get a SALOME module in source form (pycompos_SRC), its installation (install) and
-a SALOME application (appli) composed of modules KERNEL, GUI, YACS and pycompos.
+a SALOME application (appli) composed of modules KERNEL, GUI, YACS and the new module pycompos.
 
 To run a coupling:
 
index f6228828c21377d0dc99ed8d5ca89ad08be90725..8085bd2fd3babc67f42c48d569f180dd5a69acc5 100644 (file)
@@ -1,2 +1,21 @@
+# Copyright (C) 2009-2012  EDF R&D
+#
+# 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
+#
+
 def f():
   print "coucou"
index ae8608f539647c3b9eb220c86a7c43a3c7387a57..61c29a8c877d6870c3cd3ffbe1bd8ece3db286c2 100644 (file)
@@ -1,10 +1,27 @@
+# Copyright (C) 2009-2012  EDF R&D
+#
+# 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
+#
+
 import os
-from module_generator import Generator,Module,Service,PYComponent
 
-context={'update':1,
-         "prerequisites":"/local/cchris/.packages.d/envSalome50",
-         "kernel":"/local/chris/SALOME2/RELEASES/Install/KERNEL_V5",
-        }
+#import context from ..
+execfile("../context.py")
+from module_generator import Generator,Module,Service,PYComponent
 
 cwd=os.getcwd()
 
@@ -46,5 +63,6 @@ g.bootstrap()
 g.configure()
 g.make()
 g.install()
-g.make_appli("appli",restrict=["KERNEL","GUI","YACS"])
+g.make_appli("appli", restrict=["KERNEL"], altmodules={"GUI":GUI_ROOT_DIR, "YACS":YACS_ROOT_DIR})
+
 
index cd9b441f25faba3b1b9c6b1a16a63ebaec9e3295..7c95f9484aa479f5f7aa927bd2aaf31bd826b453 100644 (file)
@@ -1,65 +1,75 @@
-
-<proc>
-
-<!-- types -->
-
-
-<container name="A">
-</container>
-
-<container name="B">
-</container>
-
-<service name="node1" >
-  <component>compo2</component>
-  <method>s1</method>
-  <load container="A"/>
-  <inport name="a" type="double"/>
-  <inport name="b" type="double"/>
-  <outport name="c" type="double"/>
-  <outport name="d" type="double"/>
-  <instream name="aa" type="CALCIUM_double"/>
-  <outstream name="ba" type="CALCIUM_double"/>
-</service>
-
-<service name="node2" >
-  <component>compo2</component>
-  <method>s1</method>
-  <load container="B"/>
-  <inport name="a" type="double"/>
-  <inport name="b" type="double"/>
-  <outport name="c" type="double"/>
-  <outport name="d" type="double"/>
-  <instream name="aa" type="CALCIUM_double"/>
-  <outstream name="ba" type="CALCIUM_double"/>
-</service>
-
-<!--datalinks -->
-<stream>
-  <fromnode>node1</fromnode><fromport>ba</fromport>
-  <tonode>node2</tonode><toport>aa</toport>
-</stream>
-<stream>
-  <fromnode>node2</fromnode><fromport>ba</fromport>
-  <tonode>node1</tonode><toport>aa</toport>
-</stream>
-
-<parameter>
-  <tonode>node1</tonode> <toport>a</toport>
-  <value><double>23</double> </value>
-</parameter>
-<parameter>
-  <tonode>node1</tonode> <toport>b</toport>
-  <value><double>53</double> </value>
-</parameter>
-<parameter>
-  <tonode>node2</tonode> <toport>a</toport>
-  <value><double>63</double> </value>
-</parameter>
-<parameter>
-  <tonode>node2</tonode> <toport>b</toport>
-  <value><double>73</double> </value>
-</parameter>
-
+<?xml version='1.0' encoding='iso-8859-1' ?>
+<proc name="proc">
+   <property name="DefaultStudyID" value="1"/>
+   <objref name="CALCIUM_double" id="IDL:Ports/Calcium_Ports/Calcium_Double_Port:1.0"/>
+   <type name="string" kind="string"/>
+   <struct name="Engines/dataref">
+      <member name="ref" type="string"/>
+   </struct>
+   <type name="bool" kind="bool"/>
+   <sequence name="boolvec" content="bool"/>
+   <type name="double" kind="double"/>
+   <sequence name="dblevec" content="double"/>
+   <objref name="file" id="file"/>
+   <type name="int" kind="int"/>
+   <sequence name="intvec" content="int"/>
+   <objref name="pyobj" id="python:obj:1.0"/>
+   <sequence name="stringvec" content="string"/>
+   <container name="A">
+   </container>
+   <container name="B">
+   </container>
+   <container name="DefaultContainer">
+      <property name="container_name" value="FactoryServer"/>
+      <property name="name" value="localhost"/>
+   </container>
+   <service name="node1">
+      <component>compo2</component>
+      <load container="A"/>
+      <method>s1</method>
+      <inport name="a" type="double"/>
+      <inport name="b" type="double"/>
+      <instream name="aa" type="CALCIUM_double"/>
+      <outport name="c" type="double"/>
+      <outport name="d" type="double"/>
+      <outstream name="ba" type="CALCIUM_double"/>
+   </service>
+   <service name="node2">
+      <component>compo2</component>
+      <load container="B"/>
+      <method>s1</method>
+      <inport name="a" type="double"/>
+      <inport name="b" type="double"/>
+      <instream name="aa" type="CALCIUM_double"/>
+      <outport name="c" type="double"/>
+      <outport name="d" type="double"/>
+      <outstream name="ba" type="CALCIUM_double"/>
+   </service>
+   <stream>
+      <fromnode>node1</fromnode> <fromport>ba</fromport>
+      <tonode>node2</tonode> <toport>aa</toport>
+   </stream>
+   <stream>
+      <fromnode>node2</fromnode> <fromport>ba</fromport>
+      <tonode>node1</tonode> <toport>aa</toport>
+   </stream>
+   <parameter>
+      <tonode>node1</tonode><toport>a</toport>
+      <value><double>23</double></value>
+   </parameter>
+   <parameter>
+      <tonode>node1</tonode><toport>b</toport>
+      <value><double>53</double></value>
+   </parameter>
+   <parameter>
+      <tonode>node2</tonode><toport>a</toport>
+      <value><double>63</double></value>
+   </parameter>
+   <parameter>
+      <tonode>node2</tonode><toport>b</toport>
+      <value><double>73</double></value>
+   </parameter>
+   <presentation name="node1" x="1.75" y="33.25" width="158" height="117" expanded="1" expx="1.75" expy="33.25" expWidth="158" expHeight="117" shownState="0"/>
+   <presentation name="node2" x="195.75" y="33.25" width="158" height="117" expanded="1" expx="195.75" expy="33.25" expWidth="158" expHeight="117" shownState="0"/>
+   <presentation name="__ROOT__" x="0" y="0" width="357.75" height="154.25" expanded="1" expx="0" expy="0" expWidth="357.75" expHeight="154.25" shownState="0"/>
 </proc>
-
diff --git a/Examples/pyth2/Makefile b/Examples/pyth2/Makefile
new file mode 100644 (file)
index 0000000..34110e4
--- /dev/null
@@ -0,0 +1,21 @@
+# Copyright (C) 2009-2012  EDF R&D
+#
+# 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
+#
+
+clean:
+       rm -rf *.o *.so *.pyc pycompos_SRC pycompos_SRC.bak appli appli.bak install install.bak traceExec_proc compo2_inst_1
index 706ee53f4339f1a69eca14e1e951505d3ec89478..88498ae081186c102594ed350b9813f1038c77ce 100644 (file)
@@ -1,19 +1,19 @@
 A Python standalone component (in executable form)
 =======================================================
 
-To build this example, modify the components.py file
+To build this example, modify the ../context.py file
 to take into account your configuration.
 
 1- your prerequisite file 
 2- your KERNEL_ROOT_DIR
 
-Then set the environment (including PYTHONPATH for YACGEN, ../.. from here and execute components.py ::
+Then set the environment (including PYTHONPATH for YACSGEN, ../.. from here and execute components.py ::
 
   source <your prerequisite file>
   python components.py
 
 You should get a SALOME module in source form (pycompos_SRC), its installation (install) and
-a SALOME application (appli) composed of modules KERNEL, GUI, YACS and pycompos.
+a SALOME application (appli) composed of modules KERNEL, GUI, YACS and the new module pycompos.
 
 To run a coupling:
 
index 336c58ca1d3d7765e2ba5433c0806d7950b72146..65e312f69aa3197bf0318f7758c7fcb6ed43b75b 100644 (file)
@@ -1,10 +1,27 @@
+# Copyright (C) 2009-2012  EDF R&D
+#
+# 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
+#
+
 import os
-from module_generator import Generator,Module,Service,PYComponent
 
-context={'update':1,
-         "prerequisites":"/local/cchris/.packages.d/envSalome50",
-         "kernel":"/local/chris/SALOME2/RELEASES/Install/KERNEL_V5",
-        }
+#import context from ..
+execfile("../context.py")
+from module_generator import Generator,Module,Service,PYComponent
 
 cwd=os.getcwd()
 
@@ -42,5 +59,5 @@ g.bootstrap()
 g.configure()
 g.make()
 g.install()
-g.make_appli("appli",restrict=["KERNEL","GUI","YACS"])
+g.make_appli("appli", restrict=["KERNEL"], altmodules={"GUI":GUI_ROOT_DIR, "YACS":YACS_ROOT_DIR})
 
diff --git a/Examples/types1/Makefile b/Examples/types1/Makefile
new file mode 100644 (file)
index 0000000..283148d
--- /dev/null
@@ -0,0 +1,21 @@
+# Copyright (C) 2009-2012  EDF R&D
+#
+# 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
+#
+
+clean:
+       rm -rf *.o *.so mymodule_SRC mymodule_SRC.bak appli appli.bak install install.bak traceExec_*
diff --git a/Examples/types1/README.txt b/Examples/types1/README.txt
new file mode 100644 (file)
index 0000000..7769282
--- /dev/null
@@ -0,0 +1,25 @@
+A test for several YACS types SALOME_TYPES and others
+=========================================================
+
+To build this example, modify the ../context.py file
+to take into account your configuration.
+
+1- your prerequisite file 
+2- your KERNEL_ROOT_DIR
+
+Then set the environment (including PYTHONPATH for YACSGEN, ../.. from here and execute components.py ::
+
+  source <your prerequisite file>
+  python components.py
+
+You should get a SALOME module in source form (module_SRC), its installation (install) and
+a SALOME application (appli) composed of modules KERNEL, GUI, YACS and the new module module.
+
+To run a coupling:
+
+ 1. start SALOME in background : ./appli/runAppli -t
+ 2. start a SALOME session : ./appli/runSession
+ 3. start YACS coupler with coupling file : driver coupling.xml
+ 4. examine output files in /tmp
+ 5. shutdown SALOME : shutdowSalome.py
+ 6. exit session : CTRL-D (or exit)
diff --git a/Examples/types1/components.py b/Examples/types1/components.py
new file mode 100644 (file)
index 0000000..3de0d1f
--- /dev/null
@@ -0,0 +1,230 @@
+# Copyright (C) 2009-2012  EDF R&D
+#
+# 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
+#
+
+import os
+
+#import context from ..
+execfile("../context.py")
+
+from module_generator import Generator,Module,Service,CPPComponent,PYComponent,add_type,add_module
+
+#overload module GEOM definition
+idldefs="""
+#include "GEOM_Gen.idl"
+"""
+makefiledefs="""
+#module GEOM
+GEOM_IDL_INCLUDES = -I$(GEOM_ROOT_DIR)/idl/salome
+GEOM_INCLUDES= -I$(GEOM_ROOT_DIR)/include/salome
+GEOM_IDL_LIBS= -L$(GEOM_ROOT_DIR)/lib/salome -lSalomeIDLGEOM
+GEOM_LIBS= -L$(GEOM_ROOT_DIR)/lib/salome
+SALOME_LIBS += ${GEOM_LIBS}
+SALOME_IDL_LIBS += ${GEOM_IDL_LIBS}
+SALOME_INCLUDES += ${GEOM_INCLUDES}
+IDL_INCLUDES += ${GEOM_IDL_INCLUDES}
+"""
+configdefs="""
+if test "x${GEOM_ROOT_DIR}" != "x" && test -d ${GEOM_ROOT_DIR} ; then
+  AC_MSG_RESULT(Using GEOM installation in ${GEOM_ROOT_DIR})
+else
+  AC_MSG_ERROR([Cannot find module GEOM. Have you set GEOM_ROOT_DIR ?],1)
+fi
+"""
+add_module("GEOM",idldefs,makefiledefs,configdefs)
+
+#overload GEOM_Object definition
+add_type("GEOM_Object", "GEOM::GEOM_Object_ptr", "GEOM::GEOM_Object_out", "GEOM", "GEOM::GEOM_Object","GEOM::GEOM_Object_ptr")
+
+
+cwd=os.getcwd()
+
+defs="""
+"""
+
+body="""
+//inputs
+//Parameter
+std::cerr << "Parameter:" << std::endl;
+std::cerr << "a: " << a.name << "=" << a.value << std::endl;
+std::cerr << "" << std::endl;
+
+//ParameterList
+std::cerr << "ParameterList:" << std::endl;
+for(CORBA::ULong i = 0;i<b.length();i++)
+  std::cerr << "b["<<i<<"]:"<<b[i].name <<"="<<b[i].value << std::endl;
+std::cerr << "" << std::endl;
+
+//Variable
+std::cerr << "Variable:" << std::endl;
+for(CORBA::ULong i = 0;i<c.length();i++)
+  std::cerr << "c["<<i<<"]="<<c[i] << std::endl;
+std::cerr << "" << std::endl;
+
+//VariableSequence
+std::cerr << "VariableSequence:" << std::endl;
+for(CORBA::ULong i = 0;i<d.length();i++)
+  for(CORBA::ULong j = 0;j<d[i].length();j++)
+    std::cerr << "d["<<i<<"]["<< j<< "]="<<d[i][j] << std::endl;
+std::cerr << "" << std::endl;
+
+//StateSequence
+std::cerr << "StateSequence:" << std::endl;
+for(CORBA::ULong i = 0;i<d2.length();i++)
+  for(CORBA::ULong j = 0;j<d2[i].length();j++)
+    for(CORBA::ULong k = 0;k<d2[i][j].length();k++)
+      std::cerr << "d2["<<i<<"]["<< j<< "]["<<k<<"]="<<d2[i][j][k] << std::endl;
+std::cerr << "" << std::endl;
+
+//TimeSequence
+std::cerr << "TimeSequence:" << std::endl;
+for(CORBA::ULong i = 0;i<d3.length();i++)
+  for(CORBA::ULong j = 0;j<d3[i].length();j++)
+    for(CORBA::ULong k = 0;k<d3[i][j].length();k++)
+      for(CORBA::ULong l = 0;l<d3[i][j][k].length();l++)
+      std::cerr << "d3["<<i<<"]["<< j<< "]["<<k<<"]["<<l<<"]="<<d3[i][j][k][l] << std::endl;
+std::cerr << "" << std::endl;
+
+//ParametricInput
+for(CORBA::ULong i = 0;i<f.inputVarList.length();i++)
+  std::cerr << "f.inputVarList["<<i<<"]="<<f.inputVarList[i] << std::endl;
+for(CORBA::ULong i = 0;i<f.outputVarList.length();i++)
+  std::cerr << "f.outputVarList["<<i<<"]="<<f.outputVarList[i] << std::endl;
+for(CORBA::ULong i = 0;i<f.inputValues.length();i++)
+  for(CORBA::ULong j = 0;j<f.inputValues[i].length();j++)
+    for(CORBA::ULong k = 0;k<f.inputValues[i][j].length();k++)
+      for(CORBA::ULong l = 0;l<f.inputValues[i][j][k].length();l++)
+      std::cerr << "f.inputValues["<<i<<"]["<< j<< "]["<<k<<"]["<<l<<"]="<<f.inputValues[i][j][k][l] << std::endl;
+for(CORBA::ULong i = 0;i<f.specificParameters.length();i++)
+  std::cerr << "f.specificParameters["<<i<<"]:"<<f.specificParameters[i].name <<"="<<f.specificParameters[i].value << std::endl;
+
+//ParametricOutput
+for(CORBA::ULong i = 0;i<g.outputValues.length();i++)
+  for(CORBA::ULong j = 0;j<g.outputValues[i].length();j++)
+    for(CORBA::ULong k = 0;k<g.outputValues[i][j].length();k++)
+      for(CORBA::ULong l = 0;l<g.outputValues[i][j][k].length();l++)
+      std::cerr << "g.outputValues["<<i<<"]["<< j<< "]["<<k<<"]["<<l<<"]="<<g.outputValues[i][j][k][l] << std::endl;
+
+//outputs
+//Parameter
+aa=new SALOME_TYPES::Parameter;
+aa->name=CORBA::string_dup(a.name);
+aa->value=CORBA::string_dup(a.value);
+std::cerr << "aa: " << aa->name << "=" << aa->value << std::endl;
+//ParameterList
+ab=new SALOME_TYPES::ParameterList;
+ac= new SALOME_TYPES::Variable;
+ad= new SALOME_TYPES::VariableSequence;
+ad2= new SALOME_TYPES::StateSequence;
+ad3= new SALOME_TYPES::TimeSequence;
+ae= new SALOME_TYPES::VarList;
+af= new SALOME_TYPES::ParametricInput;
+ag= new SALOME_TYPES::ParametricOutput;
+"""
+
+s2body="""
+std::cerr << "service s2 C++ component" << std::endl;
+aa=GEOM::GEOM_Object::_duplicate(a);
+a->Register();
+"""
+
+c1=CPPComponent("compo1",services=[
+          Service("s1",inport=[("a","SALOME_TYPES/Parameter"),
+                               ("b","SALOME_TYPES/ParameterList"),
+                               ("c","SALOME_TYPES/Variable"),
+                               ("d","SALOME_TYPES/VariableSequence"),
+                               ("d2","SALOME_TYPES/StateSequence"),
+                               ("d3","SALOME_TYPES/TimeSequence"),
+                               ("e","SALOME_TYPES/VarList"),
+                               ("f","SALOME_TYPES/ParametricInput"),
+                               ("g","SALOME_TYPES/ParametricOutput"),
+                              ],
+                       outport=[("aa","SALOME_TYPES/Parameter"),
+                                ("ab","SALOME_TYPES/ParameterList"),
+                                ("ac","SALOME_TYPES/Variable"),
+                                ("ad","SALOME_TYPES/VariableSequence"),
+                                ("ad2","SALOME_TYPES/StateSequence"),
+                                ("ad3","SALOME_TYPES/TimeSequence"),
+                                ("ae","SALOME_TYPES/VarList"),
+                                ("af","SALOME_TYPES/ParametricInput"),
+                                ("ag","SALOME_TYPES/ParametricOutput"),
+                               ],
+                       defs=defs,body=body,
+                 ),
+          Service("s2",inport=[("a","GEOM_Object"),],outport=[("aa","GEOM_Object"),],body=s2body,),
+                                  ],
+         )
+
+pydefs="""import SALOME_TYPES"""
+
+pybody="""
+print a,b,c,d,d2,d3,e,f,g
+aa=SALOME_TYPES.Parameter(name="a",value="45.")
+ab=[]
+ac=[1,2,3]
+ad=[[1,2,3]]
+ad2=[[[1,2,3]]]
+ad3=[[[[1,2,3]]]]
+ae=["aaa","bbb"]
+af=SALOME_TYPES.ParametricInput(inputVarList=ae,outputVarList=ae, inputValues=[[[[1,2,3]]]],specificParameters=[])
+ag=SALOME_TYPES.ParametricOutput(outputValues=[[[[1,2,3]]]], specificOutputInfos=[], returnCode=1, errorMessage="error")
+print aa,ab,ac,ad,ad2,ad3,ae,af,ag
+"""
+
+s2pybody="""
+print "service s2 python component"
+aa=a
+a.Register()
+"""
+
+c2=PYComponent("compo2",services=[
+          Service("s1",inport=[("a","SALOME_TYPES/Parameter"),
+                               ("b","SALOME_TYPES/ParameterList"),
+                               ("c","SALOME_TYPES/Variable"),
+                               ("d","SALOME_TYPES/VariableSequence"),
+                               ("d2","SALOME_TYPES/StateSequence"),
+                               ("d3","SALOME_TYPES/TimeSequence"),
+                               ("e","SALOME_TYPES/VarList"),
+                               ("f","SALOME_TYPES/ParametricInput"),
+                               ("g","SALOME_TYPES/ParametricOutput"),
+                              ],
+                       outport=[("aa","SALOME_TYPES/Parameter"),
+                                ("ab","SALOME_TYPES/ParameterList"),
+                                ("ac","SALOME_TYPES/Variable"),
+                                ("ad","SALOME_TYPES/VariableSequence"),
+                                ("ad2","SALOME_TYPES/StateSequence"),
+                                ("ad3","SALOME_TYPES/TimeSequence"),
+                                ("ae","SALOME_TYPES/VarList"),
+                                ("af","SALOME_TYPES/ParametricInput"),
+                                ("ag","SALOME_TYPES/ParametricOutput"),
+                               ],
+                       body=pybody,defs=pydefs,
+                 ),
+          Service("s2",inport=[("a","GEOM_Object"),],outport=[("aa","GEOM_Object"),],body=s2pybody,),
+                                 ],
+              )
+
+
+g=Generator(Module("mymodule",components=[c1,c2],prefix="./install"),context)
+g.generate()
+g.bootstrap()
+g.configure()
+g.make()
+g.install()
+g.make_appli("appli", restrict=["KERNEL"], altmodules={"GUI":GUI_ROOT_DIR, "YACS":YACS_ROOT_DIR, "GEOM":GEOM_ROOT_DIR})
+
diff --git a/Examples/types1/coupling.xml b/Examples/types1/coupling.xml
new file mode 100644 (file)
index 0000000..fcf1918
--- /dev/null
@@ -0,0 +1,434 @@
+<?xml version='1.0' encoding='iso-8859-1' ?>
+<proc name="newSchema_1">
+   <property name="DefaultStudyID" value="1"/>
+   <type name="string" kind="string"/>
+   <struct name="Engines/dataref">
+      <member name="ref" type="string"/>
+   </struct>
+   <struct name="SALOME_TYPES/Parameter">
+      <member name="name" type="string"/>
+      <member name="value" type="string"/>
+   </struct>
+   <sequence name="SALOME_TYPES/ParameterList" content="SALOME_TYPES/Parameter"/>
+   <sequence name="SALOME_TYPES/VarList" content="string"/>
+   <type name="double" kind="double"/>
+   <sequence name="SALOME_TYPES/Variable" content="double"/>
+   <sequence name="SALOME_TYPES/VariableSequence" content="SALOME_TYPES/Variable"/>
+   <sequence name="SALOME_TYPES/StateSequence" content="SALOME_TYPES/VariableSequence"/>
+   <sequence name="SALOME_TYPES/TimeSequence" content="SALOME_TYPES/StateSequence"/>
+   <struct name="SALOME_TYPES/ParametricInput">
+      <member name="inputVarList" type="SALOME_TYPES/VarList"/>
+      <member name="outputVarList" type="SALOME_TYPES/VarList"/>
+      <member name="inputValues" type="SALOME_TYPES/TimeSequence"/>
+      <member name="specificParameters" type="SALOME_TYPES/ParameterList"/>
+   </struct>
+   <type name="int" kind="int"/>
+   <struct name="SALOME_TYPES/ParametricOutput">
+      <member name="outputValues" type="SALOME_TYPES/TimeSequence"/>
+      <member name="specificOutputInfos" type="SALOME_TYPES/ParameterList"/>
+      <member name="returnCode" type="int"/>
+      <member name="errorMessage" type="string"/>
+   </struct>
+   <type name="bool" kind="bool"/>
+   <sequence name="boolvec" content="bool"/>
+   <sequence name="dblevec" content="double"/>
+   <objref name="file" id="file"/>
+   <sequence name="intvec" content="int"/>
+   <objref name="pyobj" id="python:obj:1.0"/>
+   <sequence name="stringvec" content="string"/>
+   <container name="DefaultContainer">
+      <property name="container_name" value="FactoryServer"/>
+      <property name="name" value="cli75al"/>
+   </container>
+   <service name="s10">
+      <component>compo1</component>
+      <load container="DefaultContainer"/>
+      <method>s1</method>
+      <inport name="a" type="SALOME_TYPES/Parameter"/>
+      <inport name="b" type="SALOME_TYPES/ParameterList"/>
+      <inport name="c" type="SALOME_TYPES/Variable"/>
+      <inport name="d" type="SALOME_TYPES/VariableSequence"/>
+      <inport name="d2" type="SALOME_TYPES/StateSequence"/>
+      <inport name="d3" type="SALOME_TYPES/TimeSequence"/>
+      <inport name="e" type="SALOME_TYPES/VarList"/>
+      <inport name="f" type="SALOME_TYPES/ParametricInput"/>
+      <inport name="g" type="SALOME_TYPES/ParametricOutput"/>
+      <outport name="aa" type="SALOME_TYPES/Parameter"/>
+      <outport name="ab" type="SALOME_TYPES/ParameterList"/>
+      <outport name="ac" type="SALOME_TYPES/Variable"/>
+      <outport name="ad" type="SALOME_TYPES/VariableSequence"/>
+      <outport name="ad2" type="SALOME_TYPES/StateSequence"/>
+      <outport name="ad3" type="SALOME_TYPES/TimeSequence"/>
+      <outport name="ae" type="SALOME_TYPES/VarList"/>
+      <outport name="af" type="SALOME_TYPES/ParametricInput"/>
+      <outport name="ag" type="SALOME_TYPES/ParametricOutput"/>
+   </service>
+   <service name="s11">
+      <component>compo2</component>
+      <load container="DefaultContainer"/>
+      <method>s1</method>
+      <inport name="a" type="SALOME_TYPES/Parameter"/>
+      <inport name="b" type="SALOME_TYPES/ParameterList"/>
+      <inport name="c" type="SALOME_TYPES/Variable"/>
+      <inport name="d" type="SALOME_TYPES/VariableSequence"/>
+      <inport name="d2" type="SALOME_TYPES/StateSequence"/>
+      <inport name="d3" type="SALOME_TYPES/TimeSequence"/>
+      <inport name="e" type="SALOME_TYPES/VarList"/>
+      <inport name="f" type="SALOME_TYPES/ParametricInput"/>
+      <inport name="g" type="SALOME_TYPES/ParametricOutput"/>
+      <outport name="aa" type="SALOME_TYPES/Parameter"/>
+      <outport name="ab" type="SALOME_TYPES/ParameterList"/>
+      <outport name="ac" type="SALOME_TYPES/Variable"/>
+      <outport name="ad" type="SALOME_TYPES/VariableSequence"/>
+      <outport name="ad2" type="SALOME_TYPES/StateSequence"/>
+      <outport name="ad3" type="SALOME_TYPES/TimeSequence"/>
+      <outport name="ae" type="SALOME_TYPES/VarList"/>
+      <outport name="af" type="SALOME_TYPES/ParametricInput"/>
+      <outport name="ag" type="SALOME_TYPES/ParametricOutput"/>
+   </service>
+   <service name="s12">
+      <component>compo1</component>
+      <load container="DefaultContainer"/>
+      <method>s1</method>
+      <inport name="a" type="SALOME_TYPES/Parameter"/>
+      <inport name="b" type="SALOME_TYPES/ParameterList"/>
+      <inport name="c" type="SALOME_TYPES/Variable"/>
+      <inport name="d" type="SALOME_TYPES/VariableSequence"/>
+      <inport name="d2" type="SALOME_TYPES/StateSequence"/>
+      <inport name="d3" type="SALOME_TYPES/TimeSequence"/>
+      <inport name="e" type="SALOME_TYPES/VarList"/>
+      <inport name="f" type="SALOME_TYPES/ParametricInput"/>
+      <inport name="g" type="SALOME_TYPES/ParametricOutput"/>
+      <outport name="aa" type="SALOME_TYPES/Parameter"/>
+      <outport name="ab" type="SALOME_TYPES/ParameterList"/>
+      <outport name="ac" type="SALOME_TYPES/Variable"/>
+      <outport name="ad" type="SALOME_TYPES/VariableSequence"/>
+      <outport name="ad2" type="SALOME_TYPES/StateSequence"/>
+      <outport name="ad3" type="SALOME_TYPES/TimeSequence"/>
+      <outport name="ae" type="SALOME_TYPES/VarList"/>
+      <outport name="af" type="SALOME_TYPES/ParametricInput"/>
+      <outport name="ag" type="SALOME_TYPES/ParametricOutput"/>
+   </service>
+   <service name="s13">
+      <component>compo2</component>
+      <load container="DefaultContainer"/>
+      <method>s1</method>
+      <inport name="a" type="SALOME_TYPES/Parameter"/>
+      <inport name="b" type="SALOME_TYPES/ParameterList"/>
+      <inport name="c" type="SALOME_TYPES/Variable"/>
+      <inport name="d" type="SALOME_TYPES/VariableSequence"/>
+      <inport name="d2" type="SALOME_TYPES/StateSequence"/>
+      <inport name="d3" type="SALOME_TYPES/TimeSequence"/>
+      <inport name="e" type="SALOME_TYPES/VarList"/>
+      <inport name="f" type="SALOME_TYPES/ParametricInput"/>
+      <inport name="g" type="SALOME_TYPES/ParametricOutput"/>
+      <outport name="aa" type="SALOME_TYPES/Parameter"/>
+      <outport name="ab" type="SALOME_TYPES/ParameterList"/>
+      <outport name="ac" type="SALOME_TYPES/Variable"/>
+      <outport name="ad" type="SALOME_TYPES/VariableSequence"/>
+      <outport name="ad2" type="SALOME_TYPES/StateSequence"/>
+      <outport name="ad3" type="SALOME_TYPES/TimeSequence"/>
+      <outport name="ae" type="SALOME_TYPES/VarList"/>
+      <outport name="af" type="SALOME_TYPES/ParametricInput"/>
+      <outport name="ag" type="SALOME_TYPES/ParametricOutput"/>
+   </service>
+   <inline name="PyScript1154">
+      <script><code><![CDATA[
+import SALOME_TYPES
+o2={"name":"x","value":"36."}
+o3=[{"name":"x","value":"36."}]
+o16=[1.,2.,3.]
+o17=[[1.,2.,3.]]
+o18=[[[1.,2.,3.]]]
+o19=[[[[1.,2.,3.]]]]
+o5=["toto","titi"]
+o7={"inputVarList":o5,"outputVarList":o5,
+"inputValues":o19,"specificParameters":o3}
+o8={"outputValues":o19,
+    "specificOutputInfos":o3,
+    "returnCode":1,
+    "errorMessage":"error"}
+]]></code></script>
+      <outport name="o2" type="SALOME_TYPES/Parameter"/>
+      <outport name="o3" type="SALOME_TYPES/ParameterList"/>
+      <outport name="o16" type="SALOME_TYPES/Variable"/>
+      <outport name="o17" type="SALOME_TYPES/VariableSequence"/>
+      <outport name="o18" type="SALOME_TYPES/StateSequence"/>
+      <outport name="o19" type="SALOME_TYPES/TimeSequence"/>
+      <outport name="o5" type="SALOME_TYPES/VarList"/>
+      <outport name="o7" type="SALOME_TYPES/ParametricInput"/>
+      <outport name="o8" type="SALOME_TYPES/ParametricOutput"/>
+   </inline>
+   <inline name="PyScript0005">
+      <script><code><![CDATA[print i1
+print i2
+print i3
+print i4
+print i8
+print i9
+print i5
+print i6
+print i7
+]]></code></script>
+      <inport name="i1" type="SALOME_TYPES/Parameter"/>
+      <inport name="i2" type="SALOME_TYPES/ParameterList"/>
+      <inport name="i3" type="SALOME_TYPES/Variable"/>
+      <inport name="i4" type="SALOME_TYPES/VariableSequence"/>
+      <inport name="i8" type="SALOME_TYPES/StateSequence"/>
+      <inport name="i9" type="SALOME_TYPES/TimeSequence"/>
+      <inport name="i5" type="SALOME_TYPES/VarList"/>
+      <inport name="i6" type="SALOME_TYPES/ParametricInput"/>
+      <inport name="i7" type="SALOME_TYPES/ParametricOutput"/>
+   </inline>
+   <inline name="PyScript006">
+      <script><code><![CDATA[print i1
+print i2
+print i3
+print i4
+print i8
+print i9
+print i5
+print i6
+print i7
+]]></code></script>
+      <inport name="i1" type="SALOME_TYPES/Parameter"/>
+      <inport name="i2" type="SALOME_TYPES/ParameterList"/>
+      <inport name="i3" type="SALOME_TYPES/Variable"/>
+      <inport name="i4" type="SALOME_TYPES/VariableSequence"/>
+      <inport name="i8" type="SALOME_TYPES/StateSequence"/>
+      <inport name="i9" type="SALOME_TYPES/TimeSequence"/>
+      <inport name="i5" type="SALOME_TYPES/VarList"/>
+      <inport name="i6" type="SALOME_TYPES/ParametricInput"/>
+      <inport name="i7" type="SALOME_TYPES/ParametricOutput"/>
+   </inline>
+   <control> <fromnode>s12</fromnode> <tonode>s11</tonode> </control>
+   <control> <fromnode>s12</fromnode> <tonode>PyScript0005</tonode> </control>
+   <control> <fromnode>s13</fromnode> <tonode>s10</tonode> </control>
+   <control> <fromnode>s13</fromnode> <tonode>PyScript006</tonode> </control>
+   <control> <fromnode>PyScript1154</fromnode> <tonode>s12</tonode> </control>
+   <control> <fromnode>PyScript1154</fromnode> <tonode>s13</tonode> </control>
+   <datalink control="false">
+      <fromnode>s12</fromnode> <fromport>aa</fromport>
+      <tonode>s11</tonode> <toport>a</toport>
+   </datalink>
+   <datalink control="false">
+      <fromnode>s12</fromnode> <fromport>aa</fromport>
+      <tonode>PyScript0005</tonode> <toport>i1</toport>
+   </datalink>
+   <datalink control="false">
+      <fromnode>s12</fromnode> <fromport>ab</fromport>
+      <tonode>s11</tonode> <toport>b</toport>
+   </datalink>
+   <datalink control="false">
+      <fromnode>s12</fromnode> <fromport>ab</fromport>
+      <tonode>PyScript0005</tonode> <toport>i2</toport>
+   </datalink>
+   <datalink control="false">
+      <fromnode>s12</fromnode> <fromport>ac</fromport>
+      <tonode>s11</tonode> <toport>c</toport>
+   </datalink>
+   <datalink control="false">
+      <fromnode>s12</fromnode> <fromport>ac</fromport>
+      <tonode>PyScript0005</tonode> <toport>i3</toport>
+   </datalink>
+   <datalink control="false">
+      <fromnode>s12</fromnode> <fromport>ad</fromport>
+      <tonode>s11</tonode> <toport>d</toport>
+   </datalink>
+   <datalink control="false">
+      <fromnode>s12</fromnode> <fromport>ad</fromport>
+      <tonode>PyScript0005</tonode> <toport>i4</toport>
+   </datalink>
+   <datalink control="false">
+      <fromnode>s12</fromnode> <fromport>ad2</fromport>
+      <tonode>s11</tonode> <toport>d2</toport>
+   </datalink>
+   <datalink control="false">
+      <fromnode>s12</fromnode> <fromport>ad2</fromport>
+      <tonode>PyScript0005</tonode> <toport>i8</toport>
+   </datalink>
+   <datalink control="false">
+      <fromnode>s12</fromnode> <fromport>ad3</fromport>
+      <tonode>s11</tonode> <toport>d3</toport>
+   </datalink>
+   <datalink control="false">
+      <fromnode>s12</fromnode> <fromport>ad3</fromport>
+      <tonode>PyScript0005</tonode> <toport>i9</toport>
+   </datalink>
+   <datalink control="false">
+      <fromnode>s12</fromnode> <fromport>ae</fromport>
+      <tonode>PyScript0005</tonode> <toport>i5</toport>
+   </datalink>
+   <datalink control="false">
+      <fromnode>s12</fromnode> <fromport>ae</fromport>
+      <tonode>s11</tonode> <toport>e</toport>
+   </datalink>
+   <datalink control="false">
+      <fromnode>s12</fromnode> <fromport>af</fromport>
+      <tonode>PyScript0005</tonode> <toport>i6</toport>
+   </datalink>
+   <datalink control="false">
+      <fromnode>s12</fromnode> <fromport>af</fromport>
+      <tonode>s11</tonode> <toport>f</toport>
+   </datalink>
+   <datalink control="false">
+      <fromnode>s12</fromnode> <fromport>ag</fromport>
+      <tonode>PyScript0005</tonode> <toport>i7</toport>
+   </datalink>
+   <datalink control="false">
+      <fromnode>s12</fromnode> <fromport>ag</fromport>
+      <tonode>s11</tonode> <toport>g</toport>
+   </datalink>
+   <datalink control="false">
+      <fromnode>s13</fromnode> <fromport>aa</fromport>
+      <tonode>s10</tonode> <toport>a</toport>
+   </datalink>
+   <datalink control="false">
+      <fromnode>s13</fromnode> <fromport>aa</fromport>
+      <tonode>PyScript006</tonode> <toport>i1</toport>
+   </datalink>
+   <datalink control="false">
+      <fromnode>s13</fromnode> <fromport>ab</fromport>
+      <tonode>s10</tonode> <toport>b</toport>
+   </datalink>
+   <datalink control="false">
+      <fromnode>s13</fromnode> <fromport>ab</fromport>
+      <tonode>PyScript006</tonode> <toport>i2</toport>
+   </datalink>
+   <datalink control="false">
+      <fromnode>s13</fromnode> <fromport>ac</fromport>
+      <tonode>s10</tonode> <toport>c</toport>
+   </datalink>
+   <datalink control="false">
+      <fromnode>s13</fromnode> <fromport>ac</fromport>
+      <tonode>PyScript006</tonode> <toport>i3</toport>
+   </datalink>
+   <datalink control="false">
+      <fromnode>s13</fromnode> <fromport>ad</fromport>
+      <tonode>s10</tonode> <toport>d</toport>
+   </datalink>
+   <datalink control="false">
+      <fromnode>s13</fromnode> <fromport>ad</fromport>
+      <tonode>PyScript006</tonode> <toport>i4</toport>
+   </datalink>
+   <datalink control="false">
+      <fromnode>s13</fromnode> <fromport>ad2</fromport>
+      <tonode>s10</tonode> <toport>d2</toport>
+   </datalink>
+   <datalink control="false">
+      <fromnode>s13</fromnode> <fromport>ad2</fromport>
+      <tonode>PyScript006</tonode> <toport>i8</toport>
+   </datalink>
+   <datalink control="false">
+      <fromnode>s13</fromnode> <fromport>ad3</fromport>
+      <tonode>s10</tonode> <toport>d3</toport>
+   </datalink>
+   <datalink control="false">
+      <fromnode>s13</fromnode> <fromport>ad3</fromport>
+      <tonode>PyScript006</tonode> <toport>i9</toport>
+   </datalink>
+   <datalink control="false">
+      <fromnode>s13</fromnode> <fromport>ae</fromport>
+      <tonode>s10</tonode> <toport>e</toport>
+   </datalink>
+   <datalink control="false">
+      <fromnode>s13</fromnode> <fromport>ae</fromport>
+      <tonode>PyScript006</tonode> <toport>i5</toport>
+   </datalink>
+   <datalink control="false">
+      <fromnode>s13</fromnode> <fromport>af</fromport>
+      <tonode>s10</tonode> <toport>f</toport>
+   </datalink>
+   <datalink control="false">
+      <fromnode>s13</fromnode> <fromport>af</fromport>
+      <tonode>PyScript006</tonode> <toport>i6</toport>
+   </datalink>
+   <datalink control="false">
+      <fromnode>s13</fromnode> <fromport>ag</fromport>
+      <tonode>s10</tonode> <toport>g</toport>
+   </datalink>
+   <datalink control="false">
+      <fromnode>s13</fromnode> <fromport>ag</fromport>
+      <tonode>PyScript006</tonode> <toport>i7</toport>
+   </datalink>
+   <datalink control="false">
+      <fromnode>PyScript1154</fromnode> <fromport>o2</fromport>
+      <tonode>s12</tonode> <toport>a</toport>
+   </datalink>
+   <datalink control="false">
+      <fromnode>PyScript1154</fromnode> <fromport>o2</fromport>
+      <tonode>s13</tonode> <toport>a</toport>
+   </datalink>
+   <datalink control="false">
+      <fromnode>PyScript1154</fromnode> <fromport>o3</fromport>
+      <tonode>s12</tonode> <toport>b</toport>
+   </datalink>
+   <datalink control="false">
+      <fromnode>PyScript1154</fromnode> <fromport>o3</fromport>
+      <tonode>s13</tonode> <toport>b</toport>
+   </datalink>
+   <datalink control="false">
+      <fromnode>PyScript1154</fromnode> <fromport>o16</fromport>
+      <tonode>s12</tonode> <toport>c</toport>
+   </datalink>
+   <datalink control="false">
+      <fromnode>PyScript1154</fromnode> <fromport>o16</fromport>
+      <tonode>s13</tonode> <toport>c</toport>
+   </datalink>
+   <datalink control="false">
+      <fromnode>PyScript1154</fromnode> <fromport>o17</fromport>
+      <tonode>s12</tonode> <toport>d</toport>
+   </datalink>
+   <datalink control="false">
+      <fromnode>PyScript1154</fromnode> <fromport>o17</fromport>
+      <tonode>s13</tonode> <toport>d</toport>
+   </datalink>
+   <datalink control="false">
+      <fromnode>PyScript1154</fromnode> <fromport>o18</fromport>
+      <tonode>s12</tonode> <toport>d2</toport>
+   </datalink>
+   <datalink control="false">
+      <fromnode>PyScript1154</fromnode> <fromport>o18</fromport>
+      <tonode>s13</tonode> <toport>d2</toport>
+   </datalink>
+   <datalink control="false">
+      <fromnode>PyScript1154</fromnode> <fromport>o19</fromport>
+      <tonode>s12</tonode> <toport>d3</toport>
+   </datalink>
+   <datalink control="false">
+      <fromnode>PyScript1154</fromnode> <fromport>o19</fromport>
+      <tonode>s13</tonode> <toport>d3</toport>
+   </datalink>
+   <datalink control="false">
+      <fromnode>PyScript1154</fromnode> <fromport>o5</fromport>
+      <tonode>s12</tonode> <toport>e</toport>
+   </datalink>
+   <datalink control="false">
+      <fromnode>PyScript1154</fromnode> <fromport>o5</fromport>
+      <tonode>s13</tonode> <toport>e</toport>
+   </datalink>
+   <datalink control="false">
+      <fromnode>PyScript1154</fromnode> <fromport>o7</fromport>
+      <tonode>s12</tonode> <toport>f</toport>
+   </datalink>
+   <datalink control="false">
+      <fromnode>PyScript1154</fromnode> <fromport>o7</fromport>
+      <tonode>s13</tonode> <toport>f</toport>
+   </datalink>
+   <datalink control="false">
+      <fromnode>PyScript1154</fromnode> <fromport>o8</fromport>
+      <tonode>s12</tonode> <toport>g</toport>
+   </datalink>
+   <datalink control="false">
+      <fromnode>PyScript1154</fromnode> <fromport>o8</fromport>
+      <tonode>s13</tonode> <toport>g</toport>
+   </datalink>
+   <presentation name="s10" x="575.884" y="593.5" width="158" height="279" expanded="1" expx="575.884" expy="593.5" expWidth="158" expHeight="279" shownState="0"/>
+   <presentation name="s11" x="576.006" y="314" width="158" height="279" expanded="1" expx="576.006" expy="314" expWidth="158" expHeight="279" shownState="0"/>
+   <presentation name="PyScript006" x="579.62" y="873" width="158" height="279" expanded="1" expx="579.62" expy="873" expWidth="158" expHeight="279" shownState="0"/>
+   <presentation name="s12" x="281" y="214.5" width="158" height="279" expanded="1" expx="281" expy="214.5" expWidth="158" expHeight="279" shownState="0"/>
+   <presentation name="s13" x="279" y="498" width="158" height="279" expanded="1" expx="279" expy="498" expWidth="158" expHeight="279" shownState="0"/>
+   <presentation name="PyScript1154" x="45" y="329" width="158" height="279" expanded="1" expx="45" expy="329" expWidth="158" expHeight="279" shownState="0"/>
+   <presentation name="PyScript0005" x="580" y="34" width="158" height="279" expanded="1" expx="580" expy="34" expWidth="158" expHeight="279" shownState="0"/>
+   <presentation name="__ROOT__" x="0" y="0" width="742" height="1156" expanded="1" expx="0" expy="0" expWidth="742" expHeight="1156" shownState="0"/>
+</proc>
diff --git a/Examples/types1/geom_coupling.xml b/Examples/types1/geom_coupling.xml
new file mode 100644 (file)
index 0000000..e57c8dd
--- /dev/null
@@ -0,0 +1,93 @@
+<?xml version='1.0' encoding='iso-8859-1' ?>
+<proc name="proc">
+   <property name="DefaultStudyID" value="1"/>
+   <objref name="CALCIUM_double" id="IDL:Ports/Calcium_Ports/Calcium_Double_Port:1.0"/>
+   <type name="string" kind="string"/>
+   <struct name="Engines/dataref">
+      <member name="ref" type="string"/>
+   </struct>
+   <objref name="GEOM_Object" id="IDL:GEOM/GEOM_Object:1.0"/>
+   <struct name="SALOME_TYPES/Parameter">
+      <member name="name" type="string"/>
+      <member name="value" type="string"/>
+   </struct>
+   <sequence name="SALOME_TYPES/ParameterList" content="SALOME_TYPES/Parameter"/>
+   <sequence name="SALOME_TYPES/VarList" content="string"/>
+   <type name="double" kind="double"/>
+   <sequence name="Value1D" content="double"/>
+   <sequence name="SALOME_TYPES/Value" content="Value1D"/>
+   <sequence name="SALOME_TYPES/ValueList" content="SALOME_TYPES/Value"/>
+   <struct name="SALOME_TYPES/ParametricInput">
+      <member name="inputVarList" type="SALOME_TYPES/VarList"/>
+      <member name="outputVarList" type="SALOME_TYPES/VarList"/>
+      <member name="inputValues" type="SALOME_TYPES/ValueList"/>
+      <member name="specificParameters" type="SALOME_TYPES/ParameterList"/>
+   </struct>
+   <type name="int" kind="int"/>
+   <struct name="SALOME_TYPES/ParametricOutput">
+      <member name="outputValues" type="SALOME_TYPES/ValueList"/>
+      <member name="specificOutputInfos" type="SALOME_TYPES/ParameterList"/>
+      <member name="returnCode" type="int"/>
+      <member name="errorMessage" type="string"/>
+   </struct>
+   <type name="bool" kind="bool"/>
+   <sequence name="boolvec" content="bool"/>
+   <sequence name="dblevec" content="double"/>
+   <objref name="file" id="file"/>
+   <sequence name="intvec" content="int"/>
+   <objref name="pyobj" id="python:obj:1.0"/>
+   <sequence name="stringvec" content="string"/>
+   <container name="A">
+   </container>
+   <container name="B">
+   </container>
+   <container name="DefaultContainer">
+      <property name="container_name" value="FactoryServer"/>
+      <property name="name" value="localhost"/>
+   </container>
+   <service name="MakeBoxDXDYDZ0">
+      <component>GEOM_Superv</component>
+      <load container="DefaultContainer"/>
+      <method>MakeBoxDXDYDZ</method>
+      <inport name="theDX" type="double"/>
+      <inport name="theDY" type="double"/>
+      <inport name="theDZ" type="double"/>
+      <outport name="return" type="GEOM_Object"/>
+   </service>
+   <service name="s21">
+      <component>compo1</component>
+      <load container="DefaultContainer"/>
+      <method>s2</method>
+      <inport name="a" type="GEOM_Object"/>
+      <outport name="aa" type="GEOM_Object"/>
+   </service>
+   <outnode name="StudyOutNode2" kind="study">
+      <parameter name="i3" type="GEOM_Object" ref="/GEOM_Superv_1/Box_1"/>
+   </outnode>
+   <control> <fromnode>MakeBoxDXDYDZ0</fromnode> <tonode>s21</tonode> </control>
+   <control> <fromnode>MakeBoxDXDYDZ0</fromnode> <tonode>StudyOutNode2</tonode> </control>
+   <datalink control="false">
+      <fromnode>MakeBoxDXDYDZ0</fromnode> <fromport>return</fromport>
+      <tonode>s21</tonode> <toport>a</toport>
+   </datalink>
+   <datalink control="false">
+      <fromnode>MakeBoxDXDYDZ0</fromnode> <fromport>return</fromport>
+      <tonode>StudyOutNode2</tonode> <toport>i3</toport>
+   </datalink>
+   <parameter>
+      <tonode>MakeBoxDXDYDZ0</tonode><toport>theDX</toport>
+      <value><double>10</double></value>
+   </parameter>
+   <parameter>
+      <tonode>MakeBoxDXDYDZ0</tonode><toport>theDY</toport>
+      <value><double>10</double></value>
+   </parameter>
+   <parameter>
+      <tonode>MakeBoxDXDYDZ0</tonode><toport>theDZ</toport>
+      <value><double>10</double></value>
+   </parameter>
+   <presentation name="s21" x="244.75" y="144.25" width="158" height="63" expanded="1" expx="244.75" expy="144.25" expWidth="158" expHeight="63" shownState="0"/>
+   <presentation name="StudyOutNode2" x="249.75" y="33" width="158" height="63" expanded="1" expx="249.75" expy="33" expWidth="158" expHeight="63" shownState="0"/>
+   <presentation name="MakeBoxDXDYDZ0" x="4" y="68.25" width="158" height="117" expanded="1" expx="4" expy="68.25" expWidth="158" expHeight="117" shownState="0"/>
+   <presentation name="__ROOT__" x="0" y="0" width="411.75" height="211.25" expanded="1" expx="0" expy="0" expWidth="411.75" expHeight="211.25" shownState="0"/>
+</proc>
diff --git a/Examples/types1/geom_coupling_compo2.xml b/Examples/types1/geom_coupling_compo2.xml
new file mode 100644 (file)
index 0000000..b0849bc
--- /dev/null
@@ -0,0 +1,93 @@
+<?xml version='1.0' encoding='iso-8859-1' ?>
+<proc name="proc">
+   <property name="DefaultStudyID" value="1"/>
+   <objref name="CALCIUM_double" id="IDL:Ports/Calcium_Ports/Calcium_Double_Port:1.0"/>
+   <type name="string" kind="string"/>
+   <struct name="Engines/dataref">
+      <member name="ref" type="string"/>
+   </struct>
+   <objref name="GEOM_Object" id="IDL:GEOM/GEOM_Object:1.0"/>
+   <struct name="SALOME_TYPES/Parameter">
+      <member name="name" type="string"/>
+      <member name="value" type="string"/>
+   </struct>
+   <sequence name="SALOME_TYPES/ParameterList" content="SALOME_TYPES/Parameter"/>
+   <sequence name="SALOME_TYPES/VarList" content="string"/>
+   <type name="double" kind="double"/>
+   <sequence name="Value1D" content="double"/>
+   <sequence name="SALOME_TYPES/Value" content="Value1D"/>
+   <sequence name="SALOME_TYPES/ValueList" content="SALOME_TYPES/Value"/>
+   <struct name="SALOME_TYPES/ParametricInput">
+      <member name="inputVarList" type="SALOME_TYPES/VarList"/>
+      <member name="outputVarList" type="SALOME_TYPES/VarList"/>
+      <member name="inputValues" type="SALOME_TYPES/ValueList"/>
+      <member name="specificParameters" type="SALOME_TYPES/ParameterList"/>
+   </struct>
+   <type name="int" kind="int"/>
+   <struct name="SALOME_TYPES/ParametricOutput">
+      <member name="outputValues" type="SALOME_TYPES/ValueList"/>
+      <member name="specificOutputInfos" type="SALOME_TYPES/ParameterList"/>
+      <member name="returnCode" type="int"/>
+      <member name="errorMessage" type="string"/>
+   </struct>
+   <type name="bool" kind="bool"/>
+   <sequence name="boolvec" content="bool"/>
+   <sequence name="dblevec" content="double"/>
+   <objref name="file" id="file"/>
+   <sequence name="intvec" content="int"/>
+   <objref name="pyobj" id="python:obj:1.0"/>
+   <sequence name="stringvec" content="string"/>
+   <container name="A">
+   </container>
+   <container name="B">
+   </container>
+   <container name="DefaultContainer">
+      <property name="container_name" value="FactoryServer"/>
+      <property name="name" value="localhost"/>
+   </container>
+   <service name="MakeBoxDXDYDZ0">
+      <component>GEOM_Superv</component>
+      <load container="DefaultContainer"/>
+      <method>MakeBoxDXDYDZ</method>
+      <inport name="theDX" type="double"/>
+      <inport name="theDY" type="double"/>
+      <inport name="theDZ" type="double"/>
+      <outport name="return" type="GEOM_Object"/>
+   </service>
+   <outnode name="StudyOutNode2" kind="study">
+      <parameter name="i3" type="GEOM_Object" ref="/GEOM_Superv_1/Box_2"/>
+   </outnode>
+   <service name="s20">
+      <component>compo2</component>
+      <load container="DefaultContainer"/>
+      <method>s2</method>
+      <inport name="a" type="GEOM_Object"/>
+      <outport name="aa" type="GEOM_Object"/>
+   </service>
+   <control> <fromnode>MakeBoxDXDYDZ0</fromnode> <tonode>s20</tonode> </control>
+   <control> <fromnode>MakeBoxDXDYDZ0</fromnode> <tonode>StudyOutNode2</tonode> </control>
+   <datalink control="false">
+      <fromnode>MakeBoxDXDYDZ0</fromnode> <fromport>return</fromport>
+      <tonode>s20</tonode> <toport>a</toport>
+   </datalink>
+   <datalink control="false">
+      <fromnode>MakeBoxDXDYDZ0</fromnode> <fromport>return</fromport>
+      <tonode>StudyOutNode2</tonode> <toport>i3</toport>
+   </datalink>
+   <parameter>
+      <tonode>MakeBoxDXDYDZ0</tonode><toport>theDX</toport>
+      <value><double>10</double></value>
+   </parameter>
+   <parameter>
+      <tonode>MakeBoxDXDYDZ0</tonode><toport>theDY</toport>
+      <value><double>10</double></value>
+   </parameter>
+   <parameter>
+      <tonode>MakeBoxDXDYDZ0</tonode><toport>theDZ</toport>
+      <value><double>10</double></value>
+   </parameter>
+   <presentation name="s20" x="298.75" y="32" width="158" height="63" expanded="1" expx="298.75" expy="32" expWidth="158" expHeight="63" shownState="0"/>
+   <presentation name="MakeBoxDXDYDZ0" x="1.75" y="46.25" width="158" height="117" expanded="1" expx="1.75" expy="46.25" expWidth="158" expHeight="117" shownState="0"/>
+   <presentation name="StudyOutNode2" x="296.75" y="104.25" width="158" height="63" expanded="1" expx="296.75" expy="104.25" expWidth="158" expHeight="63" shownState="0"/>
+   <presentation name="__ROOT__" x="0" y="0" width="460.75" height="171.25" expanded="1" expx="0" expy="0" expWidth="460.75" expHeight="171.25" shownState="0"/>
+</proc>
index 91bab878122f517ff8cc6cf20959cfb314f557a4..4df681703cd1e5b2bd11fb6d558fa36ce1a031f8 100644 (file)
@@ -1,12 +1,41 @@
-recursive-include Examples/fort1 *.f components.py coupling.xml Makefile README.txt
-recursive-include Examples/cpp1 components.py coupling.xml README.txt
-recursive-include Examples/pyth1 *.py coupling.xml README.txt
-recursive-include Examples/fort2 *.f components.py coupling.xml Makefile README.txt
-recursive-include Examples/cpp2 components.py coupling.xml README.txt Makefile prog.cxx
-recursive-include Examples/pyth2 components.py coupling.xml README.txt
-recursive-include Examples/ast1 components.py coupling.xml f.comm README.txt
-recursive-include Examples/ast1/fcompo compo.f Makefile
-recursive-include Examples/ast1/myaster Makefile make_cata src/*.f catalo/*.capy
-recursive-include Examples/ast2 components.py coupling.xml f.comm README.txt
-recursive-include Examples/ast2/fcompo compo.f Makefile
-recursive-include Examples/ast2/myaster Makefile make_exec config.txt src/*.f catalo/*.capy
+# Copyright (C) 2009-2012  EDF R&D
+#
+# 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
+#
+
+include Examples/context.py
+include Examples/makefile.inc
+include Examples/*/*.f
+include Examples/*/*.py
+include Examples/*/*.cxx
+include Examples/*/*.h
+include Examples/*/*.png
+include Examples/*/*.ui
+include Examples/*/*.rst
+include Examples/*/coupling.xml
+include Examples/*/Makefile
+include Examples/*/README.txt
+include Examples/*/f.comm
+include Examples/ast*/fcompo/compo.f
+include Examples/ast*/fcompo/Makefile
+include Examples/ast*/myaster/src/*.f
+include Examples/ast*/myaster/catalo/*.capy
+include Examples/ast*/myaster/Makefile
+include Examples/ast1/myaster/make_cata
+include Examples/ast2/myaster/make_exec
+include Examples/ast2/myaster/config.txt
+include Examples/ast2/exeaster
index 42d4722d15feafbcfa6afea2e0757072a205a53a..e27e3a734585344a543197a5adbd658894e97e87 100644 (file)
@@ -1,10 +1,34 @@
+# Copyright (C) 2009-2012  EDF R&D
+#
+# 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
+#
+
 """
-  Pacakge to generate SALOME modules with components
-  implemented in C++, Fortran or Python
-  that can use datastream ports 
+The python module module_generator defines classes which can be used to define a SALOME module, its components and
+generates a SALOME source module, its installation and a SALOME application including this module and
+other preexisting SALOME modules like GEOM, SMESH or others.
 """
 from gener import Module, Service, Generator
 from fcompo import F77Component
 from cppcompo import CPPComponent
+from pacocompo import PACOComponent
 from pycompo import PYComponent
 from astcompo import ASTERComponent
+from hxxcompo import HXX2SALOMEComponent
+from hxxparacompo import HXX2SALOMEParaComponent
+from yacstypes import add_type
+from salomemodules import add_module
index 181f3dbb864f2ce02b4ed5a4f6ca55c96aa0bfd2..3393b38bd1a2f761118c234ddb7c0c5bd66735c6 100644 (file)
-import re, os
+# Copyright (C) 2009-2012  EDF R&D
+#
+# 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
+#
+
+"""
+  This module defines the ASTERComponent class for ASTER component generation
+  An ASTER component comes in 3 flavors :
+   - implemented as a dynamic library (kind='lib')
+   - implemented as a standalone component (kind='exe')
+   - implemented as a specific container (kind='cexe')
+"""
+import re, os, sys
 
 from gener import Component, Invalid, makedirs
 
 from pyth_tmpl import pyinitEXEService, pyinitCEXEService, pyinitService
+import aster_tmpl
 from aster_tmpl import asterCEXEService, asterEXEService
 from aster_tmpl import asterService, asterEXECompo, asterCEXECompo, asterCompo
-from aster_tmpl import asterexeMakefile, astercexeMakefile, astercompoMakefile
 from aster_tmpl import comm, make_etude, cexe, exeaster
 from aster_tmpl import container, component
 
 class ASTERComponent(Component):
+  """
+   A :class:`ASTERComponent` instance represents an ASTER SALOME component (special component for Code_Aster that is a mix of
+   Fortran and Python code) with services given as a list of :class:`Service` instances with the parameter *services*.
+
+   :param name: gives the name of the component.
+   :type name: str
+   :param services: the list of services (:class:`Service`) of the component.
+   :param kind: If it is given and has the value "exe", the component will be built as a standalone
+      component (executable or shell script). The default is to build the component as a dynamic library.
+   :param libs: gives all the libraries options to add when linking the generated component (-L...).
+   :param rlibs: gives all the runtime libraries options to add when linking the generated component (-R...).
+   :param exe_path: is only used when kind is "exe" and gives the path to the standalone component.
+   :param aster_dir: gives the Code_Aster installation directory.
+   :param python_path: If it is given (as a list of paths), all the paths are added to the python path (sys.path).
+   :param argv: is a list of strings that gives the command line parameters for Code_Aster. This parameter is only useful when
+      kind is "lib".
+
+   For example, the following call defines a Code_Aster component named "mycompo" with one service s1 (it must have been defined before).
+   This standalone component takes some command line arguments::
+
+      >>> c1 = module_generator.ASTERComponent('mycompo', services=[s1,], kind="exe",
+                                                          exe_path="launch.sh",
+                                                          argv=["-memjeveux","4"])
+  """
   def __init__(self, name, services=None, libs="", rlibs="", aster_dir="", 
-                     python_path=None, argv=None, kind="lib", exe_path=None,
-                     asrun=None, export_extras=""):
+                     python_path=None, argv=None, kind="lib", exe_path=None):
+    """initialise component attributes"""
     self.aster_dir = aster_dir
     self.python_path = python_path or []
     self.argv = argv or []
     self.exe_path = exe_path
-    self.asrun = asrun
-    self.export_extras = export_extras
     Component.__init__(self, name, services, impl="ASTER", libs=libs, 
                              rlibs=rlibs, kind=kind)
 
   def validate(self):
+    """validate the component definition"""
     Component.validate(self)
     if not self.aster_dir:
       raise Invalid("aster_dir must be defined for component %s" % self.name)
 
     kinds = ("lib", "cexe", "exe")
     if self.kind not in kinds:
-      raise Invalid("kind must be one of %s" % kinds)
+      raise Invalid("kind must be one of %s for component %s" % (kinds,self.name))
     if self.kind == "lib" and not self.python_path:
       raise Invalid("python_path must be defined for component %s" % self.name)
     if self.kind == "cexe" :
       if not self.exe_path:
         raise Invalid("exe_path must be defined for component %s" % self.name)
-      if not self.asrun:
-        raise Invalid("asrun must be defined for component %s" % self.name)
-      if not os.path.exists(self.asrun):
-        raise Invalid("asrun does not exist for component %s" % self.name)
     if self.kind == "exe" :
       if not self.exe_path:
         raise Invalid("exe_path must be defined for component %s" % self.name)
-      if not self.asrun:
-        raise Invalid("asrun must be defined for component %s" % self.name)
-      if not os.path.exists(self.asrun):
-        raise Invalid("asrun does not exist for component %s" % self.name)
 
+    #Si un port de nom jdc n'est pas defini dans la liste des inports du service,
+    #on en ajoute un de type string en premiere position
     for serv in self.services:
-      #on ajoute un inport string de nom jdc en premier dans la liste des ports de chaque service
-      serv.inport.insert(0, ("jdc", "string"))
+      found=False
+      for port_name,port_type in serv.inport:
+        if port_name == "jdc":
+          found=True
+          break
+      if not found:
+        serv.inport.insert(0, ("jdc", "string"))
 
   def makeCompo(self, gen):
+    """drive the generation of SALOME module files and code files
+       depending on the choosen component kind
+    """
     filename = "%s.py" % self.name
     #on suppose que les composants ASTER sont homogenes (utilisent meme install)
     gen.aster = self.aster_dir
+
+    #get ASTER version
+    f = os.path.join(self.aster_dir, "bibpyt", 'Accas', 'properties.py')
+    self.version=(0,0,0)
+    if os.path.isfile(f):
+      mydict = {}
+      execfile(f, mydict)
+      v,r,p = mydict['version'].split('.')
+      self.version=(int(v),int(r),int(p))
+
     if self.kind == "lib":
-      return {"Makefile.am":astercompoMakefile.substitute(module=gen.module.name, 
-                                                          component=self.name),
-             filename:self.makeaster(gen)}
+      return {"Makefile.am":gen.makeMakefile(self.getMakefileItems(gen)),
+              filename:self.makeaster(gen)}
     elif self.kind == "cexe":
-      #creation de l'installation aster dans exe_path
-      self.makecexepath(gen)
-      return {"Makefile.am":astercexeMakefile.substitute(module=gen.module.name, 
-                                                         component=self.name),
-             filename:self.makecexeaster(gen)}
+      fdict=self.makecexepath(gen)
+      d= {"Makefile.am":gen.makeMakefile(self.getMakefileItems(gen)),
+           self.name+".exe":cexe.substitute(compoexe=self.exe_path),
+           filename:self.makecexeaster(gen)
+         }
+      d.update(fdict)
+      return d
     elif self.kind == "exe":
-      #creation de l'installation aster dans exe_path
-      self.makeexepath(gen)
-      return {"Makefile.am":asterexeMakefile.substitute(module=gen.module.name, 
-                                                        component=self.name),
-               self.name+".exe":exeaster.substitute(export=os.path.join(self.exe_path, "make_etude.export"), asrun=self.asrun),
-               self.name+"_module.py":self.makeexeaster(gen)}
+      fdict=self.makeexepath(gen)
+      d= {"Makefile.am":gen.makeMakefile(self.getMakefileItems(gen)),
+           self.name+".exe":exeaster.substitute(compoexe=self.exe_path),
+           self.name+"_module.py":self.makeexeaster(gen)
+         }
+      d.update(fdict)
+      return d
+
+  def getMakefileItems(self,gen):
+    makefileItems={"header":"include $(top_srcdir)/adm_local/make_common_starter.am"}
+    if self.kind == "lib":
+      makefileItems["salomepython_PYTHON"]=[self.name+".py"]
+    elif self.kind == "exe":
+      makefileItems["salomepython_PYTHON"]=[self.name+"_module.py",self.name+"_component.py"]
+      if self.version < (10,1,2):
+        makefileItems["salomepython_PYTHON"].append("E_SUPERV.py")
+      makefileItems["dist_salomescript_SCRIPTS"]=[self.name+".exe"]
+      makefileItems["salomeres_DATA"]=[self.name+"_config.txt"]
+    elif self.kind == "cexe":
+      makefileItems["salomepython_PYTHON"]=[self.name+".py",self.name+"_container.py"]
+      if self.version < (10,1,2):
+        makefileItems["salomepython_PYTHON"].append("E_SUPERV.py")
+      makefileItems["dist_salomescript_SCRIPTS"]=[self.name+".exe"]
+      makefileItems["salomeres_DATA"]=[self.name+"_config.txt"]
+    return makefileItems
+
 
   def makeexepath(self, gen):
-    makedirs(self.exe_path)
-    #patch to E_SUPERV.py
-    fil = open(os.path.join(self.aster_dir, "bibpyt", "Execution", "E_SUPERV.py"))
-    esuperv = fil.read()
-    esuperv = re.sub("j=self.JdC", "self.jdc=j=self.JdC", esuperv)
-    fil.close()
-    #utilisation d'un programme principal python different
+    """standalone component: generate files for calculation code"""
+
+    fdict={}
+
+    if self.version < (10,1,2):
+      #patch to E_SUPERV.py
+      fil = open(os.path.join(self.aster_dir, "bibpyt", "Execution", "E_SUPERV.py"))
+      esuperv = fil.read()
+      fil.close()
+      esuperv = re.sub("def Execute\(self\)", "def Execute(self, params)", esuperv)
+      esuperv = re.sub("j=self.JdC", "self.jdc=j=self.JdC", esuperv)
+      esuperv = re.sub("\*\*args", "context_ini=params, **args", esuperv)
+      esuperv = re.sub("def main\(self\)", "def main(self,params={})", esuperv)
+      esuperv = re.sub("return self.Execute\(\)", "return self.Execute(params)", esuperv)
+      fdict["E_SUPERV.py"]=esuperv
+
+    #use a specific main program (modification of config.txt file)
     fil = open(os.path.join(self.aster_dir, "config.txt"))
     config = fil.read()
-    config = re.sub("Execution\/E_SUPERV.py", os.path.join(self.exe_path, "aster_component.py"), config)
     fil.close()
+    config = re.sub(" profile.sh", os.path.join(self.aster_dir, "profile.sh"), config)
 
-    gen.makeFiles({
-                   "aster_component.py":component.substitute(component=self.name),
-                   "make_etude.export":make_etude.substitute(config=os.path.join(self.exe_path, "config.txt"),
-                                                             comm=os.path.join(self.exe_path, self.name+".comm"),
-                                                             extras=self.export_extras),
-                   self.name+".comm":comm,
-                   "config.txt":config,
-                   "profile.sh":os.path.join(self.aster_dir, "profile.sh"),
-                   "E_SUPERV.py":esuperv,
-                  }, self.exe_path)
+    path=os.path.join(os.path.abspath(gen.module.prefix),'lib',
+                      'python%s.%s' % (sys.version_info[0], sys.version_info[1]),
+                      'site-packages','salome','%s_component.py'%self.name)
+    config = re.sub("Execution\/E_SUPERV.py", path, config)
+    config += "ENV_SH         | env      | -    | " + self.prerequisites + "\n"
+
+    fdict["%s_config.txt" % self.name] = config
+    fdict["%s_component.py" % self.name] = component.substitute(component=self.name)
+
+    return fdict
 
   def makecexepath(self, gen):
-    makedirs(self.exe_path)
-    #patch to E_SUPERV.py
-    fil = open(os.path.join(self.aster_dir, "bibpyt", "Execution", "E_SUPERV.py"))
-    esuperv = fil.read()
-    esuperv = re.sub("j=self.JdC", "self.jdc=j=self.JdC", esuperv)
-    fil.close()
-    #utilisation d'un programme principal python different
+    """specific container: generate files"""
+
+    fdict={}
+
+    if self.version < (10,1,2):
+      #patch to E_SUPERV.py
+      fil = open(os.path.join(self.aster_dir, "bibpyt", "Execution", "E_SUPERV.py"))
+      esuperv = fil.read()
+      fil.close()
+      esuperv = re.sub("def Execute\(self\)", "def Execute(self, params)", esuperv)
+      esuperv = re.sub("j=self.JdC", "self.jdc=j=self.JdC", esuperv)
+      esuperv = re.sub("\*\*args", "context_ini=params, **args", esuperv)
+      esuperv = re.sub("def main\(self\)", "def main(self,params={})", esuperv)
+      esuperv = re.sub("return self.Execute\(\)", "return self.Execute(params)", esuperv)
+      fdict["E_SUPERV.py"]=esuperv
+
+    #use a specific main program
     fil = open(os.path.join(self.aster_dir, "config.txt"))
     config = fil.read()
-    config = re.sub("Execution\/E_SUPERV.py", os.path.join(self.exe_path, "aster_container.py"), config)
     fil.close()
-    gen.makeFiles({self.name+".exe":cexe.substitute(export=os.path.join(self.exe_path, "make_etude.export"),
-                                                    asrun=self.asrun),
-                   "aster_container.py":container,
-                   "make_etude.export":make_etude.substitute(config=os.path.join(self.exe_path, "config.txt"),
-                                                             comm=os.path.join(self.exe_path, self.name+".comm"),
-                                                             extras=self.export_extras),
-                   self.name+".comm":comm,
-                   "config.txt":config,
-                   "profile.sh":os.path.join(self.aster_dir, "profile.sh"),
-                   "E_SUPERV.py":esuperv,
-                  }, self.exe_path)
-    #make exe executable
-    os.chmod(os.path.join(self.exe_path, self.name+".exe"), 0777)
+    config = re.sub(" profile.sh", os.path.join(self.aster_dir, "profile.sh"), config)
+    path=os.path.join(os.path.abspath(gen.module.prefix),'lib',
+                      'python%s.%s' % (sys.version_info[0], sys.version_info[1]),
+                      'site-packages','salome','%s_container.py' % self.name)
+    config = re.sub("Execution\/E_SUPERV.py", path, config)
+    config += "ENV_SH         | env      | -    | " + self.prerequisites + "\n"
+
+    fdict["%s_container.py" % self.name] = container
+    fdict["%s_config.txt" % self.name] = config
+
+    return fdict
 
   def makeexeaster(self, gen):
+    """standalone component: generate SALOME component source"""
     services = []
     inits = []
     defs = []
@@ -132,6 +232,7 @@ class ASTERComponent(Component):
       params = []
       datas = []
       for name, typ in serv.inport:
+        if typ=="file":continue #files are not passed through service interface
         params.append(name)
         if typ == "pyobj":
           datas.append('"%s":cPickle.loads(%s)' % (name, name))
@@ -145,6 +246,7 @@ class ASTERComponent(Component):
       params = []
       datas = []
       for name, typ in serv.outport:
+        if typ=="file":continue #files are not passed through service interface
         params.append(name)
         if typ == "pyobj":
           datas.append('cPickle.dumps(j.g_context["%s"],-1)'%name)
@@ -153,11 +255,11 @@ class ASTERComponent(Component):
       outparams = ",".join(params)
       rvars = ",".join(datas)
 
-      service = asterEXEService.substitute(component=self.name, 
-                                           service=serv.name, 
+      service = asterEXEService.substitute(component=self.name,
+                                           service=serv.name,
                                            inparams=inparams,
-                                           outparams=outparams, 
-                                           body=serv.body, 
+                                           outparams=outparams,
+                                           body=serv.body,
                                            dvars=dvars, rvars=rvars)
       streams = []
       for name, typ, dep in serv.instream:
@@ -172,13 +274,24 @@ class ASTERComponent(Component):
                                          instream=instream, outstream=outstream)
       services.append(service)
       inits.append(init)
+
+    if self.version < (10,1,2):
+      importesuperv="from E_SUPERV import SUPERV"
+    else:
+      importesuperv="""sys.path=["%s"]+sys.path
+from Execution.E_SUPERV import SUPERV
+""" % os.path.join(self.aster_dir, "bibpyt")
+
     return asterEXECompo.substitute(component=self.name, module=gen.module.name,
-                                    servicesdef="\n".join(defs), 
-                                    servicesimpl="\n".join(services), 
+                                    servicesdef="\n".join(defs),
+                                    servicesimpl="\n".join(services),
                                     initservice='\n'.join(inits),
-                                    aster_dir=self.aster_dir)
+                                    aster_dir=self.aster_dir,
+                                    importesuperv=importesuperv,
+                                    )
 
   def makecexeaster(self, gen):
+    """specific container: generate SALOME component source"""
     services = []
     inits = []
     defs = []
@@ -187,6 +300,7 @@ class ASTERComponent(Component):
       params = []
       datas = []
       for name, typ in serv.inport:
+        if typ=="file":continue #files are not passed through service interface
         params.append(name)
         if typ == "pyobj":
           datas.append('"%s":cPickle.loads(%s)' % (name, name))
@@ -208,11 +322,11 @@ class ASTERComponent(Component):
       outparams = ",".join(params)
       rvars = ",".join(datas)
 
-      service = asterCEXEService.substitute(component=self.name, 
-                                            service=serv.name, 
+      service = asterCEXEService.substitute(component=self.name,
+                                            service=serv.name,
                                             inparams=inparams,
-                                            outparams=outparams, 
-                                            body=serv.body, 
+                                            outparams=outparams,
+                                            body=serv.body,
                                             dvars=dvars, rvars=rvars)
       streams = []
       for name, typ, dep in serv.instream:
@@ -229,19 +343,31 @@ class ASTERComponent(Component):
                                           outstream=outstream)
       services.append(service)
       inits.append(init)
+
+    if self.version < (10,1,2):
+      importesuperv="from E_SUPERV import SUPERV"
+    else:
+      importesuperv="""sys.path=["%s"] +sys.path
+from Execution.E_SUPERV import SUPERV
+""" % os.path.join(self.aster_dir, "bibpyt")
+
     return asterCEXECompo.substitute(component=self.name, 
                                      module=gen.module.name,
                                      servicesdef="\n".join(defs), 
                                      servicesimpl="\n".join(services), 
                                      initservice='\n'.join(inits),
-                                     aster_dir=self.aster_dir)
+                                     aster_dir=self.aster_dir,
+                                     importesuperv=importesuperv,
+                                     )
+
   def getImpl(self):
     if self.kind == "cexe":
-      return "CEXE", os.path.join(self.exe_path, self.name+".exe")
+      return "CEXE", self.name+".exe"
     else:
       return "SO", ""
 
   def makeaster(self, gen):
+    """library component: generate SALOME component source"""
     services = []
     inits = []
     defs = []
@@ -250,6 +376,7 @@ class ASTERComponent(Component):
       params = []
       datas = []
       for name, typ in serv.inport:
+        if typ=="file":continue #files are not passed through service interface
         params.append(name)
         if typ == "pyobj":
           datas.append('"%s":cPickle.loads(%s)' % (name, name))
index b00658cdafb41c8be6c688b7353af5cdd7d71b1d..7946e860a3933970444a06f22296deac63e04097 100644 (file)
@@ -1,26 +1,30 @@
+# Copyright (C) 2009-2012  EDF R&D
+#
+# 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
+#
 
 try:
  from string import Template
 except:
  from compat import Template,set
 
-astercompoMakefile="""include $$(top_srcdir)/adm_local/make_common_starter.am
-salomepython_PYTHON = ${component}.py
-
-"""
-astercompoMakefile=Template(astercompoMakefile)
-astercexeMakefile=astercompoMakefile
-
-asterexeMakefile="""include $$(top_srcdir)/adm_local/make_common_starter.am
-salomepython_PYTHON = ${component}_module.py
-# These files are executable scripts
-dist_salomescript_SCRIPTS= ${component}.exe
-"""
-asterexeMakefile=Template(asterexeMakefile)
-
 asterCompo="""
 import sys,traceback,os
-import ${module}__POA
+import ${module}_ORB__POA
 import calcium
 import dsccalcium
 import SALOME
@@ -44,15 +48,14 @@ except:
 ${servicesdef}
 #ENDDEF
 
-class ${component}(${module}__POA.${component},dsccalcium.PyDSCComponent,SUPERV):
+class ${component}(${module}_ORB__POA.${component},dsccalcium.PyDSCComponent,SUPERV):
   '''
      To be identified as a SALOME component this Python class
      must have the same name as the component, inherit omniorb
-     class ${module}__POA.${component} and DSC class dsccalcium.PyDSCComponent
+     class ${module}_ORB__POA.${component} and DSC class dsccalcium.PyDSCComponent
      that implements DSC API.
   '''
   def __init__ ( self, orb, poa, contID, containerName, instanceName, interfaceName ):
-    print "${component}.__init__: ", containerName, ';', instanceName,interfaceName
     dsccalcium.PyDSCComponent.__init__(self, orb, poa,contID,containerName,instanceName,interfaceName)
     self.argv=[${argv}]
     #modif pour aster 9.0
@@ -75,12 +78,12 @@ asterCompo=Template(asterCompo)
 asterCEXECompo="""
 import sys,traceback,os
 import string
-import ${module}__POA
+import ${module}_ORB__POA
 import calcium
 import dsccalcium
 import SALOME
 import linecache
-from E_SUPERV import SUPERV
+${importesuperv}
 
 try:
   import numpy
@@ -91,15 +94,17 @@ except:
 ${servicesdef}
 #ENDDEF
 
-class ${component}(${module}__POA.${component},dsccalcium.PyDSCComponent,SUPERV):
+class ExecutionError(Exception):
+  '''General exception during execution'''
+
+class ${component}(${module}_ORB__POA.${component},dsccalcium.PyDSCComponent,SUPERV):
   '''
      To be identified as a SALOME component this Python class
      must have the same name as the component, inherit omniorb
-     class ${module}__POA.${component} and DSC class dsccalcium.PyDSCComponent
+     class ${module}_ORB__POA.${component} and DSC class dsccalcium.PyDSCComponent
      that implements DSC API.
   '''
   def __init__ ( self, orb, poa, contID, containerName, instanceName, interfaceName ):
-    print "${component}.__init__: ", containerName, ';', instanceName,interfaceName
     self.init=0
     dsccalcium.PyDSCComponent.__init__(self, orb, poa,contID,containerName,instanceName,interfaceName)
 
@@ -107,12 +112,24 @@ class ${component}(${module}__POA.${component},dsccalcium.PyDSCComponent,SUPERV)
 ${initservice}
     return False
 
+  def interpstring(self,text,args):
+    try:
+      self.jdc.g_context.update(args)
+      CONTEXT.set_current_step(self.jdc)
+      linecache.cache['<string>']=0,None,string.split(text,'\\n'),'<string>'
+      exec text in self.jdc.const_context,self.jdc.g_context
+      CONTEXT.unset_current_step()
+    except EOFError:
+      CONTEXT.unset_current_step()
+    except:
+      CONTEXT.unset_current_step()
+      raise
+
 ${servicesimpl}
 """
 
 asterEXECompo=asterCEXECompo+"""
   def destroy(self):
-     dsccalcium.PyDSCComponent.destroy(self)
      self._orb.shutdown(0)
 """
 
@@ -121,7 +138,6 @@ asterEXECompo=Template(asterEXECompo)
 
 asterService="""
   def ${service}(self,${inparams}):
-    print "${component}.${service}"
     self.beginService("${component}.${service}")
     self.jdc=Cata.cata.JdC(procedure=jdc,cata=Cata.cata,nom="Salome",context_ini=${dvars})
     j=self.jdc
@@ -180,12 +196,11 @@ asterService="""
        print ">> JDC.py : FIN RAPPORT"
        sys.stdout.flush()
        raise SALOME.SALOME_Exception(SALOME.ExceptionStruct(SALOME.BAD_PARAM,msg+'\\n'+str(j.cr), "${component}.py",0))
-       
+
     if j.par_lot == 'NON':
        print "FIN EXECUTION"
-       err=calcium.cp_fin(self.proxy,calcium.CP_ARRET)
+       #err=calcium.cp_fin(self.proxy,calcium.CP_ARRET)
        #retour sans erreur (il faut pousser les variables de sortie)
-       print "End of ${component}.${service}"
        sys.stdout.flush()
        self.endService("${component}.${service}")
        return ${rvars}
@@ -216,8 +231,7 @@ asterService="""
           raise SALOME.SALOME_Exception(SALOME.ExceptionStruct(SALOME.BAD_PARAM,msg+'\\n'+str(j.cr),"${component}.py",0))
        else:
          #retour sans erreur (il faut pousser les variables de sortie)
-         err=calcium.cp_fin(self.proxy,calcium.CP_ARRET)
-         print "End of ${component}.${service}"
+         #err=calcium.cp_fin(self.proxy,calcium.CP_ARRET)
          sys.stdout.flush()
          self.endService("${component}.${service}")
          return ${rvars}
@@ -232,29 +246,35 @@ asterService=Template(asterService)
 
 asterCEXEService="""
   def ${service}(self,${inparams}):
-    print "${component}.${service}"
     self.beginService("${component}.${service}")
-    if not self.init:
-      self.init=1
-      ier=self.main()
-    j=self.jdc
-    self.jdc.g_context.update(${dvars})
     try:
-      CONTEXT.set_current_step(self.jdc)
-      linecache.cache['<string>']=0,0,string.split(jdc,'\\n'),'<string>'
-      exec jdc in self.jdc.g_context
-      CONTEXT.unset_current_step()
-      self.endService("${component}.${service}")
-    except EOFError:
+      args=${dvars}
+      if not args.has_key("jdc"):
+        fcomm=open("jdc",'r')
+        jdc=fcomm.read()
+        fcomm.close()
+        #args["jdc"]=jdc
+      if not self.init:
+        self.init=1
+        fcomm=open("fort.1",'w')
+        fcomm.write(jdc)
+        fcomm.close()
+        ier=self.main(args)
+        if ier != 0:
+          raise ExecutionError("Error in initial execution")
+      else:
+        self.interpstring(jdc,args)
+
       self.endService("${component}.${service}")
+      j=self.jdc
+      return ${rvars}
     except:
-      sys.stdout.flush()
       exc_typ,exc_val,exc_fr=sys.exc_info()
       l=traceback.format_exception(exc_typ,exc_val,exc_fr)
       self.endService("${component}.${service}")
-      CONTEXT.unset_current_step()
+      sys.stdout.flush()
+      sys.stderr.flush()
       raise SALOME.SALOME_Exception(SALOME.ExceptionStruct(SALOME.BAD_PARAM,"".join(l),"${component}.py",0))
-    return ${rvars}
 """
 asterCEXEService=Template(asterCEXEService)
 asterEXEService=asterCEXEService
@@ -339,14 +359,7 @@ cexe="""#!/bin/sh
 
 export SALOME_CONTAINERNAME=$$1
 
-cp ${export} temp.export
-cat >> temp.export << END
-F mess $$PWD/messages R 6
-F resu $$PWD/resu R 8
-F erre $$PWD/erre R 9
-END
-
-${asrun} temp.export
+${compoexe}
 """
 cexe=Template(cexe)
 
@@ -356,14 +369,7 @@ export SALOME_CONTAINER=$$1
 export SALOME_CONTAINERNAME=$$2
 export SALOME_INSTANCE=$$3
 
-cp ${export} temp.export
-cat >> temp.export << END
-F mess $$PWD/messages R 6
-F resu $$PWD/resu R 8
-F erre $$PWD/erre R 9
-END
-
-${asrun} temp.export
+${compoexe}
 """
 exeaster=Template(exeaster)
 
index cce5dcfeaef508f68d833a856e2f4c3cb6edae75..f3a29cecbac1bef8ccfca63813947978c5607a38 100644 (file)
@@ -1,3 +1,22 @@
+# Copyright (C) 2009-2012  EDF R&D
+#
+# 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
+#
+
 try:
   from string import Template
 except:
@@ -11,12 +30,19 @@ idl="""
 
 #include "DSC_Engines.idl"
 #include "SALOME_Exception.idl"
+#include "SALOME_PACOExtension.idl"
+#include "SALOME_Component.idl"
+#include "SALOME_Comm.idl"
+#include "SALOME_Parametric.idl"
+
+${idldefs}
 
-module ${module}
+module ${module}_ORB
 {
 typedef sequence<string> stringvec;
 typedef sequence<double> dblevec;
 typedef sequence<long> intvec;
+typedef Engines::dataref dataref;
 
 ${interfaces}
 };
@@ -26,48 +52,96 @@ ${interfaces}
 idl=Template(idl)
 
 interface="""
-  interface ${component}:Engines::Superv_Component
+  interface ${component}:${inheritedinterface} Engines::Superv_Component
   {
 ${services}
   };
 """
 interface=Template(interface)
 
+parallel_interface="""
+interface ${component} : Engines::Parallel_DSC
+  {
+${services}
+  };
+"""
+parallel_interface=Template(parallel_interface)
+
+xml="""\
+<?xml version="1.0"?>
+<!-- YACSGEN -->
+
+<PaCO_Interface_description>
+  <Module>
+    <Name>${module}_ORB</Name>
+${interfaces}
+  </Module>
+</PaCO_Interface_description>
+"""
+xml = Template(xml)
+
+xml_interface="""\
+    <Interface>
+      <Name>${component}</Name>
+${xml_services}
+    </Interface>"""
+xml_interface = Template(xml_interface)
+
+xml_service = """\
+      <Method>
+        <Name>${service_name}</Name>
+        <Type>distributed</Type>
+      </Method>"""
+xml_service = Template(xml_service)
+
 idlMakefile="""
 include $$(top_srcdir)/adm_local/make_common_starter.am
 
-BUILT_SOURCES = ${module}SK.cc
-IDL_FILES=${module}.idl
-
-lib_LTLIBRARIES = lib${module}.la
-salomeidl_DATA = $$(IDL_FILES)
-salomepython_DATA = ${module}_idl.py
-lib${module}_la_SOURCES      =
-nodist_lib${module}_la_SOURCES = ${module}SK.cc
-nodist_salomeinclude_HEADERS= ${module}.hh
-lib${module}_la_CXXFLAGS     = -I.  $$(KERNEL_INCLUDES)
-lib${module}_la_LIBADD     = $$(KERNEL_LIBS)
+BUILT_SOURCES = ${module}SK.cc ${PACO_BUILT_SOURCES} ${other_sks}
+IDL_FILES=${module}.idl ${other_idls}
+
+lib_LTLIBRARIES = libSalomeIDL${module}.la
+salomeidl_DATA = $$(IDL_FILES) ${PACO_salomeidl_DATA}
+libSalomeIDL${module}_la_SOURCES      =
+nodist_libSalomeIDL${module}_la_SOURCES = ${module}SK.cc ${other_sks}
+nodist_salomeinclude_HEADERS= ${module}.hh ${PACO_SALOMEINCLUDE_HEADERS}
+libSalomeIDL${module}_la_CXXFLAGS     = -I.  $$(SALOME_INCLUDES)
+libSalomeIDL${module}_la_LIBADD     = $$(SALOME_IDL_LIBS)
 ##########################################################
 %SK.cc %.hh : %.idl
-\t$$(OMNIORB_IDL) -bcxx $$(IDLCXXFLAGS) $$(OMNIORB_IDLCXXFLAGS) $$(IDL_INCLUDES) $$<
+\t$$(OMNIORB_IDL) -bcxx $$(OMNIORB_IDLCXXFLAGS) $$(IDL_INCLUDES) $$<
 %_idl.py : %.idl
-\t$$(OMNIORB_IDL) -bpython $$(IDL_INCLUDES) $$<
+\t$$(OMNIORB_IDL) $$(OMNIORB_IDLPYFLAGS) $$(IDL_INCLUDES) ${PACO_INCLUDES} $$<
+%PaCO.hxx %PaCO.cxx : %.idl %.xml
+\t$$(OMNIORB_IDL) -I@KERNEL_ROOT_DIR@/idl/salome -p@PACOPATH@/lib/python -bpaco -Wb$$(top_srcdir)/idl/$$*.xml,$$(srcdir):@PACOPATH@/idl:@KERNEL_ROOT_DIR@/idl/salome $$(top_srcdir)/idl/$$*.idl
 
-CLEANFILES = *.hh *SK.cc *.py
+CLEANFILES = *.hh *SK.cc *.py *.hxx *.cxx
 
-clean-local:
-\trm -rf ${module} ${module}__POA
+EXTRA_DIST = $$(IDL_FILES)
 
-install-data-local:
-\t$${mkinstalldirs} $$(DESTDIR)$$(salomepythondir)
-\tcp -R ${module} ${module}__POA $$(DESTDIR)$$(salomepythondir)
+install-data-local: $$(IDL_FILES)
+\t$$(INSTALL) -d  $$(DESTDIR)$$(salomepythondir)
+\tls $$^ | while read file; do \\
+\t$$(OMNIORB_IDL) $$(OMNIORB_IDLPYFLAGS) $$(IDL_INCLUDES) -C$$(DESTDIR)$$(salomepythondir) $$$$file ; \\
+\tdone
 
 uninstall-local:
-\trm -rf $$(DESTDIR)$$(salomepythondir)/${module}
-\trm -rf $$(DESTDIR)$$(salomepythondir)/${module}__POA
+\trm -rf $$(DESTDIR)$$(salomepythondir)/*
+
 """
 idlMakefile=Template(idlMakefile)
 
+# PACO Part
+idlMakefilePaCO_BUILT_SOURCES = "${module}PaCO.cxx "
+idlMakefilePaCO_nodist_salomeinclude_HEADERS = "${module}PaCO.hxx "
+idlMakefilePaCO_BUILT_SOURCES = Template(idlMakefilePaCO_BUILT_SOURCES)
+idlMakefilePaCO_nodist_salomeinclude_HEADERS = Template(idlMakefilePaCO_nodist_salomeinclude_HEADERS)
+idlMakefilePACO_INCLUDES = "-I@PACOPATH@/idl"
+idlMakefilePACO_salomepython_DATA = "${module}PaCO_idl.py"
+idlMakefilePACO_salomepython_DATA = Template(idlMakefilePACO_salomepython_DATA)
+idlMakefilePACO_salomeidl_DATA = "${module}PaCO.idl"
+idlMakefilePACO_salomeidl_DATA = Template(idlMakefilePACO_salomeidl_DATA)
+
 #SALOME catalog
 
 catalog="""<?xml version='1.0' encoding='us-ascii' ?>
@@ -83,6 +157,7 @@ catalog="""<?xml version='1.0' encoding='us-ascii' ?>
 <!-- Commonly used types  -->
 <type-list>
   <objref name="pyobj" id="python:obj:1.0"/>
+  <objref name="file" id="file"/>
 </type-list>
 
 <!-- Component list -->
@@ -161,3 +236,14 @@ cataOutStream="""                       <outParameter>
                        </outParameter>"""
 cataOutStream=Template(cataOutStream)
 
+cataInParallelStream="""                       <inParameter>
+                          <inParameter-name>${name}</inParameter-name>
+                          <inParameter-type>${type}</inParameter-type>
+                       </inParameter>"""
+cataInParallelStream=Template(cataInParallelStream)
+
+cataOutParallelStream="""                       <outParameter>
+                          <outParameter-name>${name}</outParameter-name>
+                          <outParameter-type>${type}</outParameter-type>
+                       </outParameter>"""
+cataOutParallelStream=Template(cataOutParallelStream)
index f4c5bf9c9fcf226efc4c6d524c4a12f6b7d3f4d4..672b33dde2d5475b32b0cc5fb9b36464669d7023 100644 (file)
-#!/usr/bin/env python\r
-#coding: iso-8859-15\r
-#\r
-# Copyright (C) 2005  Gaëtan Lehmann <gaetan.lehmann@jouy.inra.fr>\r
-#\r
-# this file is part of uptodate\r
-#\r
-# This program is free software; you can redistribute it and/or\r
-# modify it under the terms of the GNU General Public License\r
-# as published by the Free Software Foundation; either version 2\r
-# of the License, or (at your option) any later version.\r
-#\r
-# This program is distributed in the hope that it will be useful,\r
-# but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-# GNU General Public License for more details.\r
-#\r
-# You should have received a copy of the GNU General Public License\r
-# along with this program; if not, write to the Free Software\r
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.\r
-#\r
-\r
-# this module sets python 2.3 compatibility\r
-\r
-\r
-# python 2.4 now have set in __builtin__ module\r
-\r
-import sets\r
-set = sets.Set\r
-del sets\r
-\r
-# python 2.4 enhance sort method in list object with key and reverse parameters, and introduced sorted function which do the same as sort but on a copied list\r
-# as it's far more difficult to modify sort method, we implement a sorted fuction for python 2.3\r
-\r
-def sorted(iterable, cmp=None, key=None, reverse=False) :\r
-       i = list(iterable)\r
-       if key :\r
-               d = {}\r
-               for v in iterable :\r
-                       k = key(v)\r
-                       if not d.has_key(k) :\r
-                               d[k] = []\r
-                       d[k].append(v)\r
-               keys = d.keys()\r
-               keys.sort(cmp)\r
-               i = []\r
-               for k in keys :\r
-                       i += d[k]\r
-       else :\r
-               i.sort(cmp)\r
-       if reverse :\r
-               i.reverse()\r
-       return i\r
-       \r
-# string.Template allow us to create templated command without problem : \r
-# configparser use standard substitution, so an error in template can make the config file invalid. With the new template, we avoid this problem\r
-# thoses classes are stollen from python 2.4 string module\r
-import re\r
-class _TemplateMetaclass(type):\r
-       pattern = r"""\r
-       %(delim)s(?:\r
-       (?P<escaped>%(delim)s) |   # Escape sequence of two delimiters\r
-       (?P<named>%(id)s)      |   # delimiter and a Python identifier\r
-       {(?P<braced>%(id)s)}   |   # delimiter and a braced identifier\r
-       (?P<invalid>)              # Other ill-formed delimiter exprs\r
-       )\r
-       """\r
-       \r
-       def __init__(cls, name, bases, dct):\r
-               super(_TemplateMetaclass, cls).__init__(name, bases, dct)\r
-               if 'pattern' in dct:\r
-                       pattern = cls.pattern\r
-               else:\r
-                       pattern = _TemplateMetaclass.pattern % {\r
-                               'delim' : re.escape(cls.delimiter),\r
-                               'id'    : cls.idpattern,\r
-                               }\r
-               cls.pattern = re.compile(pattern, re.IGNORECASE | re.VERBOSE)\r
-\r
-\r
-class Template:\r
-       """A string class for supporting $-substitutions."""\r
-       __metaclass__ = _TemplateMetaclass\r
-       \r
-       delimiter = '$'\r
-       idpattern = r'[_a-z][_a-z0-9]*'\r
-       \r
-       def __init__(self, template):\r
-               self.template = template\r
-       \r
-       # Search for $$, $identifier, ${identifier}, and any bare $'s\r
-       \r
-       def _invalid(self, mo):\r
-               i = mo.start('invalid')\r
-               lines = self.template[:i].splitlines(True)\r
-               if not lines:\r
-                       colno = 1\r
-                       lineno = 1\r
-               else:\r
-                       colno = i - len(''.join(lines[:-1]))\r
-                       lineno = len(lines)\r
-               raise ValueError('Invalid placeholder in string: line %d, col %d' %\r
-                               (lineno, colno))\r
-       \r
-       def substitute(self, *args, **kws):\r
-               if len(args) > 1:\r
-                       raise TypeError('Too many positional arguments')\r
-               if not args:\r
-                       mapping = kws\r
-               elif kws:\r
-                       mapping = _multimap(kws, args[0])\r
-               else:\r
-                       mapping = args[0]\r
-               # Helper function for .sub()\r
-               def convert(mo):\r
-                       # Check the most common path first.\r
-                       named = mo.group('named') or mo.group('braced')\r
-                       if named is not None:\r
-                               val = mapping[named]\r
-                               # We use this idiom instead of str() because the latter will\r
-                               # fail if val is a Unicode containing non-ASCII characters.\r
-                               return '%s' % val\r
-                       if mo.group('escaped') is not None:\r
-                               return self.delimiter\r
-                       if mo.group('invalid') is not None:\r
-                               self._invalid(mo)\r
-                       raise ValueError('Unrecognized named group in pattern',\r
-                                       self.pattern)\r
-               return self.pattern.sub(convert, self.template)\r
-       \r
-       def safe_substitute(self, *args, **kws):\r
-               if len(args) > 1:\r
-                       raise TypeError('Too many positional arguments')\r
-               if not args:\r
-                       mapping = kws\r
-               elif kws:\r
-                       mapping = _multimap(kws, args[0])\r
-               else:\r
-                       mapping = args[0]\r
-               # Helper function for .sub()\r
-               def convert(mo):\r
-                       named = mo.group('named')\r
-                       if named is not None:\r
-                               try:\r
-                                       # We use this idiom instead of str() because the latter\r
-                                       # will fail if val is a Unicode containing non-ASCII\r
-                                       return '%s' % mapping[named]\r
-                               except KeyError:\r
-                                       return self.delimiter + named\r
-                       braced = mo.group('braced')\r
-                       if braced is not None:\r
-                               try:\r
-                                       return '%s' % mapping[braced]\r
-                               except KeyError:\r
-                                       return self.delimiter + '{' + braced + '}'\r
-                       if mo.group('escaped') is not None:\r
-                               return self.delimiter\r
-                       if mo.group('invalid') is not None:\r
-                               return self.delimiter\r
-                       raise ValueError('Unrecognized named group in pattern',\r
-                                       self.pattern)\r
-               return self.pattern.sub(convert, self.template)\r
+#!/usr/bin/env python
+#coding: iso-8859-15
+#
+# Copyright (C) 2005  Gaëtan Lehmann <gaetan.lehmann@jouy.inra.fr>
+#
+# this file is part of uptodate
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program 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 General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+#
+
+# this module sets python 2.3 compatibility
+
+
+# python 2.4 now have set in __builtin__ module
+
+import sets
+set = sets.Set
+del sets
+
+# python 2.4 enhance sort method in list object with key and reverse parameters, and introduced sorted function which do the same as sort but on a copied list
+# as it's far more difficult to modify sort method, we implement a sorted fuction for python 2.3
+
+def sorted(iterable, cmp=None, key=None, reverse=False) :
+       i = list(iterable)
+       if key :
+               d = {}
+               for v in iterable :
+                       k = key(v)
+                       if not d.has_key(k) :
+                               d[k] = []
+                       d[k].append(v)
+               keys = d.keys()
+               keys.sort(cmp)
+               i = []
+               for k in keys :
+                       i += d[k]
+       else :
+               i.sort(cmp)
+       if reverse :
+               i.reverse()
+       return i
+       
+# string.Template allow us to create templated command without problem : 
+# configparser use standard substitution, so an error in template can make the config file invalid. With the new template, we avoid this problem
+# thoses classes are stollen from python 2.4 string module
+import re
+class _TemplateMetaclass(type):
+       pattern = r"""
+       %(delim)s(?:
+       (?P<escaped>%(delim)s) |   # Escape sequence of two delimiters
+       (?P<named>%(id)s)      |   # delimiter and a Python identifier
+       {(?P<braced>%(id)s)}   |   # delimiter and a braced identifier
+       (?P<invalid>)              # Other ill-formed delimiter exprs
+       )
+       """
+       
+       def __init__(cls, name, bases, dct):
+               super(_TemplateMetaclass, cls).__init__(name, bases, dct)
+               if 'pattern' in dct:
+                       pattern = cls.pattern
+               else:
+                       pattern = _TemplateMetaclass.pattern % {
+                               'delim' : re.escape(cls.delimiter),
+                               'id'    : cls.idpattern,
+                               }
+               cls.pattern = re.compile(pattern, re.IGNORECASE | re.VERBOSE)
+
+
+class Template:
+       """A string class for supporting $-substitutions."""
+       __metaclass__ = _TemplateMetaclass
+       
+       delimiter = '$'
+       idpattern = r'[_a-z][_a-z0-9]*'
+       
+       def __init__(self, template):
+               self.template = template
+       
+       # Search for $$, $identifier, ${identifier}, and any bare $'s
+       
+       def _invalid(self, mo):
+               i = mo.start('invalid')
+               lines = self.template[:i].splitlines(True)
+               if not lines:
+                       colno = 1
+                       lineno = 1
+               else:
+                       colno = i - len(''.join(lines[:-1]))
+                       lineno = len(lines)
+               raise ValueError('Invalid placeholder in string: line %d, col %d' %
+                               (lineno, colno))
+       
+       def substitute(self, *args, **kws):
+               if len(args) > 1:
+                       raise TypeError('Too many positional arguments')
+               if not args:
+                       mapping = kws
+               elif kws:
+                       mapping = _multimap(kws, args[0])
+               else:
+                       mapping = args[0]
+               # Helper function for .sub()
+               def convert(mo):
+                       # Check the most common path first.
+                       named = mo.group('named') or mo.group('braced')
+                       if named is not None:
+                               val = mapping[named]
+                               # We use this idiom instead of str() because the latter will
+                               # fail if val is a Unicode containing non-ASCII characters.
+                               return '%s' % val
+                       if mo.group('escaped') is not None:
+                               return self.delimiter
+                       if mo.group('invalid') is not None:
+                               self._invalid(mo)
+                       raise ValueError('Unrecognized named group in pattern',
+                                       self.pattern)
+               return self.pattern.sub(convert, self.template)
+       
+       def safe_substitute(self, *args, **kws):
+               if len(args) > 1:
+                       raise TypeError('Too many positional arguments')
+               if not args:
+                       mapping = kws
+               elif kws:
+                       mapping = _multimap(kws, args[0])
+               else:
+                       mapping = args[0]
+               # Helper function for .sub()
+               def convert(mo):
+                       named = mo.group('named')
+                       if named is not None:
+                               try:
+                                       # We use this idiom instead of str() because the latter
+                                       # will fail if val is a Unicode containing non-ASCII
+                                       return '%s' % mapping[named]
+                               except KeyError:
+                                       return self.delimiter + named
+                       braced = mo.group('braced')
+                       if braced is not None:
+                               try:
+                                       return '%s' % mapping[braced]
+                               except KeyError:
+                                       return self.delimiter + '{' + braced + '}'
+                       if mo.group('escaped') is not None:
+                               return self.delimiter
+                       if mo.group('invalid') is not None:
+                               return self.delimiter
+                       raise ValueError('Unrecognized named group in pattern',
+                                       self.pattern)
+               return self.pattern.sub(convert, self.template)
index bc842fa29029f6b4cedf3c21cfd854f9be938323..3180d603dd5b7da5d892bce38d607067b3566f58 100644 (file)
@@ -1,3 +1,22 @@
+# Copyright (C) 2009-2012  EDF R&D
+#
+# 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
+#
+
 try:
   from string import Template
 except:
@@ -9,10 +28,13 @@ cxxCompo="""
 #include <unistd.h>
 
 #include <Calcium.hxx>
-#include <calcium.h>
+#include <CalciumException.hxx>
+${CalciumInterface}
 #include <signal.h>
 #include <SALOME_NamingService.hxx>
 #include <Utils_SALOME_Exception.hxx>
+#include <pthread.h>
+#include <execinfo.h>
 
 typedef void (*sighandler_t)(int);
 sighandler_t setsig(int sig, sighandler_t handler)
@@ -28,6 +50,20 @@ sighandler_t setsig(int sig, sighandler_t handler)
 
 static void AttachDebugger()
 {
+  void *array[20];
+  size_t size=20;
+  char **strings;
+  size_t i;
+  std::string _what;
+  size = backtrace (array, size);
+  strings = backtrace_symbols (array, size);
+  for (i = 0; i < size; i++)
+     _what=_what+strings[i]+ '\\n';
+  free (strings);
+
+  std::cerr << pthread_self() << std::endl;
+  std::cerr << _what << std::endl;
+
   if(getenv ("DEBUGGER"))
     {
       std::stringstream exec;
@@ -90,14 +126,16 @@ static void unexpectedHandler(void)
 ${servicesdef}
 //ENDDEF
 
+#include <calcium.h>
+
 extern "C" void cp_exit(int err);
 
-extern "C" void F_FUNC(cpexit,CPEXIT)(int err)
+extern "C" void F_FUNC(cpexit,CPEXIT)(int *err)
 {
-  if(err==-1)
+  if(*err==-1)
     _exit(-1);
   else
-    cp_exit(err);
+    cp_exit(*err);
 }
 
 using namespace std;
@@ -113,7 +151,6 @@ ${component}_i::${component}_i(CORBA::ORB_ptr orb,
                      const char *interfaceName)
           : Superv_Component_i(orb, poa, contId, instanceName, interfaceName)
 {
-  std::cerr << "create component" << std::endl;
 #if ${exe}
   setsig(SIGSEGV,&THandler);
   set_terminate(&terminateHandler);
@@ -146,10 +183,12 @@ ${component}_i::~${component}_i()
 
 void ${component}_i::destroy()
 {
-  Engines_Component_i::destroy();
 #if ${exe}
+  _remove_ref();
   if(!CORBA::is_nil(_orb))
     _orb->shutdown(0);
+#else
+  Engines_Component_i::destroy();
 #endif
 }
 
@@ -199,8 +238,8 @@ extern "C"
         Engines::Container_var container = Engines::Container::_narrow(obj);
         ${component}_i * myEngine = new ${component}_i(orb, poa, container, instanceName.c_str(), "${component}");
         pman->activate();
-        obj=myEngine->_this();
-        Engines::Component_var component = Engines::Component::_narrow(obj);
+        obj=myEngine->POA_${module}_ORB::${component}::_this();
+        Engines::EngineComponent_var component = Engines::EngineComponent::_narrow(obj);
         string component_registerName = containerName + "/" + instanceName;
         salomens->Register(component,component_registerName.c_str());
         orb->run();
@@ -232,12 +271,16 @@ hxxCompo="""
 #ifndef _${component}_HXX_
 #define _${component}_HXX_
 
+#include <SALOME_Component.hh>
 #include "Superv_Component_i.hxx"
 #include "${module}.hh"
 
-class ${component}_i:
-  public virtual POA_${module}::${component},
-  public virtual Superv_Component_i
+//COMPODEFS
+${compodefs}
+//ENDDEF
+
+class ${component}_i: public virtual POA_${module}_ORB::${component},
+                      ${inheritedclass} public virtual Superv_Component_i
 {
   public:
     ${component}_i(CORBA::ORB_ptr orb, PortableServer::POA_ptr poa,
@@ -269,22 +312,21 @@ hxxCompo=Template(hxxCompo)
 cxxService="""
 void ${component}_i::${service}(${parameters})
 {
-  std::cerr << "${component}_i::${service}" << std::endl;
   beginService("${component}_i::${service}");
   Superv_Component_i * component = dynamic_cast<Superv_Component_i*>(this);
-  char       nom_instance[INSTANCE_LEN];
-  int info = cp_cd(component,nom_instance);
+  //char       nom_instance[INSTANCE_LEN];
+  //int info = cp_cd(component,nom_instance);
   try
     {
 //BODY
 ${body}
 //ENDBODY
-      cp_fin(component,CP_ARRET);
+      //cp_fin(component,CP_ARRET);
     }
   catch ( const CalciumException & ex)
     {
       std::cerr << ex.what() << std::endl;
-      cp_fin(component,CP_ARRET);
+      //cp_fin(component,CP_ARRET);
       SALOME::ExceptionStruct es;
       es.text=CORBA::string_dup(ex.what());
       es.type=SALOME::INTERNAL_ERROR;
@@ -292,7 +334,7 @@ ${body}
     }
   catch ( const SALOME_Exception & ex)
     {
-      cp_fin(component,CP_ARRET);
+      //cp_fin(component,CP_ARRET);
       SALOME::ExceptionStruct es;
       es.text=CORBA::string_dup(ex.what());
       es.type=SALOME::INTERNAL_ERROR;
@@ -300,23 +342,30 @@ ${body}
     }
   catch ( const SALOME::SALOME_Exception & ex)
     {
-      cp_fin(component,CP_ARRET);
+      //cp_fin(component,CP_ARRET);
       throw;
     }
+  catch ( const std::exception& ex)
+    {
+      //std::cerr << typeid(ex).name() << std::endl;
+      SALOME::ExceptionStruct es;
+      es.text=CORBA::string_dup(ex.what());
+      es.type=SALOME::INTERNAL_ERROR;
+      throw SALOME::SALOME_Exception(es);
+    }
   catch (...)
     {
       std::cerr << "unknown exception" << std::endl;
 #if ${exe}
       _exit(-1);
 #endif
-      cp_fin(component,CP_ARRET);
+      //cp_fin(component,CP_ARRET);
       SALOME::ExceptionStruct es;
       es.text=CORBA::string_dup(" unknown exception");
       es.type=SALOME::INTERNAL_ERROR;
       throw SALOME::SALOME_Exception(es);
     }
   endService("${component}_i::${service}");
-  std::cerr << "end of ${component}_i::${service}" << std::endl;
 }
 
 """
@@ -359,36 +408,21 @@ exeCPP=Template(exeCPP)
 # Makefile
 
 compoMakefile="""
-include $$(top_srcdir)/adm_local/make_common_starter.am
-
-AM_CFLAGS=$$(KERNEL_INCLUDES) -fexceptions
-
-lib_LTLIBRARIES = lib${component}Engine.la
 lib${component}Engine_la_SOURCES      = ${component}.cxx ${sources}
 nodist_lib${component}Engine_la_SOURCES =
-lib${component}Engine_la_CXXFLAGS = -I$$(top_builddir)/idl  $$(KERNEL_INCLUDES) ${includes}
-lib${component}Engine_la_FFLAGS = $$(KERNEL_INCLUDES) -fexceptions ${includes}
-lib${component}Engine_la_LIBADD   = -L$$(top_builddir)/idl -l${module} $$(FLIBS) ${libs}
+lib${component}Engine_la_CXXFLAGS = -I$$(top_builddir)/idl  $$(SALOME_INCLUDES) ${includes}
+lib${component}Engine_la_FFLAGS = $$(SALOME_INCLUDES) -fexceptions ${includes}
+lib${component}Engine_la_LIBADD   = ${libs} -L$$(top_builddir)/idl -lSalomeIDL${module} $${SALOME_LIBS} $$(FLIBS)
 lib${component}Engine_la_LDFLAGS = ${rlibs}
-salomeinclude_HEADERS = ${component}.hxx
 """
 compoMakefile=Template(compoMakefile)
 
 compoEXEMakefile="""
-include $$(top_srcdir)/adm_local/make_common_starter.am
-
-AM_CFLAGS=$$(KERNEL_INCLUDES) -fexceptions
-
-lib_LTLIBRARIES = lib${component}Exelib.la
 lib${component}Exelib_la_SOURCES      = ${component}.cxx
 nodist_lib${component}Exelib_la_SOURCES =
-lib${component}Exelib_la_CXXFLAGS = -I$$(top_builddir)/idl  $$(KERNEL_INCLUDES) ${includes}
-lib${component}Exelib_la_FFLAGS = $$(KERNEL_INCLUDES) -fexceptions ${includes}
-lib${component}Exelib_la_LIBADD   = -L$$(top_builddir)/idl -l${module} $$(FLIBS) ${libs}
+lib${component}Exelib_la_CXXFLAGS = -I$$(top_builddir)/idl  $$(SALOME_INCLUDES) ${includes}
+lib${component}Exelib_la_FFLAGS = $$(SALOME_INCLUDES) -fexceptions ${includes}
+lib${component}Exelib_la_LIBADD   = ${libs} -L$$(top_builddir)/idl -lSalomeIDL${module} $${SALOME_LIBS} $$(FLIBS)
 lib${component}Exelib_la_LDFLAGS = ${rlibs}
-salomeinclude_HEADERS = ${component}.hxx
-# These files are executable scripts
-dist_salomescript_SCRIPTS= ${component}.exe
 """
 compoEXEMakefile=Template(compoEXEMakefile)
-
index e2d950801bdad4f5d542dff195c27ea1d5d7cd1a..307f72af4735c1683a96cca8317a4b441298353f 100644 (file)
@@ -1,25 +1,85 @@
+# Copyright (C) 2009-2012  EDF R&D
+#
+# 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
+#
+
 """
   Module that defines CPPComponent for SALOME components implemented in C++
 """
 
+import os
 from gener import Component, Invalid
 from cpp_tmpl import initService, cxxService, hxxCompo, cxxCompo
-from cpp_tmpl import compoEXEMakefile, compoMakefile, exeCPP
+from cpp_tmpl import exeCPP, compoEXEMakefile, compoMakefile
+from yacstypes import corba_rtn_type
 
 class CPPComponent(Component):
-  def __init__(self, name, services=None, libs="", rlibs="", includes="", 
-                     kind="lib", exe_path=None, sources=None):
+  """
+   A :class:`CPPComponent` instance represents a C++ SALOME component with services given as a list of :class:`Service`
+   instances with the parameter *services*.
+
+   :param name: gives the name of the component.
+   :type name: str
+   :param services: the list of services (:class:`Service`) of the component.
+   :param kind: If it is given and has the value "exe", the component will be built as a standalone
+      component (executable or shell script). The default is to build the component as a dynamic library.
+   :param libs: gives all the libraries options to add when linking the generated component (-L...).
+   :param rlibs: gives all the runtime libraries options to add when linking the generated component (-R...).
+   :param includes: gives all the include options to add when compiling the generated component (-I...).
+   :param sources: gives all the external source files to add in the compilation step (list of paths).
+   :param exe_path: is only used when kind is "exe" and gives the path to the standalone component.
+   :param compodefs: can be used to add extra definition code in the component for example when using a base class
+      to define the component class by deriving it (see *inheritedclass* parameter)
+   :param inheritedclass: can be used to define a base class for the component. The base class can be defined in external
+      source or with the *compodefs* parameter. The value of the *inheritedclass* parameter is the name of the base class.
+   :param idls: can be used to add extra idl CORBA interfaces to the component. This parameter must gives a list of idl file
+      names that are added into the generated module (idl directory) and compiled with the generated idl of the module.
+   :param interfacedefs: can be used to add idl definitions (or includes of idl files) into the generated idl of the module.
+   :param inheritedinterface: can be used to make the component inherit an extra idl interface that has been included through
+      the *idls* and *interfacedefs* parameters. See the cppgui1 example for how to use these last parameters.
+   :param addmethods: is a C++ specific parameter that can be used to redefine a component method (DumpPython for example). This
+      parameter is a string that must contain the definition and implementation code of the method. See the cppgui1 example
+      for how to use it.
+   :param calciumextendedinterface: if you want to use the Calcium extended interface for C++ as defined by the header CalciumInterface.hxx
+      set this parameter to 1. By default its value is 0 so to not use extended interface. The extended interface requires boost as a dependency.
+
+   For example, the following call defines a standalone component named "mycompo" with one service s1 (it must have been defined before)::
+
+      >>> c1 = module_generator.CPPComponent('mycompo', services=[s1,], kind="exe",
+                                             exe_path="./launch.sh")
+  """
+  def __init__(self, name, services=None, libs="", rlibs="", includes="", kind="lib",
+                     exe_path=None, sources=None, inheritedclass="", compodefs="",
+                     idls=None,interfacedefs="",inheritedinterface="",addedmethods="",
+                     calciumextendedinterface=0):
     self.exe_path = exe_path
-    Component.__init__(self, name, services, impl="CPP", libs=libs, 
-                             rlibs=rlibs, includes=includes, kind=kind,
-                             sources=sources)
+    self.calciumextendedinterface=calciumextendedinterface
+    Component.__init__(self, name, services, impl="CPP", libs=libs, rlibs=rlibs,
+                             includes=includes, kind=kind, sources=sources,
+                             inheritedclass=inheritedclass, compodefs=compodefs, idls=idls,
+                             interfacedefs=interfacedefs, inheritedinterface=inheritedinterface,
+                             addedmethods=addedmethods)
 
   def validate(self):
     """ validate component definition parameters"""
     Component.validate(self)
     kinds = ("lib", "exe")
     if self.kind not in kinds:
-      raise Invalid("kind must be one of %s" % kinds)
+      raise Invalid("kind must be one of %s for component %s" % (kinds,self.name))
 
     if self.kind == "exe" :
       if not self.exe_path:
@@ -27,40 +87,70 @@ class CPPComponent(Component):
 
   def makeCompo(self, gen):
     """generate files for C++ component
-       
+
        return a dict where key is the file name and value is the content of the file
     """
     cxxfile = "%s.cxx" % self.name
     hxxfile = "%s.hxx" % self.name
     if self.kind == "lib":
-      sources = " ".join(self.sources)
-      return {"Makefile.am":compoMakefile.substitute(module=gen.module.name, 
+      sources = " ".join(map(os.path.basename,self.sources))
+      return {"Makefile.am":gen.makeMakefile(self.getMakefileItems(gen)),
+              cxxfile:self.makecxx(gen),
+              hxxfile:self.makehxx(gen)
+             }
+    if self.kind == "exe":
+      return {"Makefile.am":gen.makeMakefile(self.getMakefileItems(gen)),
+              self.name+".exe":exeCPP.substitute(compoexe=self.exe_path),
+              cxxfile:self.makecxx(gen, 1),
+              hxxfile:self.makehxx(gen)
+             }
+
+  def getMakefileItems(self,gen):
+    makefileItems={"header":"""
+include $(top_srcdir)/adm_local/make_common_starter.am
+
+AM_CFLAGS=$(SALOME_INCLUDES) -fexceptions
+"""}
+    if self.kind == "lib":
+      makefileItems["lib_LTLIBRARIES"]=["lib"+self.name+"Engine.la"]
+      makefileItems["salomeinclude_HEADERS"]=[self.name+".hxx"]
+      makefileItems["body"]=compoMakefile.substitute(module=gen.module.name,
                                                      component=self.name,
-                                                     libs=self.libs, 
+                                                     libs=self.libs,
                                                      rlibs=self.rlibs,
-                                                     sources=sources,
-                                                     includes=self.includes),
-              cxxfile:self.makecxx(gen), hxxfile:self.makehxx(gen)}
-    if self.kind == "exe":
-      return {"Makefile.am":compoEXEMakefile.substitute(module=gen.module.name, 
+                                                     sources= " ".join(map(os.path.basename,self.sources)),
+                                                     includes=self.includes)
+    elif self.kind == "exe":
+      makefileItems["lib_LTLIBRARIES"]=["lib"+self.name+"Exelib.la"]
+      makefileItems["salomeinclude_HEADERS"]=[self.name+".hxx"]
+      makefileItems["dist_salomescript_SCRIPTS"]=[self.name+".exe"]
+      makefileItems["body"]=compoEXEMakefile.substitute(module=gen.module.name,
                                                         component=self.name,
-                                                        libs=self.libs, 
+                                                        libs=self.libs,
                                                         rlibs=self.rlibs,
-                                                        includes=self.includes),
-              self.name+".exe":exeCPP.substitute(compoexe=self.exe_path),
-              cxxfile:self.makecxx(gen, 1), hxxfile:self.makehxx(gen)}
+                                                        includes=self.includes)
+    return makefileItems
 
   def makehxx(self, gen):
     """return a string that is the content of .hxx file
     """
     services = []
     for serv in self.services:
-      service = "    void %s(" % serv.name
+      service = "    %s %s(" % (corba_rtn_type(serv.ret,gen.module.name),serv.name)
       service = service+gen.makeArgs(serv)+");"
       services.append(service)
+
+    if self.addedmethods:
+      services.append(self.addedmethods)
     servicesdef = "\n".join(services)
-    return hxxCompo.substitute(component=self.name, module=gen.module.name, 
-                               servicesdef=servicesdef)
+
+    inheritedclass=self.inheritedclass
+    if self.inheritedclass:
+      inheritedclass= " public virtual " + self.inheritedclass + ","
+
+    return hxxCompo.substitute(component=self.name, module=gen.module.name,
+                               servicesdef=servicesdef, inheritedclass=inheritedclass,
+                               compodefs=self.compodefs)
 
   def makecxx(self, gen, exe=0):
     """return a string that is the content of .cxx file
@@ -70,25 +160,31 @@ class CPPComponent(Component):
     defs = []
     for serv in self.services:
       defs.append(serv.defs)
-      service = cxxService.substitute(component=self.name, service=serv.name, 
+      service = cxxService.substitute(component=self.name, service=serv.name,
                                       parameters=gen.makeArgs(serv),
                                       body=serv.body, exe=exe)
       streams = []
       for name, typ, dep in serv.instream:
-        streams.append('          create_calcium_port(this,"%s","%s","IN","%s");'% (name, typ, dep))
+        streams.append('          create_calcium_port(this,(char *)"%s",(char *)"%s",(char *)"IN",(char *)"%s");'% (name, typ, dep))
       instream = "\n".join(streams)
       streams = []
       for name, typ, dep in serv.outstream:
-        streams.append('          create_calcium_port(this,"%s","%s","OUT","%s");'% (name, typ, dep))
+        streams.append('          create_calcium_port(this,(char *)"%s",(char *)"%s",(char *)"OUT",(char *)"%s");'% (name, typ, dep))
       outstream = "\n".join(streams)
 
       init = initService.substitute(component=self.name, service=serv.name,
                                     instream=instream, outstream=outstream)
       services.append(service)
       inits.append(init)
-    return cxxCompo.substitute(component=self.name, module=gen.module.name, 
-                               exe=exe, exe_path=self.exe_path, 
-                               servicesdef="\n".join(defs), 
-                               servicesimpl="\n".join(services), 
-                               initservice='\n'.join(inits))
+
+    CalciumInterface=""
+    if self.calciumextendedinterface:
+      CalciumInterface="#include <CalciumInterface.hxx>"
+
+    return cxxCompo.substitute(component=self.name, module=gen.module.name,
+                               exe=exe, exe_path=self.exe_path,
+                               servicesdef="\n".join(defs),
+                               servicesimpl="\n".join(services),
+                               initservice='\n'.join(inits),
+                               CalciumInterface=CalciumInterface)
 
diff --git a/module_generator/doc_tmpl.py b/module_generator/doc_tmpl.py
new file mode 100644 (file)
index 0000000..9fccb60
--- /dev/null
@@ -0,0 +1,292 @@
+# Copyright (C) 2009-2012  EDF R&D
+#
+# 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
+#
+
+try:
+  from string import Template
+except:
+  from compat import Template,set
+
+docmakefile="""
+include $$(top_srcdir)/adm_local/make_common_starter.am
+
+salomedoc_DATA=html/index.html
+salomeres_DATA = ${others}
+
+html/index.html:
+       make htm
+
+SPHINXOPTS      =
+SOURCEDIR       = $$(srcdir)
+SPHINXBUILD     = sphinx-build
+PAPEROPT_a4     = -D latex_paper_size=a4
+ALLSPHINXOPTS   = -d doctrees $$(PAPEROPT_a4) $$(SPHINXOPTS) $$(SOURCEDIR)
+
+htm:
+       mkdir -p html doctrees
+       $$(SPHINXBUILD) -b html $$(ALLSPHINXOPTS) html
+       @echo
+       @echo "Build finished. The HTML pages are in html."
+
+install-data-local:
+       $$(INSTALL) -d $$(DESTDIR)$$(salomedocdir)
+       cp -rf html/* $$(DESTDIR)$$(salomedocdir) ;
+
+uninstall-local:
+       chmod -R +w $$(DESTDIR)$$(salomedocdir)
+       rm -rf $$(DESTDIR)$$(salomedocdir)/*
+
+clean-local:
+       -rm -rf html latex doctrees
+       if test -d "html"; then rm -rf html ; fi
+
+"""
+docmakefile=Template(docmakefile)
+
+docconf="""# -*- coding: utf-8 -*-
+#
+# ${module} documentation build configuration file, created by
+# sphinx-quickstart on Sun Sep 19 16:20:14 2010.
+#
+# This file is execfile()d with the current directory set to its containing dir.
+#
+# Note that not all possible configuration values are present in this
+# autogenerated file.
+#
+# All configuration values have a default; values that are commented out
+# serve to show the default.
+
+import sys, os
+
+# If extensions (or modules to document with autodoc) are in another directory,
+# add these directories to sys.path here. If the directory is relative to the
+# documentation root, use os.path.abspath to make it absolute, like shown here.
+#sys.path.insert(0, os.path.abspath('.'))
+
+# -- General configuration -----------------------------------------------------
+
+# If your documentation needs a minimal Sphinx version, state it here.
+#needs_sphinx = '1.0'
+
+# Add any Sphinx extension module names here, as strings. They can be extensions
+# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
+extensions = []
+
+# Add any paths that contain templates here, relative to this directory.
+templates_path = ['_templates']
+
+# The suffix of source filenames.
+source_suffix = '.rst'
+
+# The encoding of source files.
+#source_encoding = 'utf-8-sig'
+
+# The master toctree document.
+master_doc = 'index'
+
+# General information about the project.
+project = u'${module}'
+copyright = u'2010'
+
+# The version info for the project you're documenting, acts as replacement for
+# |version| and |release|, also used in various other places throughout the
+# built documents.
+#
+# The short X.Y version.
+version = '1'
+# The full version, including alpha/beta/rc tags.
+release = '1'
+
+# The language for content autogenerated by Sphinx. Refer to documentation
+# for a list of supported languages.
+#language = None
+
+# There are two options for replacing |today|: either, you set today to some
+# non-false value, then it is used:
+#today = ''
+# Else, today_fmt is used as the format for a strftime call.
+#today_fmt = '%B %d, %Y'
+
+# List of patterns, relative to source directory, that match files and
+# directories to ignore when looking for source files.
+exclude_patterns = ['_build']
+
+# The reST default role (used for this markup: `text`) to use for all documents.
+#default_role = None
+
+# If true, '()' will be appended to :func: etc. cross-reference text.
+#add_function_parentheses = True
+
+# If true, the current module name will be prepended to all description
+# unit titles (such as .. function::).
+#add_module_names = True
+
+# If true, sectionauthor and moduleauthor directives will be shown in the
+# output. They are ignored by default.
+#show_authors = False
+
+# The name of the Pygments (syntax highlighting) style to use.
+pygments_style = 'sphinx'
+
+# A list of ignored prefixes for module index sorting.
+#modindex_common_prefix = []
+
+
+# -- Options for HTML output ---------------------------------------------------
+
+# The theme to use for HTML and HTML Help pages.  See the documentation for
+# a list of builtin themes.
+html_theme = 'default'
+
+# Theme options are theme-specific and customize the look and feel of a theme
+# further.  For a list of options available for each theme, see the
+# documentation.
+#html_theme_options = {}
+
+# Add any paths that contain custom themes here, relative to this directory.
+#html_theme_path = []
+
+# The name for this set of Sphinx documents.  If None, it defaults to
+# "<project> v<release> documentation".
+#html_title = None
+
+# A shorter title for the navigation bar.  Default is the same as html_title.
+#html_short_title = None
+
+# The name of an image file (relative to this directory) to place at the top
+# of the sidebar.
+#html_logo = None
+
+# The name of an image file (within the static path) to use as favicon of the
+# docs.  This file should be a Windows icon file (.ico) being 16x16 or 32x32
+# pixels large.
+#html_favicon = None
+
+# Add any paths that contain custom static files (such as style sheets) here,
+# relative to this directory. They are copied after the builtin static files,
+# so a file named "default.css" will overwrite the builtin "default.css".
+html_static_path = ['_static']
+
+# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
+# using the given strftime format.
+#html_last_updated_fmt = '%b %d, %Y'
+
+# If true, SmartyPants will be used to convert quotes and dashes to
+# typographically correct entities.
+#html_use_smartypants = True
+
+# Custom sidebar templates, maps document names to template names.
+#html_sidebars = {}
+
+# Additional templates that should be rendered to pages, maps page names to
+# template names.
+#html_additional_pages = {}
+
+# If false, no module index is generated.
+#html_domain_indices = True
+
+# If false, no index is generated.
+#html_use_index = True
+
+# If true, the index is split into individual pages for each letter.
+#html_split_index = False
+
+# If true, links to the reST sources are added to the pages.
+#html_show_sourcelink = True
+
+# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
+#html_show_sphinx = True
+
+# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
+#html_show_copyright = True
+
+# If true, an OpenSearch description file will be output, and all pages will
+# contain a <link> tag referring to it.  The value of this option must be the
+# base URL from which the finished HTML is served.
+#html_use_opensearch = ''
+
+# This is the file name suffix for HTML files (e.g. ".xhtml").
+#html_file_suffix = None
+
+# Output file base name for HTML help builder.
+htmlhelp_basename = '${module}doc'
+
+
+# -- Options for LaTeX output --------------------------------------------------
+
+# The paper size ('letter' or 'a4').
+#latex_paper_size = 'letter'
+
+# The font size ('10pt', '11pt' or '12pt').
+#latex_font_size = '10pt'
+
+# Grouping the document tree into LaTeX files. List of tuples
+# (source start file, target name, title, author, documentclass [howto/manual]).
+latex_documents = [
+  ('index', '${module}.tex', u'${module} Documentation',
+   u'cc', 'manual'),
+]
+
+# The name of an image file (relative to this directory) to place at the top of
+# the title page.
+#latex_logo = None
+
+# For "manual" documents, if this is true, then toplevel headings are parts,
+# not chapters.
+#latex_use_parts = False
+
+# If true, show page references after internal links.
+#latex_show_pagerefs = False
+
+# If true, show URL addresses after external links.
+#latex_show_urls = False
+
+# Additional stuff for the LaTeX preamble.
+#latex_preamble = ''
+
+# Documents to append as an appendix to all manuals.
+#latex_appendices = []
+
+# If false, no module index is generated.
+#latex_domain_indices = True
+
+
+# -- Options for manual page output --------------------------------------------
+
+# One entry per manual page. List of tuples
+# (source start file, name, description, authors, manual section).
+man_pages = [
+    ('index', '${module}', u'${module} Documentation',
+     [u'cc'], 1)
+]
+"""
+
+docconf=Template(docconf)
+
+docsalomeapp="""
+<document>
+  <section name="${module}">
+    <parameter name="name" value="${module}"/>
+  </section>
+  <section name="resources">
+    <parameter name="${module}" value="$${${module}_ROOT_DIR}/share/salome/resources/${lmodule}"/>
+  </section>
+</document>
+"""
+docsalomeapp=Template(docsalomeapp)
+
index 02b8d1153f28268691d4a835c4fc36745322eb1d..03de846e71f4437b7b5dffbd5f6a2c0a4cf19734 100644 (file)
@@ -1,3 +1,21 @@
+# Copyright (C) 2009-2012  EDF R&D
+#
+# 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
+#
 
 from gener import Component
 from cppcompo import CPPComponent
@@ -11,6 +29,27 @@ else:
   f77Types = {"double":"double *", "long":"long *", "string":"const char *"}
 
 class F77Component(CPPComponent):
+  """
+   A :class:`F77Component` instance represents a Fortran SALOME component with services given as a list of :class:`Service`
+   instances with the parameter *services*.
+
+   :param name: gives the name of the component.
+   :type name: str
+   :param services: the list of services (:class:`Service`) of the component.
+   :param kind: If it is given and has the value "exe", the component will be built as a standalone
+      component (executable or shell script). The default is to build the component as a dynamic library.
+   :param libs: gives all the libraries options to add when linking the generated component (-L...).
+   :param rlibs: gives all the runtime libraries options to add when linking the generated component (-R...).
+   :param sources: gives all the external source files to add in the compilation step (list of paths).
+   :param exe_path: is only used when kind is "exe" and gives the path to the standalone component.
+
+   For example, the following call defines a Fortran component named "mycompo" with one service s1 (it must have been defined before).
+   This component is implemented as a dynamic library linked with a user's library "mylib"::
+
+      >>> c1 = module_generator.F77Component('mycompo', services=[s1,],
+                                                       libs="-lmylib -Lmydir")
+
+  """
   def __init__(self, name, services=None, libs="", rlibs="", 
                      kind="lib", exe_path=None, sources=None):
     CPPComponent.__init__(self, name, services, libs=libs, rlibs=rlibs, 
@@ -18,17 +57,22 @@ class F77Component(CPPComponent):
     self.impl = "F77"
 
   def makebody(self):
+    """generate definitions (defs attribute of services) et bodys (body attribute of services)"""
     for serv in self.services:
       #defs generation
-      params = ["void *compo"]
+      params=[]
+      if serv.instream or serv.outstream:
+        params = ["void *compo"]
       strparams = []
       for name, typ in serv.inport:
+        if typ == "file":continue #files are not passed through service interface
         if typ == "string":
           params.append("const STR_PSTR(%s)"%name)
           strparams.append("STR_PLEN(%s)"%name)
         else:
           params.append("%s %s" % (f77Types[typ], name))
       for name, typ in serv.outport:
+        if typ == "file":continue #files are not passed through service interface
         if typ == "string":
           params.append("const STR_PSTR(%s)"%name)
           strparams.append("STR_PLEN(%s)"%name)
@@ -38,18 +82,22 @@ class F77Component(CPPComponent):
       serv.defs = serv.defs+'\nextern "C" void F_FUNC(%s,%s)(%s);' % (serv.name.lower(), serv.name.upper(), args)
 
       #body generation
-      params = ["&component"]
+      params=[]
+      if serv.instream or serv.outstream:
+        params = ["&component"]
       strparams = []
       strallocs = []
       #length allocated for out string
       lstr = 20
       for name, typ in serv.inport:
+        if typ == "file":continue #files are not passed through service interface
         if typ == "string":
           params.append("STR_CPTR(%s)" % name)
           strparams.append("STR_CLEN(%s)"%name)
         else:
           params.append("&%s" % name)
       for name, typ in serv.outport:
+        if typ == "file":continue #files are not passed through service interface
         if typ == "string":
           params.append("STR_CPTR(%s.ptr())" % name)
           strparams.append("STR_CLEN(%s.ptr())"%name)
@@ -61,5 +109,9 @@ class F77Component(CPPComponent):
       serv.body = serv.body+"\n   F_CALL(%s,%s)(%s);" % (serv.name.lower(), serv.name.upper(), args)
 
   def makeCompo(self, gen):
+    """build a dictionary that defines component files
+       dictionary key = file name
+       dictionary value = file content or dictionary defining subdirectory content
+    """
     self.makebody()
     return CPPComponent.makeCompo(self, gen)
index 18fc93be4a79bb79b9320e982abee80609150d12..d388f1f924e8031ec494799a3e92000027b52aa2 100644 (file)
@@ -1,4 +1,25 @@
+# Copyright (C) 2009-2012  EDF R&D
+#
+# 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
+#
+
 import os, shutil, glob, socket
+import traceback
+import warnings
 
 try:
   from string import Template
@@ -8,73 +29,100 @@ except:
 class Invalid(Exception):
   pass
 
-from mod_tmpl import resMakefile, makecommon, configure
+debug=0
+
+from mod_tmpl import resMakefile, makecommon, configure, paco_configure
 from mod_tmpl import mainMakefile, autogen, application
-from cata_tmpl import catalog, interface, idl, idlMakefile
+from mod_tmpl import check_sphinx
+from cata_tmpl import catalog, interface, idl, idlMakefile, parallel_interface
+from cata_tmpl import xml, xml_interface, xml_service
+from cata_tmpl import idlMakefilePaCO_BUILT_SOURCES, idlMakefilePaCO_nodist_salomeinclude_HEADERS
+from cata_tmpl import idlMakefilePACO_salomepython_DATA, idlMakefilePACO_salomeidl_DATA
+from cata_tmpl import idlMakefilePACO_INCLUDES
 from cata_tmpl import cataOutStream, cataInStream, cataOutparam, cataInparam
+from cata_tmpl import cataOutParallelStream, cataInParallelStream
 from cata_tmpl import cataService, cataCompo
 from aster_tmpl import check_aster
-
-corbaTypes = {"double":"CORBA::Double", "long":"CORBA::Long",
-              "string":"const char*", "dblevec":"const %s::dblevec&",
-              "stringvec":"const %s::stringvec&", "intvec":"const %s::intvec&"}
-corbaOutTypes = {"double":"CORBA::Double&", "long":"CORBA::Long&",
-                "string":"CORBA::String_out", "dblevec":"%s::dblevec_out",
-                "stringvec":"%s::stringvec_out", "intvec":"%s::intvec_out"}
-
-def corba_in_type(typ, module):
-  if typ in ("dblevec", "intvec", "stringvec"):
-    return corbaTypes[typ] % module
-  else:
-    return corbaTypes[typ]
-
-def corba_out_type(typ, module):
-  if typ in ("dblevec", "intvec", "stringvec"):
-    return corbaOutTypes[typ] % module
-  else:
-    return corbaOutTypes[typ]
-
-calciumTypes = {"CALCIUM_double":"CALCIUM_double", 
-                "CALCIUM_integer":"CALCIUM_integer", 
-                "CALCIUM_real":"CALCIUM_real",
-                "CALCIUM_string":"CALCIUM_string", 
-                "CALCIUM_complex":"CALCIUM_complex", 
-                "CALCIUM_logical":"CALCIUM_logical",
-               } 
-
-ValidImpl = ("CPP", "PY", "F77", "ASTER")
-ValidTypes = corbaTypes.keys()
-ValidStreamTypes = calciumTypes.keys()
-ValidDependencies = ("I", "T")
-PyValidTypes = ValidTypes+["pyobj"]
+from salomemodules import salome_modules
+from yacstypes import corbaTypes, corbaOutTypes, moduleTypes, idlTypes, corba_in_type, corba_out_type
+from yacstypes import ValidTypes, PyValidTypes, calciumTypes, DatastreamParallelTypes
+from yacstypes import ValidImpl, ValidImplTypes, ValidStreamTypes, ValidParallelStreamTypes, ValidDependencies
+from gui_tmpl import pyguimakefile, pysalomeapp, cppguimakefile, cppsalomeapp
+from doc_tmpl import docmakefile, docconf, docsalomeapp
 
 def makedirs(namedir):
+  """Create a new directory named namedir. If a directory already exists copy it to namedir.bak"""
   if os.path.exists(namedir):
     dirbak = namedir+".bak"
     if os.path.exists(dirbak):
       shutil.rmtree(dirbak)
     os.rename(namedir, dirbak)
-    os.listdir(dirbak) #sert seulement a mettre a jour le systeme de fichier sur certaines machines
+    os.listdir(dirbak) #needed to update filesystem on special machines (cluster with NFS, for example)
   os.makedirs(namedir)
 
 class Module(object):
-  def __init__(self, name, components=None, prefix=""):
+  """
+   A :class:`Module` instance represents a SALOME module that contains components given as a list of
+   component instances (:class:`CPPComponent` or :class:`PYComponent` or :class:`F77Component` or :class:`ASTERComponent`)
+   with the parameter *components*.
+
+   :param name: gives the name of the module. The SALOME source module
+      will be located in the <name_SRC> directory.
+   :type name: str
+   :param components: gives the list of components of the module.
+   :param prefix: is the path of the installation directory.
+   :param layout: If given and has the value "monodir", all components
+      will be generated in a single directory. The default is to generate each component in its
+      own directory.
+   :param doc: can be used to add an online documentation to the module. It must be a list of file names (sources, images, ...) that will be
+      used to build a sphinx documentation (see http://sphinx.pocoo.org, for more information). If not given, the Makefile.am
+      and the conf.py (sphinx configuration) files are generated. In this case, the file name extension of source files must be .rst.
+      See small examples in Examples/pygui1 and Examples/cppgui1.
+   :param gui: can be used to add a GUI to the module. It must be a list of file names (sources, images, qt designer files, ...).
+      If not given, the Makefile.am and SalomeApp.xml are generated. All image files are put in the resources directory of the module.
+      The GUI can be implemented in C++ (file name extension '.cxx') or in Python (file name extension '.py').
+      See small examples in Examples/pygui1 and Examples/cppgui1.
+
+   For example, the following call defines a module named "mymodule" with 2 components c1 and c2  (they must have been
+   defined before) that will be installed in the "install" directory::
+
+      >>> m = module_generator.Module('mymodule', components=[c1,c2],
+                                                  prefix="./install")
+
+  """
+  def __init__(self, name, components=None, prefix="",layout="multidir", doc=None, gui=None):
     self.name = name
     self.components = components or []
     self.prefix = prefix or "%s_INSTALL" % name
-    self.validate()
+    self.layout=layout
+    self.doc = doc
+    self.gui = gui
+    try:
+      self.validate()
+    except Invalid,e:
+      if debug:
+        traceback.print_exc()
+      print "Error in module %s: %s" % (name,e)
+      raise SystemExit
 
   def validate(self):
+    # Test Module name, canot have a "-" in the name
+    if self.name.find("-") != -1:
+      raise Invalid("Module name %s is not valid, remove character - in the module name" % self.name)
     lcompo = set()
     for compo in self.components:
       if compo.name in lcompo:
         raise Invalid("%s is already defined as a component of the module" % compo.name)
       lcompo.add(compo.name)
       compo.validate()
+    if self.gui and self.layout != "multidir":
+      raise Invalid("A module with GUI can not be generated if layout is not multidir")
 
 class Component(object):
-  def __init__(self, name, services=None, impl="PY", libs="", rlibs="", 
-                     includes="", kind="lib", sources=None):
+  def __init__(self, name, services=None, impl="PY", libs="", rlibs="",
+                     includes="", kind="lib", sources=None,
+                     inheritedclass="",compodefs="",
+                     idls=None,interfacedefs="",inheritedinterface="",addedmethods=""):
     self.name = name
     self.impl = impl
     self.kind = kind
@@ -83,6 +131,12 @@ class Component(object):
     self.rlibs = rlibs
     self.includes = includes
     self.sources = sources or []
+    self.inheritedclass=inheritedclass
+    self.compodefs=compodefs
+    self.idls=idls
+    self.interfacedefs=interfacedefs
+    self.inheritedinterface=inheritedinterface
+    self.addedmethods=addedmethods
 
   def validate(self):
     if self.impl not in ValidImpl:
@@ -103,17 +157,59 @@ class Component(object):
   def getImpl(self):
     return "SO", ""
 
+  def getMakefileItems(self,gen):
+    return {}
+
+  def setPrerequisites(self, prerequisites_file):
+    self.prerequisites = prerequisites_file
+
 class Service(object):
-  def __init__(self, name, inport=None, outport=None, instream=None, 
-                     outstream=None, body="", defs=""):
+  """
+   A :class:`Service` instance represents a component service with dataflow and datastream ports.
+
+   :param name: gives the name of the service.
+   :type name: str
+   :param inport: gives the list of input dataflow ports.
+   :param outport: gives the list of output dataflow ports. An input or output dataflow port is defined
+      by a 2-tuple (port name, data type name). The list of supported basic data types is: "double", "long", "string",
+      "dblevec", "stringvec", "intvec", "file" and "pyobj" only for Python services. Depending on the implementation
+      language, it is also possible to use some types from SALOME modules (see :ref:`yacstypes`).
+   :param ret: gives the type of the return parameter
+   :param instream: gives the list of input datastream ports.
+   :param outstream: gives the list of output datastream ports. An input or output datastream port is defined
+      by a 3-tuple (port name, data type name, mode name). The list of possible data types is: "CALCIUM_double", "CALCIUM_integer",
+      "CALCIUM_real", "CALCIUM_string", "CALCIUM_complex", "CALCIUM_logical", "CALCIUM_long". The mode can be "I" (iterative mode)
+      or "T" (temporal mode).
+   :param defs: gives the source code to insert in the definition section of the component. It can be C++ includes
+      or Python imports
+   :type defs: str
+   :param body: gives the source code to insert in the service call. It can be any C++
+      or Python code that fits well in the body of the service method.
+   :type body: str
+
+   For example, the following call defines a minimal Python service with one input dataflow port (name "a", type double)
+   and one input datastream port::
+
+      >>> s1 = module_generator.Service('myservice', inport=[("a","double"),],
+                                        instream=[("aa","CALCIUM_double","I")],
+                                        body="print a")
+
+
+  """
+  def __init__(self, name, inport=None, outport=None, ret="void", instream=None, outstream=None,
+                     parallel_instream=None, parallel_outstream=None, defs="", body="", impl_type="sequential"):
     self.name = name
     self.inport = inport or []
     self.outport = outport or []
+    self.ret = ret
     self.instream = instream or []
     self.outstream = outstream or []
+    self.parallel_instream = parallel_instream or []
+    self.parallel_outstream = parallel_outstream or []
     self.defs = defs
     self.body = body
     self.impl = ""
+    self.impl_type = impl_type
 
   def validate(self):
     lports = set()
@@ -142,6 +238,20 @@ class Service(object):
         raise Invalid("%s is already defined as a stream port" % name)
       lports.add(name)
 
+    for port in self.parallel_instream:
+      name, typ = self.validateParallelStream(port)
+      if name in lports:
+        raise Invalid("%s is already defined as a stream port" % name)
+      lports.add(name)
+
+    for port in self.parallel_outstream:
+      name, typ = self.validateParallelStream(port)
+      if name in lports:
+        raise Invalid("%s is already defined as a stream port" % name)
+      lports.add(name)
+
+    self.validateImplType()
+
   def validatePort(self, port):
     try:
       name, typ = port
@@ -157,6 +267,10 @@ class Service(object):
       raise Invalid("%s is not a valid type. It should be one of %s" % (typ, validtypes))
     return name, typ
 
+  def validateImplType(self):
+    if self.impl_type not in ValidImplTypes:
+      raise Invalid("%s is not a valid impl type. It should be one of %s" % (self.impl_type, ValidImplTypes))
+
   def validateStream(self, port):
     try:
       name, typ, dep = port
@@ -168,18 +282,48 @@ class Service(object):
       raise Invalid("%s is not a valid dependency. It should be one of %s" % (dep, ValidDependencies))
     return name, typ, dep
 
+  def validateParallelStream(self, port):
+    try:
+      name, typ = port
+    except:
+      raise Invalid("%s is not a valid definition of a parallel stream port (name,type)" % (port,))
+    if typ not in ValidParallelStreamTypes:
+      raise Invalid("%s is not a valid type. It should be one of %s" % (typ, ValidParallelStreamTypes))
+    return name, typ
+
 class Generator(object):
+  """
+   A :class:`Generator` instance take a :class:`Module` instance as its first parameter and can be used to generate the
+   SALOME source module, builds it, installs it and includes it in a SALOME application.
+
+   :param module: gives the :class:`Module` instance that will be used for the generation.
+   :param context: If given , its content is used to specify the prerequisites
+      environment file (key *"prerequisites"*) and the SALOME KERNEL installation directory (key *"kernel"*).
+   :type context: dict
+
+   For example, the following call creates a generator for the module m::
+
+      >>> g = module_generator.Generator(m,context)
+  """
   def __init__(self, module, context=None):
     self.module = module
     self.context = context or {}
     self.kernel = self.context["kernel"]
+    self.gui = self.context.get("gui")
+    self.makeflags = self.context.get("makeflags")
     self.aster = ""
+    if self.module.gui and not self.gui:
+      raise Invalid("To generate a module with GUI, you need to set the 'gui' parameter in the context dictionnary")
+    for component in self.module.components:
+      component.setPrerequisites(self.context.get("prerequisites"))
 
   def generate(self):
+    """Generate a SALOME source module"""
     module = self.module
     namedir = module.name+"_SRC"
     force = self.context.get("force")
     update = self.context.get("update")
+    paco = self.context.get("paco")
     if os.path.exists(namedir):
       if force:
         shutil.rmtree(namedir)
@@ -192,49 +336,371 @@ class Generator(object):
 
     srcs = {}
     makefile = "SUBDIRS="
-    makefiles = []
+    makefileItems={"header":"""
+include $(top_srcdir)/adm_local/make_common_starter.am
+AM_CFLAGS=$(SALOME_INCLUDES) -fexceptions
+""",
+                   "salomepython_PYTHON":[],
+                   "dist_salomescript_SCRIPTS":[],
+                   "salomeres_DATA":[],
+                   "lib_LTLIBRARIES":[],
+                   "salomeinclude_HEADERS":[],
+                   "body":"",
+                  }
+
+    #get the list of SALOME modules used and put it in used_modules attribute
+    def get_dependent_modules(mod,modules):
+      modules[mod]=1
+      if not salome_modules[mod].has_key("depends"):return
+      for m in salome_modules[mod]["depends"]:
+        if modules.has_key(m):continue
+        get_dependent_modules(m,modules)
+
+    modules = {}
     for compo in module.components:
-      makefile = makefile+" "+compo.name
-      srcs[compo.name] = compo.makeCompo(self)
-      makefiles.append("     src/"+compo.name+"/Makefile")
+      for serv in compo.services:
+        for name, typ in serv.inport + serv.outport + [ ("return",serv.ret) ] :
+          mod = moduleTypes[typ]
+          if mod:
+            get_dependent_modules(mod,modules)
 
-    srcs["Makefile.am"] = makefile+'\n'
-    idlfile = "%s.idl" % module.name
+    self.used_modules = modules.keys()
+
+    for compo in module.components:
+      #for components files
+      fdict=compo.makeCompo(self)
+      if self.module.layout=="multidir":
+        srcs[compo.name] = fdict
+        #for src/Makefile.am
+        makefile = makefile + " " + compo.name
+      else:
+        srcs.update(fdict)
+        #for src/Makefile.am
+        mdict=compo.getMakefileItems(self)
+        makefileItems["salomepython_PYTHON"]=makefileItems["salomepython_PYTHON"]+mdict.get("salomepython_PYTHON",[])
+        makefileItems["dist_salomescript_SCRIPTS"]=makefileItems["dist_salomescript_SCRIPTS"]+mdict.get("dist_salomescript_SCRIPTS",[])
+        makefileItems["salomeres_DATA"]=makefileItems["salomeres_DATA"]+mdict.get("salomeres_DATA",[])
+        makefileItems["lib_LTLIBRARIES"]=makefileItems["lib_LTLIBRARIES"]+mdict.get("lib_LTLIBRARIES",[])
+        makefileItems["salomeinclude_HEADERS"]=makefileItems["salomeinclude_HEADERS"]+mdict.get("salomeinclude_HEADERS",[])
+        makefileItems["body"]=makefileItems["body"]+mdict.get("body","")+'\n'
+
+    if module.gui:
+      GUIname=module.name+"GUI"
+      fdict=self.makeGui(namedir)
+      srcs[GUIname] = fdict
+      #for src/Makefile.am
+      makefile = makefile + " " + GUIname
+
+    if self.module.layout == "multidir":
+      srcs["Makefile.am"] = makefile+'\n'
+    else:
+      srcs["Makefile.am"] = self.makeMakefile(makefileItems)
+
+    docsubdir=""
+    if module.doc:
+      docsubdir="doc"
+
+    #for catalog files
     catalogfile = "%sCatalog.xml" % module.name
 
+    need_boost=0
+    if module.gui:
+        need_boost=1
+    for compo in module.components:
+      if hasattr(compo,"calciumextendedinterface") and compo.calciumextendedinterface:
+        need_boost=1
+        break
+
+    #add makefile definitions to make_common_starter.am
+    other_includes=""
+    common_starter = makecommon.substitute(other_includes=other_includes)
+    for mod in self.used_modules:
+      common_starter = common_starter + salome_modules[mod]["makefiledefs"] + '\n'
+
+    adm_local={"make_common_starter.am": common_starter, "check_aster.m4":check_aster}
+    if module.doc:
+      adm_local["check_sphinx.m4"]=check_sphinx
+
     self.makeFiles({"autogen.sh":autogen,
-                    "Makefile.am":mainMakefile,
+                    "Makefile.am":mainMakefile.substitute(docsubdir=docsubdir),
                     "README":"", "NEWS":"", "AUTHORS":"", "ChangeLog":"",
-                    "configure.ac":configure.substitute(module=module.name.lower(), makefiles='\n'.join(makefiles)),
-                    "idl":{"Makefile.am":idlMakefile.substitute(module=module.name), idlfile:self.makeidl()},
                     "src":srcs,
                     "resources":{"Makefile.am":resMakefile.substitute(module=module.name), catalogfile:self.makeCatalog()},
-                    "adm_local":{"make_common_starter.am":makecommon, "check_aster.m4":check_aster},
+                    "adm_local":adm_local,
                     }, namedir)
+
+    #add checks for modules in configure.ac
+    configure_modules=""
+    for mod in self.used_modules:
+      configure_modules = configure_modules + salome_modules[mod]["configdefs"] + '\n'
+
+    #for configure.ac
+    configure_makefiles = []
+    if self.module.layout=="multidir":
+      for compo in module.components:
+        configure_makefiles.append("     src/"+compo.name+"/Makefile")
+
+    if module.gui:
+      configure_makefiles.append("     src/%sGUI/Makefile" % module.name)
+    if module.doc:
+      configure_makefiles.append("     doc/Makefile")
+
+    other_check=""
+    other_summary=""
+    other_require=""
+
+    if need_boost:
+      other_check=other_check+"""CHECK_BOOST
+"""
+      other_summary=other_summary+"""echo "  Boost  ................. : $boost_ok"
+"""
+
+    if module.gui:
+      other_check=other_check + """CHECK_SALOME_GUI
+CHECK_QT
+"""
+      other_summary=other_summary+'''echo "  SALOME GUI ............. : $SalomeGUI_ok"
+echo "  Qt ..................... : $qt_ok"
+'''
+      other_require=other_require + """
+      if test "x$SalomeGUI_ok" = "xno"; then
+        AC_MSG_ERROR([SALOME GUI is required],1)
+      fi
+      if test "x$qt_ok" = "xno"; then
+        AC_MSG_ERROR([Qt library is required],1)
+      fi
+"""
+    if module.doc:
+      other_check=other_check+"CHECK_SPHINX\n"
+      other_summary=other_summary+'''echo "  Sphinx ................. : $sphinx_ok"\n'''
+      other_require=other_require + """
+      if test "x$sphinx_ok" = "xno"; then
+        AC_MSG_ERROR([Sphinx documentation generator is required],1)
+      fi
+"""
+
+    files={}
+    #for idl files
+    idlfile = "%s.idl" % module.name
+    paco_config=""
+    PACO_BUILT_SOURCES=""
+    PACO_SALOMEINCLUDE_HEADERS=""
+    PACO_INCLUDES=""
+    PACO_salomepython_DATA=""
+    PACO_salomeidl_DATA=""
+
+    if paco:
+      PACO_BUILT_SOURCES = idlMakefilePaCO_BUILT_SOURCES.substitute(module=module.name)
+      PACO_SALOMEINCLUDE_HEADERS = idlMakefilePaCO_nodist_salomeinclude_HEADERS.substitute(module=module.name)
+      PACO_salomepython_DATA = idlMakefilePACO_salomepython_DATA.substitute(module=module.name)
+      PACO_salomeidl_DATA = idlMakefilePACO_salomeidl_DATA.substitute(module=module.name)
+      PACO_INCLUDES = idlMakefilePACO_INCLUDES
+      paco_config=paco_configure
+
+    files["configure.ac"]=configure.substitute(module=module.name.lower(),
+                                               makefiles='\n'.join(configure_makefiles),
+                                               paco_configure=paco_config,
+                                               modules=configure_modules,
+                                               other_check=other_check,
+                                               other_summary=other_summary,
+                                               other_require=other_require,
+                                              )
+
+    #if components have other idls
+    other_idls=""
+    other_sks=""
+    for compo in module.components:
+      if compo.idls:
+        for idl in compo.idls:
+          for fidl in glob.glob(idl):
+            other_idls=other_idls+os.path.basename(fidl) +" "
+            other_sks=other_sks+os.path.splitext(os.path.basename(fidl))[0]+"SK.cc "
+
+    idlfiles={"Makefile.am":    idlMakefile.substitute(module=module.name,
+                                                       PACO_BUILT_SOURCES=PACO_BUILT_SOURCES,
+                                                       PACO_SALOMEINCLUDE_HEADERS=PACO_SALOMEINCLUDE_HEADERS,
+                                                       PACO_INCLUDES=PACO_INCLUDES,
+                                                       PACO_salomepython_DATA=PACO_salomepython_DATA,
+                                                       PACO_salomeidl_DATA=PACO_salomeidl_DATA,
+                                                       other_idls=other_idls,other_sks=other_sks,
+                                                       ),
+              idlfile : self.makeidl(),
+             }
+    if paco:
+      idlfiles["%s.xml" % module.name]=self.makexml()
+
+    files["idl"]=idlfiles
+
+    self.makeFiles(files,namedir)
+
     os.chmod(os.path.join(namedir, "autogen.sh"), 0777)
-    #copy source files if any in creates tree
+    #copy source files if any in created tree
     for compo in module.components:
       for src in compo.sources:
-        shutil.copyfile(src, os.path.join(namedir, "src", compo.name, src))
-
-    for m4file in ("check_Kernel.m4", "check_omniorb.m4", 
-                   "ac_linker_options.m4", "ac_cxx_option.m4",
-                   "python.m4", "enable_pthreads.m4", "check_f77.m4", 
-                   "acx_pthread.m4", "check_boost.m4"):
-      shutil.copyfile(os.path.join(self.kernel, "salome_adm", "unix", "config_files", m4file), 
+        if self.module.layout=="multidir":
+          shutil.copyfile(src, os.path.join(namedir, "src", compo.name, os.path.basename(src)))
+        else:
+          shutil.copyfile(src, os.path.join(namedir, "src", os.path.basename(src)))
+
+      if compo.idls:
+        #copy provided idl files in idl directory
+        for idl in compo.idls:
+          for fidl in glob.glob(idl):
+            shutil.copyfile(fidl, os.path.join(namedir, "idl", os.path.basename(fidl)))
+
+    checks= ("check_Kernel.m4", "check_omniorb.m4", "ac_linker_options.m4", "ac_cxx_option.m4",
+             "python.m4", "enable_pthreads.m4", "check_f77.m4", "acx_pthread.m4", "check_paco++.m4",
+             "check_mpi.m4", "check_lam.m4", "check_openmpi.m4", "check_mpich.m4")
+    if need_boost:
+      checks=checks+("check_boost.m4",)
+    for m4file in checks:
+      shutil.copyfile(os.path.join(self.kernel, "salome_adm", "unix", "config_files", m4file),
                       os.path.join(namedir, "adm_local", m4file))
 
+    if self.module.gui:
+      for m4file in ("check_GUI.m4", "check_qt.m4", "check_opengl.m4"):
+        shutil.copyfile(os.path.join(self.gui, "adm_local", "unix", "config_files", m4file),
+                        os.path.join(namedir, "adm_local", m4file))
+
+    self.makeDoc(namedir)
     return
 
+  def makeDoc(self,namedir):
+    if not self.module.doc:
+      return
+    rep=os.path.join(namedir,"doc")
+    os.makedirs(rep)
+    for docs in self.module.doc:
+      for doc in glob.glob(docs):
+        name = os.path.basename(doc)
+        shutil.copyfile(doc, os.path.join(rep, name))
+
+    d={}
+
+    others=""
+    if not self.module.gui:
+       #without gui but with doc: create a small SalomeApp.xml in doc directory
+       if not os.path.exists(os.path.join(namedir, "doc", "SalomeApp.xml")):
+         #create a minimal SalomeApp.xml
+         salomeapp=docsalomeapp.substitute(module=self.module.name,lmodule=self.module.name.lower())
+         d["SalomeApp.xml"]=salomeapp
+       others="SalomeApp.xml"
+
+    if not os.path.exists(os.path.join(namedir, "doc", "Makefile.am")):
+      #create a minimal makefile.am
+      d["Makefile.am"]=docmakefile.substitute(others=others)
+
+    if not os.path.exists(os.path.join(namedir, "doc", "conf.py")):
+      #create a minimal conf.py
+      d["conf.py"]=docconf.substitute(module=self.module.name)
+
+    self.makeFiles(d,os.path.join(namedir,"doc"))
+
+  def makeGui(self,namedir):
+    if not self.module.gui:
+      return
+    ispython=False
+    iscpp=False
+    #Force creation of intermediate directories
+    os.makedirs(os.path.join(namedir, "src", self.module.name+"GUI"))
+
+    for srcs in self.module.gui:
+      for src in glob.glob(srcs):
+        shutil.copyfile(src, os.path.join(namedir, "src", self.module.name+"GUI", os.path.basename(src)))
+        if src[-3:]==".py":ispython=True
+        if src[-4:]==".cxx":iscpp=True
+    if ispython and iscpp:
+      raise Invalid("Module GUI must be pure python or pure C++ but not mixed")
+    if ispython:
+      return self.makePyGUI(namedir)
+    if iscpp:
+      return self.makeCPPGUI(namedir)
+    raise Invalid("Module GUI must be in python or C++ but it is none of them")
+
+  def makePyGUI(self,namedir):
+    d={}
+    if not os.path.exists(os.path.join(namedir, "src", self.module.name+"GUI", "Makefile.am")):
+      #create a minimal makefile.am
+      sources=[]
+      other=[]
+      for srcs in self.module.gui:
+        for src in glob.glob(srcs):
+          if src[-3:]==".py":
+            sources.append(os.path.basename(src))
+          else:
+            other.append(os.path.basename(src))
+      makefile=pyguimakefile.substitute(sources=" ".join(sources),other_sources=" ".join(other))
+      d["Makefile.am"]=makefile
+
+    if not os.path.exists(os.path.join(namedir, "src", self.module.name+"GUI", "SalomeApp.xml")):
+      #create a minimal SalomeApp.xml
+      salomeapp=pysalomeapp.substitute(module=self.module.name,lmodule=self.module.name.lower())
+      d["SalomeApp.xml"]=salomeapp
+
+    return d
+
+  def makeCPPGUI(self,namedir):
+    d={}
+    if not os.path.exists(os.path.join(namedir, "src", self.module.name+"GUI", "Makefile.am")):
+      #create a minimal makefile.am
+      sources=[]
+      other=[]
+      ui_files=[]
+      for srcs in self.module.gui:
+        for src in glob.glob(srcs):
+          if src[-4:]==".cxx":
+            sources.append(os.path.basename(src))
+          elif src[-2:]==".h":
+            sources.append(os.path.basename(src)[:-2]+"_moc.cxx")
+          elif src[-3:]==".ui":
+            ui_files.append("ui_"+os.path.basename(src)[:-3]+".h")
+          elif src[-3:]==".ts":
+            other.append(os.path.basename(src)[:-3]+".qm")
+          else:
+            other.append(os.path.basename(src))
+
+      makefile=cppguimakefile.substitute(sources=" ".join(sources),other_sources=" ".join(other),
+                                         module=self.module.name, uisources= " ".join(ui_files))
+      d["Makefile.am"]=makefile
+
+    if not os.path.exists(os.path.join(namedir, "src", self.module.name+"GUI", "SalomeApp.xml")):
+      #create a minimal SalomeApp.xml
+      salomeapp=cppsalomeapp.substitute(module=self.module.name,lmodule=self.module.name.lower())
+      d["SalomeApp.xml"]=salomeapp
+
+    return d
+
+  def makeMakefile(self,makefileItems):
+    makefile=""
+    if makefileItems.has_key("header"):
+      makefile=makefile + makefileItems["header"]+'\n'
+    if makefileItems.has_key("lib_LTLIBRARIES"):
+      makefile=makefile+"lib_LTLIBRARIES= "+" ".join(makefileItems["lib_LTLIBRARIES"])+'\n'
+    if makefileItems.has_key("salomepython_PYTHON"):
+      makefile=makefile+"salomepython_PYTHON= "+" ".join(makefileItems["salomepython_PYTHON"])+'\n'
+    if makefileItems.has_key("dist_salomescript_SCRIPTS"):
+      makefile=makefile+"dist_salomescript_SCRIPTS= "+" ".join(makefileItems["dist_salomescript_SCRIPTS"])+'\n'
+    if makefileItems.has_key("salomeres_DATA"):
+      makefile=makefile+"salomeres_DATA= "+" ".join(makefileItems["salomeres_DATA"])+'\n'
+    if makefileItems.has_key("salomeinclude_HEADERS"):
+      makefile=makefile+"salomeinclude_HEADERS= "+" ".join(makefileItems["salomeinclude_HEADERS"])+'\n'
+    if makefileItems.has_key("body"):
+      makefile=makefile+makefileItems["body"]+'\n'
+    return makefile
+
   def makeArgs(self, service):
+    """generate source service for arguments"""
     params = []
     for name, typ in service.inport:
+      if typ=="file":continue #files are not passed through service interface
       params.append("%s %s" % (corba_in_type(typ, self.module.name), name))
     for name, typ in service.outport:
+      if typ=="file":continue #files are not passed through service interface
       params.append("%s %s" % (corba_out_type(typ, self.module.name), name))
     return ",".join(params)
 
   def makeCatalog(self):
+    """generate SALOME components catalog source"""
     components = []
     for compo in self.module.components:
       services = []
@@ -246,12 +712,18 @@ class Generator(object):
         params = []
         for name, typ in serv.outport:
           params.append(cataOutparam.substitute(name=name, type=typ))
+        if serv.ret != "void" :
+          params.append(cataOutparam.substitute(name="return", type=serv.ret))
         outparams = "\n".join(params)
         streams = []
         for name, typ, dep in serv.instream:
           streams.append(cataInStream.substitute(name=name, type=calciumTypes[typ], dep=dep))
         for name, typ, dep in serv.outstream:
           streams.append(cataOutStream.substitute(name=name, type=calciumTypes[typ], dep=dep))
+        for name, typ in serv.parallel_instream:
+          streams.append(cataInParallelStream.substitute(name=name, type=DatastreamParallelTypes[typ]))
+        for name, typ in serv.parallel_outstream:
+          streams.append(cataOutParallelStream.substitute(name=name, type=DatastreamParallelTypes[typ]))
         datastreams = "\n".join(streams)
         services.append(cataService.substitute(service=serv.name, author="EDF-RD",
                                                inparams=inparams, outparams=outparams, datastreams=datastreams))
@@ -261,26 +733,98 @@ class Generator(object):
     return catalog.substitute(components='\n'.join(components))
 
   def makeidl(self):
+    """generate module IDL file source (CORBA interface)"""
+    from pacocompo import PACOComponent
     interfaces = []
+    idldefs=""
     for compo in self.module.components:
-      services = []
-      for serv in compo.services:
-        params = []
-        for name, typ in serv.inport:
-          if compo.impl in ("PY", "ASTER") and typ == "pyobj":
-            typ = "Engines::fileBlock"
-          params.append("in %s %s" % (typ, name))
-        for name, typ in serv.outport:
-          if compo.impl in ("PY", "ASTER") and typ == "pyobj":
-            typ = "Engines::fileBlock"
-          params.append("out %s %s" % (typ, name))
-        service = "    void %s(" % serv.name
-        service = service+",".join(params)+") raises (SALOME::SALOME_Exception);"
-        services.append(service)
-      interfaces.append(interface.substitute(component=compo.name, services="\n".join(services)))
-    return idl.substitute(module=self.module.name, interfaces='\n'.join(interfaces))
+      if isinstance(compo, PACOComponent):
+        services = []
+        for serv in compo.services:
+          params = []
+          for name, typ in serv.inport:
+            if typ == "file":continue #files are not passed through IDL interface
+            params.append("in %s %s" % (idlTypes[typ], name))
+          for name, typ in serv.outport:
+            if typ == "file":continue #files are not passed through IDL interface
+            params.append("out %s %s" % (idlTypes[typ], name))
+          service = "    void %s(" % serv.name
+          service = service+",".join(params)+");"
+          services.append(service)
+
+        interfaces.append(parallel_interface.substitute(component=compo.name, services="\n".join(services)))
+
+      else:
+        services = []
+        for serv in compo.services:
+          params = []
+          for name, typ in serv.inport:
+            if typ == "file":continue #files are not passed through IDL interface
+            if compo.impl in ("PY", "ASTER") and typ == "pyobj":
+              typ = "Engines::fileBlock"
+            else:
+              typ=idlTypes[typ]
+            params.append("in %s %s" % (typ, name))
+          for name, typ in serv.outport:
+            if typ == "file":continue #files are not passed through IDL interface
+            if compo.impl in ("PY", "ASTER") and typ == "pyobj":
+              typ = "Engines::fileBlock"
+            else:
+              typ=idlTypes[typ]
+            params.append("out %s %s" % (typ, name))
+          service = "    %s %s(" % (idlTypes[serv.ret],serv.name)
+          service = service+",".join(params)+") raises (SALOME::SALOME_Exception);"
+          services.append(service)
+
+        from hxxcompo import HXX2SALOMEComponent
+        from hxxparacompo import HXX2SALOMEParaComponent
+        if isinstance(compo,HXX2SALOMEComponent) or isinstance(compo,HXX2SALOMEParaComponent):
+          from hxx_tmpl import interfaceidlhxx
+          Inherited=""
+          if isinstance(compo,HXX2SALOMEParaComponent):
+              Inherited="SALOME_MED::ParaMEDMEMComponent"
+              idldefs="""#include "ParaMEDMEMComponent.idl"\n"""
+          else:
+              if compo.use_medmem==True:
+                  Inherited="Engines::EngineComponent,SALOME::MultiCommClass,SALOME_MED::MED_Gen_Driver"
+              else:
+                  Inherited="Engines::EngineComponent"
+          interfaces.append(interfaceidlhxx.substitute(component=compo.name,inherited=Inherited, services="\n".join(services)))
+        else:
+          inheritedinterface=""
+          if compo.inheritedinterface:
+            inheritedinterface=compo.inheritedinterface+","
+          interfaces.append(interface.substitute(component=compo.name, services="\n".join(services),inheritedinterface=inheritedinterface))
+
+    #build idl includes for SALOME modules
+    for mod in self.used_modules:
+      idldefs = idldefs + salome_modules[mod]["idldefs"]
+
+    for compo in self.module.components:
+      if compo.interfacedefs:
+        idldefs = idldefs + compo.interfacedefs
+
+    return idl.substitute(module=self.module.name, interfaces='\n'.join(interfaces),idldefs=idldefs)
+
+  # For PaCO++
+  def makexml(self):
+    from pacocompo import PACOComponent
+    interfaces = []
+    for compo in self.module.components:
+      if isinstance(compo, PACOComponent):
+        services = []
+        for serv in compo.services:
+          if serv.impl_type == "parallel":
+            service = xml_service.substitute(service_name=serv.name)
+            services.append(service)
+        interfaces.append(xml_interface.substitute(component=compo.name, xml_services="\n".join(services)))
+    return xml.substitute(module=self.module.name, interfaces='\n'.join(interfaces))
 
   def makeFiles(self, dic, basedir):
+    """create files and directories defined in dictionary dic in basedir directory
+       dic key = file name to create
+       dic value = file content or dictionary defining the content of a sub directory
+    """
     for name, content in dic.items():
       filename = os.path.join(basedir, name)
       if isinstance(content, str):
@@ -293,33 +837,75 @@ class Generator(object):
         self.makeFiles(content, filename)
 
   def bootstrap(self):
+    """Execute the first build step (bootstrap autotools with autogen.sh script) : execution of libtool, autoconf, automake"""
     ier = os.system("cd %s_SRC;sh autogen.sh" % self.module.name)
     if ier != 0:
       raise Invalid("bootstrap has ended in error")
 
   def configure(self):
+    """Execute the second build step (configure) with installation prefix as given by the prefix attribute of module"""
     prefix = self.module.prefix
+    paco = self.context.get("paco")
+    mpi = self.context.get("mpi")
+    args = (self.module.name, self.kernel, self.aster)
+    cmd = "cd %s_SRC;./configure --with-kernel=%s --with-aster=%s" % args
+    if self.gui:
+      cmd = cmd + " --with-gui=%s" % self.gui
     if prefix:
       prefix = os.path.abspath(prefix)
-      cmd = "cd %s_SRC;./configure --with-kernel=%s --with-aster=%s --prefix=%s"
-      ier = os.system(cmd % (self.module.name, self.kernel, self.aster, prefix))
-    else:
-      cmd = "cd %s_SRC;./configure --with-kernel=%s --with-aster=%s"
-      ier = os.system(cmd % (self.module.name, self.kernel, self.aster))
+      cmd = cmd + " --prefix=%s" % prefix
+    if paco:
+      cmd += " --with-paco=%s" % paco
+    if mpi:
+      cmd += " --with-mpi=%s" % mpi
+
+    ier = os.system(cmd)
     if ier != 0:
       raise Invalid("configure has ended in error")
 
   def make(self):
-    ier = os.system("cd %s_SRC;make" % self.module.name)
+    """Execute the third build step (compile and link) : make"""
+    make_command = "make "
+    if self.makeflags:
+      make_command += self.makeflags
+    ier = os.system("cd %s_SRC;%s" % (self.module.name, make_command))
     if ier != 0:
       raise Invalid("make has ended in error")
 
   def install(self):
+    """Execute the installation step : make install """
+    makedirs(self.module.prefix)
     ier = os.system("cd %s_SRC;make install" % self.module.name)
     if ier != 0:
       raise Invalid("install has ended in error")
 
-  def make_appli(self, appliname, restrict=None, altmodules=None):
+  def make_appli(self, appliname, restrict=None, altmodules=None, resources=""):
+    """
+   Create a SALOME application containing the module and preexisting SALOME modules.
+
+   :param appliname: is a string that gives the name of the application (directory path where the application
+      will be installed).
+   :type appliname: str
+   :param restrict: If given (a list of module names), only those SALOME modules will be included in the
+      application. The default is to include all modules that are located in the same directory as the KERNEL module and have
+      the same suffix (for example, if KERNEL directory is KERNEL_V5 and GEOM directory is GEOM_V5, GEOM module is automatically
+      included, except if restrict is used).
+   :param altmodules: can be used to add SALOME modules that cannot be managed with the precedent rule. This parameter
+      is a dict with a module name as the key and the installation path as the value.
+   :param resources: can be used to define an alternative resources catalog (path of the file).
+
+   For example, the following calls create a SALOME application with external modules and resources catalog in "appli" directory::
+
+     >>> g=Generator(m,context)
+     >>> g.generate()
+     >>> g.bootstrap()
+     >>> g.configure()
+     >>> g.make()
+     >>> g.install()
+     >>> g.make_appli("appli", restrict=["KERNEL"], altmodules={"GUI":GUI_ROOT_DIR, "YACS":YACS_ROOT_DIR},
+                      resources="myresources.xml")
+
+    """
     makedirs(appliname)
 
     rootdir, kerdir = os.path.split(self.kernel)
@@ -365,6 +951,7 @@ class Generator(object):
     #add the generated module
     modules.append('  <module name="%s" path="%s"/>' % (self.module.name, os.path.abspath(self.module.prefix)))
 
+
     #try to find a prerequisites file
     prerequisites = self.context.get("prerequisites")
     if not prerequisites:
@@ -373,8 +960,15 @@ class Generator(object):
     if not os.path.exists(prerequisites):
       raise Invalid("Can not create an application : prerequisites file not defined or does not exist")
 
+    #add resources catalog if it exists
+    resources_spec=""
+    if os.path.isfile(resources):
+      resources_spec='<resources path="%s" />' % os.path.abspath(resources)
+
     #create config_appli.xml file
-    appli = application.substitute(prerequisites=prerequisites, modules="\n".join(modules))
+    appli = application.substitute(prerequisites=prerequisites,
+                                   modules="\n".join(modules),
+                                   resources=resources_spec)
     fil = open(os.path.join(appliname, "config_appli.xml"), 'w')
     fil.write(appli)
     fil.close()
diff --git a/module_generator/gui_tmpl.py b/module_generator/gui_tmpl.py
new file mode 100644 (file)
index 0000000..4cfc9fa
--- /dev/null
@@ -0,0 +1,97 @@
+# Copyright (C) 2009-2012  EDF R&D
+#
+# 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
+#
+
+try:
+  from string import Template
+except:
+  from compat import Template,set
+
+pyguimakefile="""
+include $$(top_srcdir)/adm_local/make_common_starter.am
+
+# Scripts to be installed
+salomepython_PYTHON= ${sources}
+
+salomeres_DATA =SalomeApp.xml ${other_sources}
+"""
+pyguimakefile=Template(pyguimakefile)
+
+
+pysalomeapp="""
+<document>
+  <section name="${module}">
+    <parameter name="name" value="${module}"/>
+    <parameter name="icon" value="${module}.png"/>
+    <parameter name="library" value="SalomePyQtGUI"/>
+    <parameter name="documentation" value="${lmodule}_help"/>
+  </section>
+  <section name="resources">
+    <parameter name="${module}" value="$${${module}_ROOT_DIR}/share/salome/resources/${lmodule}"/>
+  </section>
+  <section name="${lmodule}_help" >
+    <parameter name="sub_menu"          value="%1 module"/>
+    <parameter name="User's Guide"      value="%${module}_ROOT_DIR%/share/doc/salome/gui/${lmodule}/index.html"/>
+  </section>
+</document>
+"""
+pysalomeapp=Template(pysalomeapp)
+
+cppguimakefile="""
+include $$(top_srcdir)/adm_local/make_common_starter.am
+
+BUILT_SOURCES=${uisources}
+
+lib_LTLIBRARIES= lib${module}.la
+lib${module}_la_SOURCES = ${sources}
+lib${module}_la_CPPFLAGS = $$(SALOME_INCLUDES) $$(GUI_CXXFLAGS) $$(BOOST_CPPFLAGS) $$(QT_INCLUDES) -I$$(top_builddir)/idl
+lib${module}_la_LIBADD   = -L$$(top_builddir)/idl -lSalomeIDL${module}
+
+salomeres_DATA =SalomeApp.xml ${other_sources}
+
+# meta object implementation files generation (moc)
+%_moc.cxx: %.h
+       $$(MOC) $$< -o $$@
+
+# qt forms files generation (uic)
+ui_%.h: %.ui
+       $$(UIC) -o $$@ $$<
+
+# translation (*.qm) files generation (lrelease)
+%.qm: %.ts
+       $$(LRELEASE) $$< -qm $$@
+"""
+cppguimakefile=Template(cppguimakefile)
+
+cppsalomeapp="""
+<document>
+  <section name="${module}">
+    <parameter name="name" value="${module}"/>
+    <parameter name="icon" value="${module}.png"/>
+    <parameter name="documentation" value="${lmodule}_help"/>
+  </section>
+  <section name="resources">
+    <parameter name="${module}" value="$${${module}_ROOT_DIR}/share/salome/resources/${lmodule}"/>
+  </section>
+  <section name="${lmodule}_help" >
+    <parameter name="sub_menu"          value="%1 module"/>
+    <parameter name="User's Guide"      value="%${module}_ROOT_DIR%/share/doc/salome/gui/${lmodule}/index.html"/>
+  </section>
+</document>
+"""
+cppsalomeapp=Template(cppsalomeapp)
diff --git a/module_generator/hxx_awk.py b/module_generator/hxx_awk.py
new file mode 100644 (file)
index 0000000..e914672
--- /dev/null
@@ -0,0 +1,500 @@
+# Copyright (C) 2009-2012  EDF R&D
+#
+# 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
+#
+
+# only the first two characters of the map are actually used to find out in/out caracteristic
+cpp2idl_mapping={}
+cpp2idl_mapping["int"]="in long"
+cpp2idl_mapping["bool"]="in boolean"
+cpp2idl_mapping["double"]="in double"
+cpp2idl_mapping["float"]="in float"
+cpp2idl_mapping["long"]="in long"
+cpp2idl_mapping["short"]="in short"
+cpp2idl_mapping["unsigned"]="in unsigned long"
+cpp2idl_mapping["const char*"]="in string"
+cpp2idl_mapping["const std::string&"]="in string"
+cpp2idl_mapping["int&"]="out long"
+cpp2idl_mapping["bool&"]="out boolean"
+cpp2idl_mapping["double&"]="out double"
+cpp2idl_mapping["float&"]="out float"
+cpp2idl_mapping["long&"]="out long"
+cpp2idl_mapping["short&"]="out short"
+cpp2idl_mapping["unsigned&"]="out unsigned long"
+cpp2idl_mapping["std::string&"]="out string"
+cpp2idl_mapping["const MEDMEM::MESH&"]="in SALOME_MED::MESH"
+cpp2idl_mapping["const MEDMEM::MESH*"]="in SALOME_MED::MESH"
+cpp2idl_mapping["const MEDMEM::SUPPORT&"]="in SALOME_MED::SUPPORT"
+cpp2idl_mapping["const MEDMEM::SUPPORT*"]="in SALOME_MED::SUPPORT"
+cpp2idl_mapping["const MEDMEM::FIELD<double>*"]="in SALOME_MED::FIELDDOUBLE"
+cpp2idl_mapping["const MEDMEM::FIELD<double>&"]="in SALOME_MED::FIELDDOUBLE"
+cpp2idl_mapping["MEDMEM::FIELD<double>*&"]="out SALOME_MED::FIELDDOUBLE"
+cpp2idl_mapping["const std::vector<double>&"]="in %(module)s::dblevec"
+cpp2idl_mapping["const std::vector<std::vector<double> >&"]="in SALOME::Matrix"
+cpp2idl_mapping["std::vector<double>*&"]="out %(module)s::dblevec"
+cpp2idl_mapping["const MEDMEM::FIELD<int>*"]="in SALOME_MED::FIELDINT"
+cpp2idl_mapping["const MEDMEM::FIELD<int>&"]="in SALOME_MED::FIELDINT"
+cpp2idl_mapping["MEDMEM::FIELD<int>*&"]="out SALOME_MED::FIELDINT"
+cpp2idl_mapping["const std::vector<int>&"]="in %(module)s::intvec"
+cpp2idl_mapping["std::vector<int>*&"]="out %(module)s::intvec"
+cpp2idl_mapping["const ParaMEDMEM::MEDCouplingFieldDouble*"]="in SALOME_MED::MEDCouplingFieldDoubleCorbaInterface"
+cpp2idl_mapping["const ParaMEDMEM::MEDCouplingFieldDouble&"]="in SALOME_MED::MEDCouplingFieldDoubleCorbaInterface"
+cpp2idl_mapping["ParaMEDMEM::MEDCouplingFieldDouble*&"]="out SALOME_MED::MEDCouplingFieldDoubleCorbaInterface"
+
+# ['stringvec', 'string', 'double', 'long', 'dblevec', 'file', 'intvec', 'dataref', 'GEOM_Object', 'SMESH_Mesh', 'SMESH_Hypothesis', 'SALOME_MED/MED', 'SALOME_MED/MESH', 'SALOME_MED/SUPPORT', 'SALOME_MED/FIELD', 'SALOME_MED/FIELDDOUBLE', 'SALOME_MED/FIELDINT']
+cpp2yacs_mapping={}
+cpp2yacs_mapping["int"]="long"
+cpp2yacs_mapping["bool"]="boolean"
+cpp2yacs_mapping["double"]="double"
+#cpp2yacs_mapping["float"]="in float"
+cpp2yacs_mapping["long"]="long"
+#cpp2yacs_mapping["short"]="in short"
+#cpp2yacs_mapping["unsigned"]="in unsigned long"
+cpp2yacs_mapping["const char*"]="string"
+cpp2yacs_mapping["const std::string&"]="string"
+cpp2yacs_mapping["int&"]="long"
+cpp2yacs_mapping["bool&"]="boolean"
+cpp2yacs_mapping["double&"]="double"
+#cpp2yacs_mapping["float&"]="out float"
+cpp2yacs_mapping["long&"]="long"
+#cpp2yacs_mapping["short&"]="out short"
+#cpp2yacs_mapping["unsigned&"]="out unsigned long"
+cpp2yacs_mapping["std::string&"]="string"
+cpp2yacs_mapping["const MEDMEM::MESH&"]="SALOME_MED/MESH"
+cpp2yacs_mapping["const MEDMEM::MESH*"]="SALOME_MED/MESH"
+cpp2yacs_mapping["const MEDMEM::SUPPORT&"]="SALOME_MED/SUPPORT"
+cpp2yacs_mapping["const MEDMEM::SUPPORT*"]="SALOME_MED/SUPPORT"
+cpp2yacs_mapping["const MEDMEM::FIELD<double>*"]="SALOME_MED/FIELDDOUBLE"
+cpp2yacs_mapping["const MEDMEM::FIELD<double>&"]="SALOME_MED/FIELDDOUBLE"
+cpp2yacs_mapping["MEDMEM::FIELD<double>*&"]="SALOME_MED/FIELDDOUBLE"
+
+cpp2yacs_mapping["const std::vector<double>&"]="dblevec"
+
+cpp2yacs_mapping["const std::vector<std::vector<double> >&"]="SALOME/Matrix"
+
+cpp2yacs_mapping["std::vector<double>*&"]="dblevec"
+
+cpp2yacs_mapping["const MEDMEM::FIELD<int>*"]="SALOME_MED/FIELDINT"
+cpp2yacs_mapping["const MEDMEM::FIELD<int>&"]="SALOME_MED/FIELDINT"
+cpp2yacs_mapping["MEDMEM::FIELD<int>*&"]="SALOME_MED/FIELDINT"
+cpp2yacs_mapping["const std::vector<int>&"]="intvec"
+cpp2yacs_mapping["std::vector<int>*&"]="intvec"
+
+cpp2yacs_mapping["void"]="void"
+cpp2yacs_mapping["char*"]="string"
+cpp2yacs_mapping["std::string"]="string"
+cpp2yacs_mapping["MEDMEM::MESH&"]="SALOME_MED/MESH"
+cpp2yacs_mapping["MEDMEM::MESH*"]="SALOME_MED/MESH"
+cpp2yacs_mapping["MEDMEM::SUPPORT*"]="SALOME_MED/SUPPORT"
+cpp2yacs_mapping["MEDMEM::FIELD<double>*"]="SALOME_MED/FIELDDOUBLE"
+cpp2yacs_mapping["MEDMEM::FIELD<double>&"]="SALOME_MED/FIELDDOUBLE"
+cpp2yacs_mapping["MEDMEM::FIELD<int>*"]="SALOME_MED/FIELDINT"
+cpp2yacs_mapping["MEDMEM::FIELD<int>&"]="SALOME_MED/FIELDINT"
+
+cpp2yacs_mapping["std::vector<double>*"]="dblevec"
+cpp2yacs_mapping["std::vector<int>*"]="intvec"
+
+cpp2yacs_mapping["std::vector<std::vector<double> >*"]="SALOME/Matrix"
+cpp2yacs_mapping["std::vector<std::string>"]="stringvec"
+cpp2yacs_mapping["const ParaMEDMEM::MEDCouplingFieldDouble*"]="SALOME_MED/MEDCouplingFieldDoubleCorbaInterface"
+cpp2yacs_mapping["const ParaMEDMEM::MEDCouplingFieldDouble&"]="SALOME_MED/MEDCouplingFieldDoubleCorbaInterface"
+cpp2yacs_mapping["ParaMEDMEM::MEDCouplingFieldDouble*&"]="SALOME_MED/MEDCouplingFieldDoubleCorbaInterface"
+cpp2yacs_mapping["ParaMEDMEM::MEDCouplingUMesh*"]="SALOME_MED/MEDCouplingUMeshCorbaInterface"
+cpp2yacs_mapping["ParaMEDMEM::MEDCouplingFieldDouble*"]="SALOME_MED/MEDCouplingFieldDoubleCorbaInterface"
+# table for c++ code generation : argument's processing
+cpp_impl_a={}
+cpp_impl_a["int"]="\tint _%(arg)s(%(arg)s);\n"
+cpp_impl_a["bool"]="\tbool _%(arg)s(%(arg)s);\n"
+cpp_impl_a["double"]="\tdouble _%(arg)s(%(arg)s);\n"
+cpp_impl_a["float"]="\tfloat _%(arg)s(%(arg)s);\n"
+cpp_impl_a["long"]="\tlong _%(arg)s(%(arg)s);\n"
+cpp_impl_a["short"]="\tshort _%(arg)s(%(arg)s);\n"
+cpp_impl_a["unsigned"]="\tunsigned _%(arg)s(%(arg)s);\n"
+cpp_impl_a["const char*"]="\tconst char* _%(arg)s(%(arg)s);\n"
+cpp_impl_a["const std::string&"]="\tconst std::string _%(arg)s(%(arg)s);\n"
+cpp_impl_a["int&"]="\tint _%(arg)s;\n"
+cpp_impl_a["bool&"]="\tbool _%(arg)s;\n"
+cpp_impl_a["double&"]="\tdouble _%(arg)s;\n"
+cpp_impl_a["float&"]="\tfloat _%(arg)s;\n"
+cpp_impl_a["long&"]="\tlong _%(arg)s;\n"
+cpp_impl_a["short&"]="\tshort _%(arg)s;\n"
+cpp_impl_a["unsigned&"]="\tunsigned _%(arg)s;\n"
+cpp_impl_a["std::string&"]="\tstd::string _%(arg)s;\n"
+cpp_impl_a["const MEDMEM::MESH&"]="\tMEDMEM::MESHClient* _%(arg)s = new MEDMEM::MESHClient(%(arg)s);\n\t _%(arg)s->fillCopy();\n" # MESHClient cannot be created on the stack (private constructor), so we create it on the heap and dereference it later (in treatment 4)
+cpp_impl_a["const MEDMEM::MESH*"]="\tMEDMEM::MESHClient* _%(arg)s = new MEDMEM::MESHClient(%(arg)s);\n\t _%(arg)s->fillCopy();\n"
+cpp_impl_a["const MEDMEM::SUPPORT&"]="\tMEDMEM::SUPPORTClient* _%(arg)s = new MEDMEM::SUPPORTClient(%(arg)s);\n" # SUPPORTClient cannot be created on the stack (protected destructor), so we create it on the heap and dereference it later (in treatment 4)
+cpp_impl_a["const MEDMEM::SUPPORT*"]="\tMEDMEM::SUPPORTClient* _%(arg)s = new MEDMEM::SUPPORTClient(%(arg)s);\n"
+cpp_impl_a["MEDMEM::FIELD<double>*&"]="\tMEDMEM::FIELD<double>* _%(arg)s;\n"
+cpp_impl_a["const MEDMEM::FIELD<double>*"]="\tstd::auto_ptr<MEDMEM::FIELD<double> > _%(arg)s ( new MEDMEM::FIELDClient<double,MEDMEM::FullInterlace>(%(arg)s) );\n"
+cpp_impl_a["const MEDMEM::FIELD<double>&"]="\tMEDMEM::FIELDClient<double,MEDMEM::FullInterlace> _%(arg)s(%(arg)s);\n"
+cpp_impl_a["const std::vector<double>&"]="\tlong _%(arg)s_size=%(arg)s.length();\n\tconst double *_%(arg)s_value = &%(arg)s[0];\n"\
+           "\tstd::vector<double> _%(arg)s(_%(arg)s_value,_%(arg)s_value+_%(arg)s_size);\n"
+cpp_impl_a["std::vector<double>*&"]="\tstd::vector<double>* _%(arg)s;\n"
+cpp_impl_a["const std::vector<std::vector<double> >&"]="\tMatrixClient _%(arg)s_client;\n\tint _%(arg)s_nbRow;\n\tint _%(arg)s_nbCol;\n"\
+           "\tdouble* _%(arg)s_tab = _%(arg)s_client.getValue(%(arg)s,_%(arg)s_nbCol,_%(arg)s_nbRow);\n\tstd::vector<std::vector<double> > _%(arg)s(_%(arg)s_nbRow);\n"\
+           "\tfor (int i=0; i!=_%(arg)s_nbRow; ++i)\n\t{\n\t    _%(arg)s[i].resize(_%(arg)s_nbCol);\n"\
+           "\t    std::copy(_%(arg)s_tab+_%(arg)s_nbCol*i,_%(arg)s_tab+_%(arg)s_nbCol*(i+1), _%(arg)s[i].begin());\n\t}\n\tdelete [] _%(arg)s_tab;\n"
+cpp_impl_a["MEDMEM::FIELD<int>*&"]="\tMEDMEM::FIELD<int>* _%(arg)s;\n"
+cpp_impl_a["const MEDMEM::FIELD<int>*"]="\tstd::auto_ptr<MEDMEM::FIELD<int> > _%(arg)s ( new MEDMEM::FIELDClient<int>(%(arg)s) );\n"
+cpp_impl_a["const MEDMEM::FIELD<int>&"]="\tMEDMEM::FIELDClient<int> _%(arg)s(%(arg)s);\n"
+cpp_impl_a["const std::vector<int>&"]="\tlong _%(arg)s_size=%(arg)s.length();\n"\
+                        "\tstd::vector<int> _%(arg)s(_%(arg)s_size);\n"\
+                        "\tfor (int i=0; i!=_%(arg)s_size; ++i)\n\t    _%(arg)s[i]=%(arg)s[i];"
+cpp_impl_a["std::vector<int>*&"]="\tstd::vector<int>* _%(arg)s;\n"
+cpp_impl_a["const ParaMEDMEM::MEDCouplingFieldDouble*"]="\tParaMEDMEM::MEDCouplingFieldDouble* _%(arg)s=ParaMEDMEM::MEDCouplingFieldDoubleClient::New(%(arg)s);\n"
+cpp_impl_a["const ParaMEDMEM::MEDCouplingFieldDouble&"]="\tParaMEDMEM::MEDCouplingFieldDouble* __%(arg)s=ParaMEDMEM::MEDCouplingFieldDoubleClient::New(%(arg)s);\n"\
+                         "\tParaMEDMEM::MEDCouplingFieldDouble& _%(arg)s=*__%(arg)s;\n"
+cpp_impl_a["ParaMEDMEM::MEDCouplingFieldDouble*&"]="\tParaMEDMEM::MEDCouplingFieldDouble* _%(arg)s;\n"
+
+
+# table for c++ code generation : returned value processing
+cpp_impl_b={}
+cpp_impl_b["void"]=""
+cpp_impl_b["int"]="\tCORBA::Long _rtn_ior(_rtn_cpp);\n"
+cpp_impl_b["bool"]="\tCORBA::Boolean _rtn_ior(_rtn_cpp);\n"
+cpp_impl_b["double"]="\tCORBA::Double _rtn_ior(_rtn_cpp);\n"
+cpp_impl_b["float"]="\tCORBA::Float _rtn_ior(_rtn_cpp);\n"
+cpp_impl_b["long"]="\tCORBA::Long _rtn_ior(_rtn_cpp);\n"
+cpp_impl_b["short"]="\tCORBA::Short _rtn_ior(_rtn_cpp);\n"
+cpp_impl_b["unsigned"]="\tCORBA::ULong _rtn_ior(_rtn_cpp);\n"
+cpp_impl_b["const char*"]="\tchar* _rtn_ior = CORBA::string_dup(_rtn_cpp);\n"
+cpp_impl_b["char*"]="\tchar* _rtn_ior(_rtn_cpp);\n"
+cpp_impl_b["std::string"]="""\tchar* _rtn_ior=CORBA::string_dup(_rtn_cpp.c_str());\n
+\tstd::copy(_rtn_cpp.begin(),_rtn_cpp.end(),_rtn_ior);\n"""
+cpp_impl_b["const MEDMEM::MESH&"]="""\tMEDMEM::MESH_i * _rtn_mesh_i = new MEDMEM::MESH_i(const_cast<MEDMEM::MESH*>(&_rtn_cpp));\n
+\tSALOME_MED::MESH_ptr _rtn_ior = _rtn_mesh_i->_this();\n"""
+cpp_impl_b["MEDMEM::MESH&"]="\tMEDMEM::MESH_i * _rtn_mesh_i = new MEDMEM::MESH_i(&_rtn_cpp);\n\tSALOME_MED::MESH_ptr _rtn_ior = _rtn_mesh_i->_this();\n"
+cpp_impl_b["MEDMEM::MESH*"]= "\tMEDMEM::MESH_i * _rtn_mesh_i = new MEDMEM::MESH_i(_rtn_cpp);\n\tSALOME_MED::MESH_ptr _rtn_ior = _rtn_mesh_i->_this();\n"
+cpp_impl_b["const MEDMEM::MESH*"]="\tMEDMEM::MESH_i * _rtn_mesh_i = new MEDMEM::MESH_i(const_cast<MEDMEM::MESH*>(_rtn_cpp));\n\tSALOME_MED::MESH_ptr _rtn_ior = _rtn_mesh_i->_this();\n"
+cpp_impl_b["MEDMEM::SUPPORT*"]="\tMEDMEM::SUPPORT_i * _rtn_support_i = new MEDMEM::SUPPORT_i(_rtn_cpp);\n\tSALOME_MED::SUPPORT_ptr _rtn_ior = _rtn_support_i->_this();\n"
+cpp_impl_b["const MEDMEM::FIELD<double>*"]="""\tMEDMEM::FIELDTEMPLATE_I<double,MEDMEM::FullInterlace> * _rtn_field_i = new MEDMEM::FIELDTEMPLATE_I<double,MEDMEM::FullInterlace>(const_cast<MEDMEM::FIELD<double>*>(_rtn_cpp),false);\n
+\tSALOME_MED::FIELDDOUBLE_ptr _rtn_ior = _rtn_field_i->_this();\n"""
+cpp_impl_b["MEDMEM::FIELD<double>*"]="""\tMEDMEM::FIELDTEMPLATE_I<double,MEDMEM::FullInterlace> * _rtn_field_i = new MEDMEM::FIELDTEMPLATE_I<double,MEDMEM::FullInterlace>(_rtn_cpp,true);\n
+\tSALOME_MED::FIELDDOUBLE_ptr _rtn_ior = _rtn_field_i->_this();\n"""
+cpp_impl_b["MEDMEM::FIELD<double>&"]="""\tMEDMEM::FIELDTEMPLATE_I<double,MEDMEM::FullInterlace> * _rtn_field_i = new MEDMEM::FIELDTEMPLATE_I<double,MEDMEM::FullInterlace>(&_rtn_cpp,false);\n
+\tSALOME_MED::FIELDDOUBLE_ptr _rtn_ior = _rtn_field_i->_this();\n"""
+cpp_impl_b["const MEDMEM::FIELD<double>&"]="""\tMEDMEM::FIELDTEMPLATE_I<double,MEDMEM::FullInterlace> * _rtn_field_i = new MEDMEM::FIELDTEMPLATE_I<double,MEDMEM::FullInterlace>(const_cast<MEDMEM::FIELD<double>*>(&_rtn_cpp),false);\n
+\tSALOME_MED::FIELDDOUBLE_ptr _rtn_ior = _rtn_field_i->_this();\n"""
+cpp_impl_b["std::vector<double>*"]="""\t%(module)s::dblevec * _rtn_ior = new %(module)s::dblevec;\n
+\tint _rtn_cpp_length=(*_rtn_cpp).size();\n
+\t_rtn_ior->length(_rtn_cpp_length);\n
+\tfor (int i=0; i<_rtn_cpp_length; ++i)\n\t    (*_rtn_ior)[i] = (*_rtn_cpp)[i];\n"""
+cpp_impl_b["std::vector<std::vector<double> >*"]="""\tint _rtn_cpp_i=(*_rtn_cpp).size();\n\tint _rtn_cpp_j=(*_rtn_cpp)[0].size();\n
+\tdouble* _rtn_tab = new double[_rtn_cpp_i*_rtn_cpp_j];\n
+\tfor (int i=0; i!=_rtn_cpp_i; ++i)\n\t    std::copy((*_rtn_cpp)[i].begin(),(*_rtn_cpp)[i].end(),_rtn_tab+i*_rtn_cpp_j);\n
+\tSALOME_Matrix_i* _rtn_matrix_i = new SALOME_Matrix_i(*this,_rtn_tab,_rtn_cpp_i,_rtn_cpp_j,true);\n
+\tSALOME::Matrix_ptr _rtn_ior = _rtn_matrix_i->_this();\n\tdelete _rtn_cpp;\n"""
+cpp_impl_b["const MEDMEM::FIELD<int>*"]="\tMEDMEM::FIELDINT_i * _rtn_field_i = new MEDMEM::FIELDINT_i(const_cast<MEDMEM::FIELD<int>*>(_rtn_cpp),false);\n\tSALOME_MED::FIELDINT_ptr _rtn_ior = _rtn_field_i->_this();\n"
+cpp_impl_b["MEDMEM::FIELD<int>*"]="\tMEDMEM::FIELDINT_i * _rtn_field_i = new MEDMEM::FIELDINT_i(_rtn_cpp,true);\n\tSALOME_MED::FIELDINT_ptr _rtn_ior = _rtn_field_i->_this();\n"
+cpp_impl_b["MEDMEM::FIELD<int>&"]="\tMEDMEM::FIELDINT_i * _rtn_field_i = new MEDMEM::FIELDINT_i(&_rtn_cpp,false);\n\tSALOME_MED::FIELDINT_ptr _rtn_ior = _rtn_field_i->_this();\n"
+cpp_impl_b["const MEDMEM::FIELD<int>&"]="\tMEDMEM::FIELDINT_i * _rtn_field_i = new MEDMEM::FIELDINT_i(const_cast<MEDMEM::FIELD<int>*>(&_rtn_cpp),false);\n\tSALOME_MED::FIELDINT_ptr _rtn_ior = _rtn_field_i->_this();\n"
+cpp_impl_b["std::vector<int>*"]="""\t%(module)s::intvec * _rtn_ior = new %(module)s::intvec;
+\tint _rtn_cpp_length=(*_rtn_cpp).size();
+\t_rtn_ior->length(_rtn_cpp_length);
+\tfor (int i=0; i<_rtn_cpp_length; ++i)\n\t    (*_rtn_ior)[i] = (*_rtn_cpp)[i];\n"""
+cpp_impl_b["std::vector<std::string>"]="""\t%(module)s::stringvec * _rtn_ior = new %(module)s::stringvec;
+\tint _rtn_cpp_length=_rtn_cpp.size();
+\t_rtn_ior->length(_rtn_cpp_length);
+\tfor (int i=0; i<_rtn_cpp_length; ++i)
+\t    (*_rtn_ior)[i] = _rtn_cpp[i].c_str();\n"""
+cpp_impl_b["ParaMEDMEM::MEDCouplingFieldDouble*"]="""\tParaMEDMEM::MEDCouplingFieldDoubleServant * _rtn_field_i = new ParaMEDMEM::MEDCouplingFieldDoubleServant(_rtn_cpp);
+\t_rtn_cpp->decrRef();
+\tSALOME_MED::MEDCouplingFieldDoubleCorbaInterface_ptr _rtn_ior = _rtn_field_i->_this();\n"""
+cpp_impl_b["ParaMEDMEM::MEDCouplingUMesh*"]="""\tParaMEDMEM::MEDCouplingUMeshServant * _rtn_mesh_i = new ParaMEDMEM::MEDCouplingUMeshServant(_rtn_cpp);
+\t_rtn_cpp->decrRef();
+\tSALOME_MED::MEDCouplingUMeshCorbaInterface_ptr _rtn_ior = _rtn_mesh_i->_this();\n"""
+#
+# table for c++ code generation : out parameters processing and removeRef for reference counted objects
+#
+cpp_impl_c={}
+cpp_impl_c["MEDMEM::FIELD<double>*&"]="""\tMEDMEM::FIELDTEMPLATE_I<double,MEDMEM::FullInterlace> * %(arg)s_ior = new MEDMEM::FIELDTEMPLATE_I<double,MEDMEM::FullInterlace>(_%(arg)s, true);\n
+\t%(arg)s = %(arg)s_ior->_this();\n"""
+cpp_impl_c["MEDMEM::FIELD<int>*&"]=""" \tMEDMEM::FIELDINT_i * %(arg)s_ior = new MEDMEM::FIELDINT_i(_%(arg)s, true);\n
+\t%(arg)s = %(arg)s_ior->_this();\n"""
+cpp_impl_c["std::vector<double>*&"]="""\t%(arg)s = new %(module)s::dblevec;\n
+\t%(arg)s->length((*_%(arg)s).size());\n
+\tfor (int i=0; i<(*_%(arg)s).size(); ++i)\n\t    (*%(arg)s)[i] = (*_%(arg)s)[i];\n"""
+cpp_impl_c["std::vector<int>*&"]="""\t%(arg)s = new %(module)s::intvec;\n
+\t%(arg)s->length((*_%(arg)s).size());\n
+\tfor (int i=0; i<(*_%(arg)s).size(); ++i)\n\t    (*%(arg)s)[i] = (*_%(arg)s)[i];\n"""
+cpp_impl_c["std::string&"]="\t%(arg)s = CORBA::string_dup(_%(arg)s.c_str());\n"
+cpp_impl_c["int&"]="\t%(arg)s = _%(arg)s;\n"
+cpp_impl_c["bool&"]="\t%(arg)s = _%(arg)s;\n"
+cpp_impl_c["double&"]="\t%(arg)s = _%(arg)s;\n"
+cpp_impl_c["float&"]="\t%(arg)s = _%(arg)s;\n"
+cpp_impl_c["long&"]="\t%(arg)s = _%(arg)s;\n"
+cpp_impl_c["short&"]="\t%(arg)s = _%(arg)s;\n"
+cpp_impl_c["unsigned&"]="\t%(arg)s = _%(arg)s;\n"
+cpp_impl_c["const MEDMEM::MESH&"]="\t_%(arg)s->removeReference();\n"
+cpp_impl_c["const MEDMEM::MESH*"]="\t_%(arg)s->removeReference();\n"
+cpp_impl_c["const MEDMEM::SUPPORT&"]="\t_%(arg)s->removeReference();\n"
+cpp_impl_c["const MEDMEM::SUPPORT*"]="\t_%(arg)s->removeReference();\n"
+cpp_impl_c["const ParaMEDMEM::MEDCouplingFieldDouble*"]="\t_%(arg)s->decrRef();\n"
+cpp_impl_c["const ParaMEDMEM::MEDCouplingFieldDouble*"]="\t_%(arg)s->decrRef();\n"
+cpp_impl_c["const ParaMEDMEM::MEDCouplingFieldDouble&"]="\t__%(arg)s->decrRef();\n"
+cpp_impl_c["ParaMEDMEM::MEDCouplingFieldDouble*&"]="""\tParaMEDMEM::MEDCouplingFieldDoubleServant * %(arg)s_out=new ParaMEDMEM::MEDCouplingFieldDoubleServant(_%(arg)s);
+\t_%(arg)s->decrRef();
+\t%(arg)s = %(arg)s_out->_this();\n"""
+
+#
+# the following awk files (extracted from hxx2saloe) are used to parse hxx file
+# 
+#
+parse01="""
+# This awk program deletes C like comments '*/  ...  /*'  
+# --
+# Copyright (C) CEA
+# Author : Nicolas Crouzet (CEA)
+# --
+{
+    if (t = index($0, "/*")) {
+       if (t > 1)
+           tmp = substr($0, 1, t - 1)
+       else
+           tmp = ""
+       u = index(substr($0, t + 2), "*/")
+       while (u == 0) {
+           getline
+            t = -1
+            u = index($0, "*/")
+       }
+       if (u <= length($0) - 2)
+           $0 = tmp substr($0, t + u + 3)
+       else
+           $0 = tmp
+    }
+    print $0
+}
+"""
+parse1="""
+# This awk program extract public functions of the class definition present in hxx interface
+# --
+# Copyright (C) CEA
+# Author : Nicolas Crouzet (CEA)
+# --
+
+BEGIN { public=0 }
+
+# we want to extract each function that is public and that does'nt contain
+# the patterns : public, protected, private, // (comments), { and }
+public == 1     && 
+$1 !~ /public/  && 
+$1 !~ /protected/ && 
+$1 !~ /private/ && 
+$1 !~ /\/\/*/   && 
+$1 !~ /{|}/  {
+   for (i=1; i<=NF; i++)
+      printf "%s ", $i
+#  change line if last field contains ";" -> one function per line in output
+   if ( $NF ~ /;/ ) 
+      printf "\\n"
+}
+   
+$1 == "class" && $0 !~ /;/ {public=1} # we test matching against /;/  to get rid of forward declaration
+$1 ~ /public/ {public=1}
+$1 ~ /protected/ {public=0}
+$1 ~ /private/ {public=0}
+$1 ~ /}/      {public=0}
+"""
+parse2="""
+# suppress blanks between type and indirection or reference operators (* and &)
+# --
+# Copyright (C) CEA
+# Author : Nicolas Crouzet (CEA)
+# --
+{ gsub(/[ \\t]+&/,"\\\\& ")
+  gsub(/[ \\t]+\*/,"* ")
+  print $0 }
+"""
+parse3="""
+# This awk program contains the type mapping tables - and the treatments
+# --
+# Copyright (C) CEA, EDF
+# Author : Nicolas Crouzet (CEA)
+# --
+# for code generation
+#
+BEGIN { 
+#
+# file name generation
+  class_i=class_name"_i"
+#
+#
+# type mapping from c++ component to idl
+#
+  idl_arg_type["int"]="in long"
+  idl_arg_type["bool"]="in boolean"
+  idl_arg_type["double"]="in double"
+  idl_arg_type["float"]="in float"
+  idl_arg_type["long"]="in long"
+  idl_arg_type["short"]="in short"
+#  idl_arg_type["unsigned"]="in unsigned long"
+  idl_arg_type["const char*"]="in string"
+  idl_arg_type["const std::string&"]="in string"
+  idl_arg_type["int&"]="out long"
+  idl_arg_type["bool&"]="out boolean"
+  idl_arg_type["double&"]="out double"
+  idl_arg_type["float&"]="out float"
+  idl_arg_type["long&"]="out long"
+  idl_arg_type["short&"]="out short"
+  idl_arg_type["unsigned&"]="out unsigned long"
+  idl_arg_type["std::string&"]="out string"
+  idl_arg_type["const MEDMEM::MESH&"]="in SALOME_MED::MESH"
+  idl_arg_type["const MEDMEM::MESH*"]="in SALOME_MED::MESH"
+  idl_arg_type["const MEDMEM::SUPPORT&"]="in SALOME_MED::SUPPORT"
+  idl_arg_type["const MEDMEM::SUPPORT*"]="in SALOME_MED::SUPPORT"
+  idl_arg_type["const MEDMEM::FIELD<double>*"]="in SALOME_MED::FIELDDOUBLE"
+  idl_arg_type["const MEDMEM::FIELD<double>&"]="in SALOME_MED::FIELDDOUBLE"
+  idl_arg_type["MEDMEM::FIELD<double>*&"]="out SALOME_MED::FIELDDOUBLE"
+  idl_arg_type["const std::vector<double>&"]="in SALOME::vectorOfDouble"
+  idl_arg_type["const std::vector<std::vector<double> >&"]="in SALOME::Matrix"
+  idl_arg_type["std::vector<double>*&"]="out SALOME::vectorOfDouble"
+  idl_arg_type["const MEDMEM::FIELD<int>*"]="in SALOME_MED::FIELDINT"
+  idl_arg_type["const MEDMEM::FIELD<int>&"]="in SALOME_MED::FIELDINT"
+  idl_arg_type["MEDMEM::FIELD<int>*&"]="out SALOME_MED::FIELDINT"
+  idl_arg_type["const std::vector<int>&"]="in SALOME::vectorOfLong"
+  idl_arg_type["std::vector<int>*&"]="out SALOME::vectorOfLong"
+  idl_arg_type["const ParaMEDMEM::MEDCouplingFieldDouble*"]="in SALOME_MED::MEDCouplingFieldDoubleCorbaInterface"
+  idl_arg_type["const ParaMEDMEM::MEDCouplingFieldDouble&"]="in SALOME_MED::MEDCouplingFieldDoubleCorbaInterface"
+  idl_arg_type["ParaMEDMEM::MEDCouplingFieldDouble*&"]="out SALOME_MED::MEDCouplingFieldDoubleCorbaInterface"
+#
+#
+# mapping for returned types
+#
+  idl_rtn_type["void"]="void"
+  idl_rtn_type["int"]="long"
+  idl_rtn_type["bool"]="boolean"
+  idl_rtn_type["double"]="double"
+  idl_rtn_type["float"]="float"
+  idl_rtn_type["long"]="long"
+  idl_rtn_type["short"]="short"
+  idl_rtn_type["unsigned"]="unsigned long"
+  idl_rtn_type["const char*"]="string"
+  idl_rtn_type["char*"]="string"
+  idl_rtn_type["std::string"]="string"
+  idl_rtn_type["const MEDMEM::MESH&"]="SALOME_MED::MESH"
+  idl_rtn_type["MEDMEM::MESH&"]="SALOME_MED::MESH"
+  idl_rtn_type["MEDMEM::MESH*"]="SALOME_MED::MESH"
+  idl_rtn_type["const MEDMEM::MESH*"]="SALOME_MED::MESH"
+  idl_rtn_type["MEDMEM::SUPPORT*"]="SALOME_MED::SUPPORT"
+  idl_rtn_type["const MEDMEM::FIELD<double>*"]="SALOME_MED::FIELDDOUBLE"
+  idl_rtn_type["MEDMEM::FIELD<double>*"]="SALOME_MED::FIELDDOUBLE"
+  idl_rtn_type["MEDMEM::FIELD<double>&"]="SALOME_MED::FIELDDOUBLE"
+  idl_rtn_type["const MEDMEM::FIELD<double>&"]="SALOME_MED::FIELDDOUBLE"
+  idl_rtn_type["std::vector<double>*"]="SALOME::vectorOfDouble"
+  idl_rtn_type["std::vector<std::vector<double> >*"]="SALOME::Matrix"
+  idl_rtn_type["const MEDMEM::FIELD<int>*"]="SALOME_MED::FIELDINT"
+  idl_rtn_type["MEDMEM::FIELD<int>*"]="SALOME_MED::FIELDINT"
+  idl_rtn_type["MEDMEM::FIELD<int>&"]="SALOME_MED::FIELDINT"
+  idl_rtn_type["const MEDMEM::FIELD<int>&"]="SALOME_MED::FIELDINT"
+  idl_rtn_type["std::vector<int>*"]="SALOME::vectorOfLong"
+  idl_rtn_type["std::vector<std::string>"]="StrSeq"
+  idl_rtn_type["ParaMEDMEM::MEDCouplingUMesh*"]="SALOME_MED::MEDCouplingUMeshCorbaInterface"
+  idl_rtn_type["ParaMEDMEM::MEDCouplingFieldDouble*"]="SALOME_MED::MEDCouplingFieldDoubleCorbaInterface"
+#
+#
+# record sep is ");\\n" whith blanks all around, and optional "(" at the beginning
+  RS="[(]?[ \\t]*[)][ \\t]*(const)?[ \\t]*[;][ \\t]*[\\n]"  
+  FS="[ \\t]*[(,][ \\t]*"  # field sep is either "(" or "," surrounded by blanks 
+}
+
+# --------------------- treatment 1 ----------------------------------
+#
+#  extract from fields types, function name, and argument's names
+#
+{
+  print "Function : ",$0 >> "parse_result"  # print for debug
+  for (i=1; i<=NF; i++) {
+      print "\\t-> ",i," : ",$i >> "parse_result"
+  }
+  ok1=0;ok=1
+  error_message="\\t  The non compatible types are : "
+  # check if returned type ($1) is one of the accepted types (idl_rtn_type)
+  for (cpptype in idl_rtn_type) {
+    if ( substr($1,1,length(cpptype)) == cpptype ) {
+      # if compatible, store returned type and function name
+      type[1]=cpptype
+      name[1]=substr($1,length(cpptype)+1)
+      sub("^[ \\t]*","",name[1]) # get rid of leading blanks
+      ok1=1
+      break
+    }
+  }
+  ok*=ok1
+  if ( ! ok1) {
+      split($1,tab," ") 
+      error_message=error_message sprintf("\\n\\t\\t-> %s (return type)",tab[1])
+  }
+  # for each argument ($i), check if it is compatible (belongs to idl_arg_type)
+  for (i=2; i<=NF; i++) {
+    ok2=0
+    split($i,tab,"=") # get rid of default value
+    item=tab[1]
+    sub("/[ \\t]*&[ \\t]*/", "&", item) # supress spaces around * and $
+    sub("/[ \\t]**[ \\t]*/", "*", item)
+    for (cpptype in idl_arg_type) {
+       l = length(cpptype)
+       s0 = substr(item,1,l) # to discriminate between int and int&, ...
+       s1 = " "
+       if (length(item) > l)
+           s1 = substr(item, l+1, 1)
+
+       if ( (s0 == cpptype) && (s1 == " ") ) {
+          # if compatible, store argument type and name
+          type[i]=cpptype
+          name[i]=substr(item,length(cpptype)+1)
+          sub("^[ \\t]*","",name[i]) # get rid of leading blanks
+          if ( length(name[i]) == 0 ) # automatic name if argument's name wasn't precised
+             name[i]=sprintf("_arg%d",i-1)
+          ok2=1
+         break
+       }
+    }
+    ok*=ok2 # ok=0 if one of the type is not compatible
+    if ( ! ok2) {
+       error_message=error_message "\\n\\t\\t-> "item
+    }
+  }
+
+  # print compatibility 
+  if ( $0 !~ class_name ) { # constructor are not considered, but we don't print it
+      if ( ok == 0){ # if one of the c++ type is not compatible
+          printf "     [KO]     :  %s",$0
+      }
+      else
+          printf "     [OK]     :  %s",$0
+       
+      if ( $0 !~ /\(/  ) {
+          printf "(" # if there is no argument, parenthesis was suppressed, so we add it for printing
+      }
+      printf ");\\n"
+      if ( ok == 0){ #print the error message
+          printf "%s\\n\\n",error_message
+      }
+  }    
+  if ( ok == 0) # pass to the next function if one of the c++ type is not compatible
+      next
+}
+#
+# --------------------- treatment 1 bis ------------------------------
+{
+    printf "Function;%s;%s\\n",type[1],name[1] > "parse_type_result"
+    for (i=2; i<=NF; i++) {
+       printf "%s;%s\\n",type[i],name[i] >> "parse_type_result"
+    }
+}
+"""
diff --git a/module_generator/hxx_para_tmpl.py b/module_generator/hxx_para_tmpl.py
new file mode 100644 (file)
index 0000000..e8f60e2
--- /dev/null
@@ -0,0 +1,214 @@
+# Copyright (C) 2009-2012  EDF R&D
+#
+# 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
+#
+
+try:
+  from string import Template
+except:
+  from compat import Template,set
+
+cxxCompo="""
+// this cxx file was generated by yacsgen
+#include "${component}_i.hxx"
+#include "${cxx_include_file}"
+using namespace std;
+#include <string>
+#include <vector>
+#include <pthread.h>
+#include "SenderFactory.hxx"
+#include "MultiCommException.hxx"
+#include "ReceiverFactory.hxx"
+#include "SALOME_Matrix_i.hxx"
+#include "MatrixClient.hxx"
+#include "Utils_CorbaException.hxx"
+#include "MEDCouplingFieldDouble.hxx"
+
+typedef struct
+{
+  bool exception;
+  string msg;
+} except_st;
+
+
+//DEFS
+${servicesdef}
+//ENDDEF
+
+//=============================================================================
+/*!
+ *  standard constructor
+ */
+//=============================================================================
+${component}_i::${component}_i(CORBA::ORB_ptr orb,
+       PortableServer::POA_ptr poa,
+       PortableServer::ObjectId * contId, 
+       const char *instanceName, 
+        const char *interfaceName,
+       bool regist) :
+  ParaMEDMEMComponent_i(orb,poa,contId,instanceName,interfaceName,regist),${inheritedconstructor}cppCompo_(new ${component})
+{
+  MESSAGE("activate object");
+  _thisObj = this ;
+  _id = _poa->activate_object(_thisObj);
+}
+
+${component}_i::~${component}_i()
+{
+}
+
+${servicesimpl}
+
+${thread_impl}
+
+extern "C"
+{
+  PortableServer::ObjectId * ${component}Engine_factory(
+                              CORBA::ORB_ptr orb,
+                              PortableServer::POA_ptr poa, 
+                              PortableServer::ObjectId * contId,
+                              const char *instanceName, 
+                              const char *interfaceName)
+  {
+
+   bool regist;
+   int numproc;
+   int flag;
+
+   MPI_Initialized(&flag);
+   if (!flag) {
+      int argc = 0;
+      char ** argv = NULL;
+      MPI_Init(&argc, &argv);
+   }
+
+   MPI_Comm_rank( MPI_COMM_WORLD, &numproc );
+   if( numproc == 0 )
+      regist = true;
+   else
+      regist = false;
+   ${component}_i * my${component} = new ${component}_i(orb, poa, contId, instanceName, interfaceName, regist);
+   return my${component}->getId();
+  }
+}
+"""
+cxxCompo=Template(cxxCompo)
+
+hxxCompo="""
+//this file was generated by yacsgen
+#ifndef __${component}_hxx2salome__
+#define __${component}_hxx2salome__
+
+#include <SALOMEconfig.h>
+#include "Utils_CorbaException.hxx"
+#include CORBA_SERVER_HEADER(${module})
+#include "Utils_CorbaException.hxx"
+#include <memory>  // for std::auto_ptr
+
+${compodefs}
+
+// thread functions declaration
+${thread_func_decl}
+
+// thread structures declaration
+${thread_str_decl}
+
+class ${component};  // forward declaration
+
+class ${component}_i: ${inheritedclass}
+  public POA_${module}_ORB::${component}_Gen,
+  public ParaMEDMEM::ParaMEDMEMComponent_i
+{
+
+public:
+    ${component}_i(CORBA::ORB_ptr orb,
+           PortableServer::POA_ptr poa,
+           PortableServer::ObjectId * contId, 
+           const char *instanceName, 
+           const char *interfaceName,
+           bool regist);
+    virtual ~${component}_i();
+
+${servicesdef}
+
+// (re)defined methods of Driver
+
+private:
+    std::auto_ptr<${component}> cppCompo_;
+
+};
+
+
+extern "C"
+    PortableServer::ObjectId * ${component}Engine_factory(
+           CORBA::ORB_ptr orb,
+           PortableServer::POA_ptr poa,
+           PortableServer::ObjectId * contId,
+           const char *instanceName,
+           const char *interfaceName);
+
+
+#endif
+"""
+hxxCompo=Template(hxxCompo)
+
+cxxService="""
+${ret} ${component}_i::${service}(${parameters}) throw (SALOME::SALOME_Exception)
+{
+    beginService("${component}_i::${service}");
+    BEGIN_OF("${component}_i::${service}");
+    except_st *est;
+    void *ret_th;
+    pthread_t *th;
+    try
+    {
+${body}
+       endService("${component}_i::${service}");
+       END_OF("${component}_i::${service}");
+
+    }
+    catch (std::exception& ex)
+    {
+        THROW_SALOME_CORBA_EXCEPTION( ex.what(), SALOME::INTERNAL_ERROR );
+    }
+}
+"""
+cxxService=Template(cxxService)
+
+
+compoMakefile="""
+
+dist_lib${component}Engine_la_SOURCES = \
+       ${component}_i.cxx
+
+lib${component}Engine_la_CXXFLAGS = -I$$(top_builddir)/idl  $$(SALOME_INCLUDES) $$(MPI_INCLUDES) ${includes}
+lib${component}Engine_la_LIBADD   = ${libs} -L$$(top_builddir)/idl -lSalomeIDL${module} $${SALOME_LIBS} -lSalomeMPIContainer -lparamedmemcompo $$(FLIBS)
+
+
+"""
+
+#, SALOME_MED::MED_Gen_Driver, SALOME::MultiCommClass
+interfaceidlhxx="""
+  interface ${component}_Gen: ${inherited}
+  {
+${services}
+  };
+"""
+interfaceidlhxx=Template(interfaceidlhxx)
+
+
+compoMakefile=Template(compoMakefile)
diff --git a/module_generator/hxx_tmpl.py b/module_generator/hxx_tmpl.py
new file mode 100644 (file)
index 0000000..b3b3c39
--- /dev/null
@@ -0,0 +1,188 @@
+# Copyright (C) 2009-2012  EDF R&D
+#
+# 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
+#
+
+try:
+  from string import Template
+except:
+  from compat import Template,set
+
+cxxCompo="""
+// this cxx file was generated by yacsgen
+#include "${component}_i.hxx"
+#include "${component}.hxx"
+using namespace std;
+#include <string>
+#include <vector>
+#include "SenderFactory.hxx"
+#include "MultiCommException.hxx"
+#include "ReceiverFactory.hxx"
+#include "SALOME_Matrix_i.hxx"
+#include "MatrixClient.hxx"
+#include "Utils_CorbaException.hxx"
+
+//DEFS
+${servicesdef}
+//ENDDEF
+
+//=============================================================================
+/*!
+ *  standard constructor
+ */
+//=============================================================================
+${component}_i::${component}_i(CORBA::ORB_ptr orb,
+       PortableServer::POA_ptr poa,
+       PortableServer::ObjectId * contId, 
+       const char *instanceName, 
+       const char *interfaceName) :
+  Engines_Component_i(orb, poa, contId, instanceName, interfaceName),${inheritedconstructor}cppCompo_(new ${component})
+{
+  MESSAGE("activate object");
+  _thisObj = this ;
+  _id = _poa->activate_object(_thisObj);
+}
+
+${component}_i::~${component}_i()
+{
+}
+
+${servicesimpl}
+
+char* ${component}_i::ComponentDataType()
+{
+      return CORBA::string_dup("${component}");
+}
+
+Engines::EngineComponent_ptr ${component}_i::GetComponentInstance()
+{
+      return ${component}_Gen::_this();
+}
+
+extern "C"
+{
+  PortableServer::ObjectId * ${component}Engine_factory(
+                              CORBA::ORB_ptr orb,
+                              PortableServer::POA_ptr poa, 
+                              PortableServer::ObjectId * contId,
+                              const char *instanceName, 
+                              const char *interfaceName)
+  {
+    MESSAGE("PortableServer::ObjectId * ${component}Engine_factory()");
+    SCRUTE(interfaceName);
+    ${component}_i * my${component} 
+      = new ${component}_i(orb, poa, contId, instanceName, interfaceName);
+    return my${component}->getId() ;
+  }
+}
+"""
+cxxCompo=Template(cxxCompo)
+
+hxxCompo="""
+//this file was generated by yacsgen
+#ifndef __${component}_hxx2salome__
+#define __${component}_hxx2salome__
+
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(${module})
+#include "SALOME_Component_i.hxx"
+#include "SALOMEMultiComm.hxx"
+#include <memory>  // for std::auto_ptr
+//COMPODEFS
+${compodefs}
+//ENDDEF
+
+class ${component};  // forward declaration
+
+class ${component}_i: ${inheritedclass}
+  public POA_${module}_ORB::${component}_Gen,
+  public Engines_Component_i
+{
+
+public:
+    ${component}_i(CORBA::ORB_ptr orb,
+           PortableServer::POA_ptr poa,
+           PortableServer::ObjectId * contId, 
+           const char *instanceName, 
+           const char *interfaceName);
+    virtual ~${component}_i();
+
+${servicesdef}
+
+// (re)defined methods of Driver
+    virtual Engines::EngineComponent_ptr GetComponentInstance();
+    char* ComponentDataType();
+
+private:
+    std::auto_ptr<${component}> cppCompo_;
+
+};
+
+
+extern "C"
+    PortableServer::ObjectId * ${component}Engine_factory(
+           CORBA::ORB_ptr orb,
+           PortableServer::POA_ptr poa,
+           PortableServer::ObjectId * contId,
+           const char *instanceName,
+           const char *interfaceName);
+
+
+#endif
+"""
+hxxCompo=Template(hxxCompo)
+
+cxxService="""
+${ret} ${component}_i::${service}(${parameters}) throw (SALOME::SALOME_Exception)
+{
+    beginService("${component}_i::${service}");
+    BEGIN_OF("${component}_i::${service}");
+    try
+    {
+${body}
+    }
+    catch (std::exception& ex)
+    {
+        THROW_SALOME_CORBA_EXCEPTION( ex.what(), SALOME::INTERNAL_ERROR );
+    }
+}
+"""
+cxxService=Template(cxxService)
+
+
+compoMakefile="""
+
+dist_lib${component}Engine_la_SOURCES = \
+       ${component}_i.cxx
+
+lib${component}Engine_la_CXXFLAGS = -I$$(top_builddir)/idl  $$(SALOME_INCLUDES) ${includes}
+lib${component}Engine_la_LIBADD   = ${libs} -L$$(top_builddir)/idl -lSalomeIDL${module} $${SALOME_LIBS} $$(FLIBS)
+
+
+"""
+
+#, SALOME_MED::MED_Gen_Driver, SALOME::MultiCommClass
+interfaceidlhxx="""
+  interface ${component}_Gen: ${inherited}
+  {
+${services}
+  };
+"""
+interfaceidlhxx=Template(interfaceidlhxx)
+
+
+compoMakefile=Template(compoMakefile)
diff --git a/module_generator/hxx_tmpl_gui.py b/module_generator/hxx_tmpl_gui.py
new file mode 100644 (file)
index 0000000..2950c5d
--- /dev/null
@@ -0,0 +1,602 @@
+# Copyright (C) 2009-2012  EDF R&D
+#
+# 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
+#
+
+try:
+  from string import Template
+except:
+  from compat import Template,set
+
+hxxgui_cxx="""
+#include "${component_name}GUI.h"
+
+#include <SUIT_MessageBox.h>
+#include <SUIT_ResourceMgr.h>
+#include <SUIT_Desktop.h>
+#include <SUIT_Session.h>
+#include <SalomeApp_Application.h>
+#include <LightApp_Preferences.h>
+
+#include <SALOME_LifeCycleCORBA.hxx>
+
+#define COMPONENT_NAME "${component_name}"
+
+using namespace std;
+
+// Constructor
+${component_name}GUI::${component_name}GUI() :
+  SalomeApp_Module( COMPONENT_NAME ), // Module name
+  LightApp_Module( COMPONENT_NAME )  
+{
+  // Initializations
+  default_bool = false;
+  default_int = 0;
+  default_spinInt = 0;
+  default_spinDbl = 0.;
+  default_selection = QString("");
+  
+  // List for the selector
+  selector_strings.clear();
+  selector_strings.append( tr( "PREF_LIST_TEXT_0" ) );
+  selector_strings.append( tr( "PREF_LIST_TEXT_1" ) );
+  selector_strings.append( tr( "PREF_LIST_TEXT_2" ) );
+}
+
+// Gets a reference to the module's engine
+${component_name}_ORB::${component_name}_Gen_ptr ${component_name}GUI::Init${component_name}Gen( SalomeApp_Application* app )
+{
+  Engines::EngineComponent_var comp = app->lcc()->FindOrLoad_Component( "FactoryServer",COMPONENT_NAME );
+  ${component_name}_ORB::${component_name}_Gen_ptr clr = ${component_name}_ORB::${component_name}_Gen::_narrow(comp);
+  ASSERT(!CORBA::is_nil(clr));
+  return clr;
+}
+
+// Module's initialization
+void ${component_name}GUI::initialize( CAM_Application* app )
+{
+  // Get handle to Application, Desktop and Resource Manager
+  SalomeApp_Module::initialize( app );
+
+  Init${component_name}Gen( dynamic_cast<SalomeApp_Application*>( app ) );
+
+  QWidget* aParent = app->desktop();
+  
+  SUIT_ResourceMgr* aResourceMgr = application()->resourceMgr();
+  
+  // GUI items
+  // --> Create actions: 190 is linked to item in "File" menu 
+  //     and 901 is linked to both specific menu and toolbar
+  createAction( 190, tr( "TLT_MY_NEW_ITEM" ), QIcon(), tr( "MEN_MY_NEW_ITEM" ), tr( "STS_MY_NEW_ITEM" ), 0, aParent, false,
+               this, SLOT( OnMyNewItem() ) );
+
+  QPixmap aPixmap = aResourceMgr->loadPixmap( COMPONENT_NAME,tr( "ICON_${component_name}" ) );
+  createAction( 901, tr( "TLT_${component_name}_ACTION" ), QIcon( aPixmap ), tr( "MEN_${component_name}_ACTION" ), tr( "STS_${component_name}_ACTION" ), 0, aParent, false,
+               this, SLOT( OnCallAction() ) );
+
+  // --> Create item in "File" menu
+  int aMenuId;
+  aMenuId = createMenu( tr( "MEN_FILE" ), -1, -1 );
+  createMenu( separator(), aMenuId, -1, 10 );
+  aMenuId = createMenu( tr( "MEN_FILE_${component_name}" ), aMenuId, -1, 10 );
+  createMenu( 190, aMenuId );
+
+  // --> Create specific menu
+  aMenuId = createMenu( tr( "MEN_${component_name}" ), -1, -1, 30 );
+  createMenu( 901, aMenuId, 10 );
+
+  // --> Create toolbar item
+  int aToolId = createTool ( tr( "TOOL_${component_name}" ) );
+  createTool( 901, aToolId );
+}
+
+// Module's engine IOR
+QString ${component_name}GUI::engineIOR() const
+{
+  CORBA::String_var anIOR = getApp()->orb()->object_to_string( Init${component_name}Gen( getApp() ) );
+  return QString( anIOR.in() );
+}
+
+// Module's activation
+bool ${component_name}GUI::activateModule( SUIT_Study* theStudy )
+{
+  bool bOk = SalomeApp_Module::activateModule( theStudy );
+
+  setMenuShown( true );
+  setToolShown( true );
+
+  return bOk;
+}
+
+// Module's deactivation
+bool ${component_name}GUI::deactivateModule( SUIT_Study* theStudy )
+{
+  setMenuShown( false );
+  setToolShown( false );
+
+  return SalomeApp_Module::deactivateModule( theStudy );
+}
+
+// Default windows
+void ${component_name}GUI::windows( QMap<int, int>& theMap ) const
+{
+  theMap.clear();
+  theMap.insert( SalomeApp_Application::WT_ObjectBrowser, Qt::LeftDockWidgetArea );
+  theMap.insert( SalomeApp_Application::WT_PyConsole,     Qt::BottomDockWidgetArea );
+}
+
+// Action slot: Launched with action 190
+void ${component_name}GUI::OnMyNewItem()
+{
+  SUIT_MessageBox::warning( getApp()->desktop(),tr( "INF_${component_name}_TITLE" ), tr( "INF_${component_name}_TEXT" ), tr( "BUT_OK" ) );
+}
+
+// Action slot: Launched with action 901
+void ${component_name}GUI::OnCallAction()
+{
+  // Create a ${component_name} component
+  ${component_name}_ORB::${component_name}_Gen_ptr ${component_name}gen = ${component_name}GUI::Init${component_name}Gen( getApp() );
+  
+  // Do the job...
+  //
+  // ${component_name}gen->method( arg1, arg2, ... );
+  
+  // Open a dialog showing Preferences values (just to display something)
+  
+  // ****** Direct access to preferences: implementation at 12/12/05 ******
+  // Comment out this section when "preferencesChanged" called back
+  SUIT_ResourceMgr* mgr = SUIT_Session::session()->resourceMgr();
+  
+  default_bool = mgr->booleanValue(COMPONENT_NAME, "default_bool", false);
+
+  default_int = mgr->integerValue(COMPONENT_NAME, "default_integer", 3);
+
+  default_spinInt = mgr->integerValue(COMPONENT_NAME, "default_spinint", 4);
+
+  default_spinDbl = mgr->doubleValue(COMPONENT_NAME, "default_spindbl", 4.5);
+
+  int selectorIndex = mgr->integerValue(COMPONENT_NAME, "default_selector");
+  default_selection = (0<=selectorIndex && selectorIndex<=selector_strings.count() ? selector_strings[selectorIndex]: QString("None"));
+  // ****** End of section to be commented out ******
+  
+  QString SUC = ( default_bool ? QString( tr ("INF_${component_name}_CHECK") ) : QString( tr("INF_${component_name}_UNCHECK") ) ) ;
+    
+  QString textResult = QString( tr( "RES_${component_name}_TEXT" ) ).arg(SUC).arg(default_int).arg(default_spinInt).arg(default_spinDbl).arg(default_selection);
+  SUIT_MessageBox::information( getApp()->desktop(), tr( "RES_${component_name}_TITLE" ), textResult, tr( "BUT_OK" ) );
+}
+
+void ${component_name}GUI::createPreferences()
+{
+  // A sample preference dialog
+  
+  // One only tab
+  int genTab = addPreference( tr( "PREF_TAB_GENERAL" ) );
+
+  // One only group
+  int defaultsGroup = addPreference( tr( "PREF_GROUP_DEFAULTS" ), genTab );
+  
+  // A checkbox
+  addPreference( tr( "PREF_DEFAULT_BOOL" ), defaultsGroup, LightApp_Preferences::Bool, COMPONENT_NAME, "default_bool" );
+  
+  // An entry for integer
+  addPreference( tr( "PREF_DEFAULT_INTEGER" ), defaultsGroup, LightApp_Preferences::Integer, COMPONENT_NAME, "default_integer" );
+
+  // An integer changed by spinbox
+  int spinInt = addPreference( tr( "PREF_DEFAULT_SPININT" ), defaultsGroup, LightApp_Preferences::IntSpin, COMPONENT_NAME, "default_spinint" );
+  setPreferenceProperty( spinInt, "min", 0 );
+  setPreferenceProperty( spinInt, "max", 20 );
+  setPreferenceProperty( spinInt, "step", 2 );
+
+  // A Double changed by spinbox
+  int spinDbl = addPreference( tr( "PREF_DEFAULT_SPINDBL" ), defaultsGroup, LightApp_Preferences::DblSpin, COMPONENT_NAME, "default_spindbl" );
+  setPreferenceProperty( spinDbl, "min", 1 );
+  setPreferenceProperty( spinDbl, "max", 10 );
+  setPreferenceProperty( spinDbl, "step", 0.1 );
+
+  // A choice in a list
+  int options = addPreference( tr( "PREF_DEFAULT_SELECTOR" ), defaultsGroup, LightApp_Preferences::Selector, COMPONENT_NAME, "default_selector" );
+  QList<QVariant> indices;
+  indices.append( 0 );
+  indices.append( 1 );
+  indices.append( 2 );
+  setPreferenceProperty( options, "strings", selector_strings );
+  setPreferenceProperty( options, "indexes", indices );
+}
+
+void ${component_name}GUI::preferencesChanged( const QString& sect, const QString& name )
+{
+// ****** This is normal way: Not yet called back at 12/12/05 ******
+  SUIT_ResourceMgr* mgr = SUIT_Session::session()->resourceMgr();
+  if( sect==COMPONENT_NAME )
+  {
+    if( name=="default_bool" )
+       default_bool = mgr->booleanValue(COMPONENT_NAME, "default_bool", false);
+    if( name=="default_integer" )
+       default_int = mgr->integerValue(COMPONENT_NAME, "default_integer", 3);
+    if( name=="default_spinint" )
+       default_spinInt = mgr->integerValue(COMPONENT_NAME, "default_spinint", 4);
+    if( name=="default_spindbl" )
+       default_spinDbl = mgr->doubleValue(COMPONENT_NAME, "default_spindbl", 4.5);
+    if( name=="default_selector" )
+    {
+       int selectorIndex = mgr->integerValue(COMPONENT_NAME, "default_selector");
+       default_selection = (0<=selectorIndex && selectorIndex<=selector_strings.count() ? selector_strings[selectorIndex]: QString("None"));
+    }
+  }
+}
+
+// Export the module
+extern "C" {
+  CAM_Module* createModule()
+  {
+    return new ${component_name}GUI();
+  }
+}
+"""
+hxxgui_cxx=Template(hxxgui_cxx)
+
+hxxgui_h="""
+#ifndef _${component_name}GUI_H_
+#define _${component_name}GUI_H_
+
+#include <SalomeApp_Module.h>
+
+#include <SALOMEconfig.h>
+#include CORBA_CLIENT_HEADER(${component_name})
+
+class SalomeApp_Application;
+class ${component_name}GUI: public SalomeApp_Module
+{
+  Q_OBJECT
+
+public:
+  ${component_name}GUI();
+
+  void    initialize( CAM_Application* );
+  QString engineIOR() const;
+  void    windows( QMap<int, int>& ) const;
+
+  static ${component_name}_ORB::${component_name}_Gen_ptr Init${component_name}Gen( SalomeApp_Application* );
+
+  virtual void                createPreferences();
+  virtual void                preferencesChanged( const QString&, const QString& );
+
+public slots:
+  bool    deactivateModule( SUIT_Study* );
+  bool    activateModule( SUIT_Study* );
+
+protected slots:
+  void            OnMyNewItem();
+  void            OnCallAction();
+
+private:
+  bool default_bool;
+  int default_int;
+  int default_spinInt;
+  double default_spinDbl;
+  QString default_selection;
+  
+  QStringList selector_strings;
+  
+};
+
+#endif
+"""
+hxxgui_h=Template(hxxgui_h)
+hxxgui_icon_ts="""
+<!DOCTYPE TS>
+<TS version="1.1" >
+    <context>
+        <name>@default</name>
+        <message>
+            <source>ICON_${component_name}</source>
+            <translation>Exec${component_name}.png</translation>
+        </message>
+    </context>
+</TS>
+"""
+hxxgui_icon_ts=Template(hxxgui_icon_ts)
+hxxgui_message_en="""
+<!DOCTYPE TS>
+<TS version="1.1" >
+    <context>
+        <name>@default</name>
+        <message>
+            <source>TLT_MY_NEW_ITEM</source>
+            <translation>A ${component_name} owned menu item</translation>
+        </message>
+        <message>
+            <source>MEN_MY_NEW_ITEM</source>
+            <translation>My menu</translation>
+        </message>
+        <message>
+            <source>STS_MY_NEW_ITEM</source>
+            <translation>Display a simple dialog</translation>
+        </message>
+        <message>
+            <source>TLT_${component_name}_ACTION</source>
+            <translation>Open ${component_name} dialog</translation>
+        </message>
+        <message>
+            <source>MEN_FILE</source>
+            <translation>File</translation>
+        </message>
+        <message>
+            <source>MEN_FILE_${component_name}</source>
+            <translation>${component_name} menu</translation>
+        </message>
+        <message>
+            <source>MEN_${component_name}</source>
+            <translation>${component_name}</translation>
+        </message>
+        <message>
+            <source>TOOL_${component_name}</source>
+            <translation>${component_name}</translation>
+        </message>
+    </context>
+    <context>
+        <name>${component_name}GUI</name>
+        <message>
+            <source>BUT_OK</source>
+            <translation>OK</translation>
+        </message>
+        <message>
+            <source>BUT_CANCEL</source>
+            <translation>Cancel</translation>
+        </message>
+        <message>
+            <source>INF_${component_name}_TITLE</source>
+            <translation>${component_name} Information</translation>
+        </message>
+        <message>
+            <source>INF_${component_name}_TEXT</source>
+            <translation>This is just a test</translation>
+        </message>
+        <message>
+            <source>INF_${component_name}_CHECK</source>
+            <translation>checked</translation>
+        </message>
+        <message>
+            <source>INF_${component_name}_UNCHECK</source>
+            <translation>Unchecked</translation>
+        </message>
+        <message>
+            <source>RES_${component_name}_TITLE</source>
+            <translation>Sample ${component_name} dialog</translation>
+        </message>
+        <message>
+            <source>RES_${component_name}_TEXT</source>
+            <translation>Preferences are: \n\tCheckbox: %1\n\tInteger: %2\n\tInteger2: %3\n\tDouble: %4\n\tText: %5</translation>
+        </message>
+        <message>
+            <source>PREF_TAB_GENERAL</source>
+            <translation>General</translation>
+        </message>
+        <message>
+            <source>PREF_GROUP_DEFAULTS</source>
+            <translation>Default Values</translation>
+        </message>
+        <message>
+            <source>PREF_DEFAULT_BOOL</source>
+            <translation>Check me</translation>
+        </message>
+        <message>
+            <source>PREF_DEFAULT_INTEGER</source>
+            <translation>Enter an integer :</translation>
+        </message>
+        <message>
+            <source>PREF_DEFAULT_SPININT</source>
+            <translation>Click arrows (integer) :</translation>
+        </message>
+        <message>
+            <source>PREF_DEFAULT_SPINDBL</source>
+            <translation>Click arrows (double)</translation>
+        </message>
+        <message>
+            <source>PREF_DEFAULT_SELECTOR</source>
+            <translation>Select an option</translation>
+        </message>
+        <message>
+            <source>PREF_LIST_TEXT_0</source>
+            <translation>first option</translation>
+        </message>
+        <message>
+            <source>PREF_LIST_TEXT_1</source>
+            <translation>second option</translation>
+        </message>
+        <message>
+            <source>PREF_LIST_TEXT_2</source>
+            <translation>third option</translation>
+        </message>
+    </context>
+</TS>
+"""
+hxxgui_message_en=Template(hxxgui_message_en)
+hxxgui_message_fr="""
+<!DOCTYPE TS>
+<TS version="1.1" >
+    <context>
+        <name>@default</name>
+        <message>
+            <source>TLT_MY_NEW_ITEM</source>
+            <translation>Un article de menu propre a ${component_name}</translation>
+        </message>
+        <message>
+            <source>MEN_MY_NEW_ITEM</source>
+            <translation>Mon menu</translation>
+        </message>
+        <message>
+            <source>STS_MY_NEW_ITEM</source>
+            <translation>Affiche une boite de dialogue simple</translation>
+        </message>
+        <message>
+            <source>TLT_${component_name}_ACTION</source>
+            <translation>Ouvre la boite de dialogue de ${component_name}</translation>
+        </message>
+        <message>
+            <source>MEN_FILE</source>
+            <translation>File</translation>
+        </message>
+        <message>
+            <source>MEN_FILE_${component_name}</source>
+            <translation>Menu de ${component_name}</translation>
+        </message>
+        <message>
+            <source>MEN_${component_name}</source>
+            <translation>${component_name}</translation>
+        </message>
+        <message>
+            <source>TOOL_${component_name}</source>
+            <translation>${component_name}</translation>
+        </message>
+    </context>
+    <context>
+        <name>${component_name}GUI</name>
+        <message>
+            <source>BUT_OK</source>
+            <translation>OK</translation>
+        </message>
+        <message>
+            <source>BUT_CANCEL</source>
+            <translation>Annuler</translation>
+        </message>
+        <message>
+            <source>INF_${component_name}_TITLE</source>
+            <translation>Information ${component_name}</translation>
+        </message>
+        <message>
+            <source>INF_${component_name}_TEXT</source>
+            <translation>Ceci est un simple test</translation>
+        </message>
+        <message>
+            <source>INF_${component_name}_CHECK</source>
+            <translation>coche</translation>
+        </message>
+        <message>
+            <source>INF_${component_name}_UNCHECK</source>
+            <translation>decoche</translation>
+        </message>
+        <message>
+            <source>RES_${component_name}_TITLE</source>
+            <translation>Dialogue example de ${component_name}</translation>
+        </message>
+        <message>
+            <source>RES_${component_name}_TEXT</source>
+            <translation>Les preferences sont : \n\tCase a cocher : %1\n\tEntier : %2\n\tEntier2 : %3\n\tDouble : %4\n\tTexte : %5</translation>
+        </message>
+        <message>
+            <source>PREF_TAB_GENERAL</source>
+            <translation>General</translation>
+        </message>
+        <message>
+            <source>PREF_GROUP_DEFAULTS</source>
+            <translation>valeur par defaut</translation>
+        </message>
+        <message>
+            <source>PREF_DEFAULT_BOOL</source>
+            <translation>Cochez-moi</translation>
+        </message>
+        <message>
+            <source>PREF_DEFAULT_INTEGER</source>
+            <translation>Entrez un entier :</translation>
+        </message>
+        <message>
+            <source>PREF_DEFAULT_SPININT</source>
+            <translation>cliquez sur les fleches (entier)</translation>
+        </message>
+        <message>
+            <source>PREF_DEFAULT_SPINDBL</source>
+            <translation>cliquez sur les fleches (double)</translation>
+        </message>
+        <message>
+            <source>PREF_DEFAULT_SELECTOR</source>
+            <translation>Choisissez une option</translation>
+        </message>
+        <message>
+            <source>PREF_LIST_TEXT_0</source>
+            <translation>premiere option</translation>
+        </message>
+        <message>
+            <source>PREF_LIST_TEXT_1</source>
+            <translation>deuxieme option</translation>
+        </message>
+        <message>
+            <source>PREF_LIST_TEXT_2</source>
+            <translation>troisieme option</translation>
+        </message>
+    </context>
+</TS>
+"""
+hxxgui_message_fr=Template(hxxgui_message_fr)
+hxxgui_config="""
+language=en
+"""
+hxxgui_config=Template(hxxgui_config)
+hxxgui_xml_en="""
+<?xml version='1.0' encoding='us-ascii'?>
+<!DOCTYPE application PUBLIC "" "desktop.dtd">
+<application title="${component_name} component" date="9/12/2001" author="C Caremoli" appId="${component_name}" >
+<desktop>
+<!-- ### MENUBAR ###  -->
+<menubar>
+
+ <menu-item label-id="File" item-id="1" pos-id="">
+  <submenu label-id="Hello" item-id="19" pos-id="9">
+   <popup-item item-id="190" pos-id="" label-id="MyNewItem" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+  </submenu>
+  <endsubmenu />
+ </menu-item>
+
+ <menu-item label-id="${component_name}" item-id="90" pos-id="3">
+  <popup-item item-id="901" label-id="Get banner" icon-id="" tooltip-id="Get ${component_name} banner" accel-id="" toggle-id="" execute-action=""/>
+
+ </menu-item>
+</menubar>
+<!-- ### TOOLBAR ###  -->
+<toolbar label-id="${component_name}">
+ <toolbutton-item item-id="901" label-id="Get banner" icon-id="Exec${component_name}.png" tooltip-id="Get ${component_name} banner" accel-id="" toggle-id="" execute-action=""/>
+</toolbar>
+</desktop>
+</application>
+"""
+hxxgui_xml_en=Template(hxxgui_xml_en)
+hxxgui_xml_fr="""
+<?xml version='1.0' encoding='us-ascii'?>
+<!DOCTYPE application PUBLIC "" "desktop.dtd">
+<application title="${component_name} component" date="9/12/2001" author="C Caremoli" appId="${component_name}" >
+<desktop>
+<!-- ### MENUBAR ###  -->
+<menubar>
+ <menu-item label-id="File" item-id="1" pos-id="">
+  <submenu label-id="Hello" item-id="19" pos-id="9">
+   <popup-item item-id="190" pos-id="" label-id="MyNewItem" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+  </submenu>
+  <endsubmenu />
+ </menu-item>
+ <menu-item label-id="${component_name}" item-id="90" pos-id="3">
+  <popup-item item-id="941" label-id="Lancer IHM" icon-id="" tooltip-id="Lancer IHM ${component_name}" accel-id="" toggle-id="" execute-action=""/>
+ </menu-item>
+</menubar>
+<!-- ### TOOLBAR ###  -->
+<toolbar label-id="${component_name}">
+ <toolbutton-item item-id="941" label-id="Lancer IHM" icon-id="Exec${component_name}.png" tooltip-id="Lancer IHM ${component_name}" accel-id="" toggle-id="" execute-action=""/>
+</toolbar>
+</desktop>
+</application>
+"""
+hxxgui_xml_fr=Template(hxxgui_xml_fr)
+
diff --git a/module_generator/hxxcompo.py b/module_generator/hxxcompo.py
new file mode 100644 (file)
index 0000000..9b2e32e
--- /dev/null
@@ -0,0 +1,479 @@
+# Copyright (C) 2009-2012  EDF R&D
+#
+# 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
+#
+"""
+  Module that generates SALOME c++ Component from a non SALOME c++ component 
+  (its header and its shares library)
+"""
+
+debug=1
+import os
+import string
+import fnmatch
+from tempfile import mkstemp
+from gener import Component, Invalid
+from hxx_tmpl import cxxService, hxxCompo, cxxCompo, compoMakefile
+from module_generator import Service
+from yacstypes import corba_rtn_type,moduleTypes
+from hxx_awk import parse01,parse1,parse2,parse3
+from hxx_awk import cpp2idl_mapping
+# these tables contain the part of code which depends upon c++ types
+from hxx_awk import cpp_impl_a,cpp_impl_b,cpp_impl_c  
+from hxx_awk import cpp2yacs_mapping
+from tempfile import mkdtemp
+from hxx_tmpl_gui import hxxgui_cxx, hxxgui_h, hxxgui_icon_ts
+from hxx_tmpl_gui import hxxgui_message_en, hxxgui_message_fr
+from hxx_tmpl_gui import hxxgui_config, hxxgui_xml_fr, hxxgui_xml_en
+
+# ------------------------------------------------------------------------------
+
+class HXX2SALOMEComponent(Component):
+  def __init__(self, hxxfile , cpplib , cpp_path ):
+    # search a file within a directory tree
+    def search_file(pattern, root):
+        matches = []
+        for path, dirs, files in os.walk(os.path.abspath(root)):
+            for filename in fnmatch.filter(files, pattern):
+                 matches.append(os.path.join(path, filename))
+        return matches
+
+    hxxfileful = search_file(hxxfile,cpp_path)
+    cpplibful = search_file(cpplib,cpp_path)
+    format_error = 'Error in HXX2SALOMEComponent : file %s ot found in %s'
+    assert len(hxxfileful) > 0, format_error %  (hxxfile, cpp_path)
+    assert len(cpplibful) > 0, format_error % (cpplib, cpp_path)
+    hxxfile = hxxfileful[0]
+    cpplib = cpplibful[0]
+
+    # grab name of c++ component
+    cmd1="""awk '$1 == "class" && $0 !~ /;/ {print $2}' """ + hxxfile +\
+         """|awk -F: '{printf "%s",$1}' """
+    f=os.popen(cmd1)
+    class_name=f.readlines()[0]
+    name=class_name
+    print "classname=",class_name
+    f.close()
+
+    # create temporary awk files for the parsing
+    (fd01,p01n)=mkstemp()
+    f01=os.fdopen(fd01,"w")
+    f01.write(parse01)
+    f01.close()
+
+    (fd1,p1n)=mkstemp()
+    f1=os.fdopen(fd1,"w")
+    f1.write(parse1)
+    f1.close()
+
+    (fd2,p2n)=mkstemp()
+    f2=os.fdopen(fd2,"w")
+    f2.write(parse2)
+    f2.close()
+
+    (fd3,p3n)=mkstemp()
+    f3=os.fdopen(fd3,"w")
+    f3.write(parse3)
+    f3.close()
+
+    # awk parsing of hxx files - 
+    # result written in file parse_type_result
+    cmd2 = [
+        "cat %s" % hxxfile,
+        "awk -f %s" % p01n,
+        "sed 's/virtual //g'",
+        "sed 's/MEDMEM_EXPORT//g'",
+        "sed 's/throw.*;/;/g'",
+        "awk -f %s" % p1n,
+        "awk -f %s" % p2n,
+        "awk -v class_name=%s -f %s" % (class_name, p3n) ]
+    cmd2 = ' | '.join(cmd2)
+
+    os.system(cmd2)
+    os.remove(p01n)
+    os.remove(p1n)
+    os.remove(p2n)
+    os.remove(p3n)
+
+    # Retrieve the information which was generated in 
+    # the file parse_type_result.
+    # The structure of the file is :
+    #
+    #   Function  return_type   function_name
+    #   [arg1_type  arg1_name]
+    #   [arg2_type  arg2_name]
+    #   ...
+    # The service names are stored in list_of_services
+    # The information relative to a service (called service_name) is stored in
+    # the dictionnary service_definition[service_name]
+    list_of_services=[]
+    service_definition={}
+    result_parsing=open("parse_type_result","r")
+    for line in result_parsing.readlines():
+        line=line[0:-1] # get rid of trailing \n
+        words = string.split(line,';')
+
+        if len(words) >=3 and words[0] == "Function": # detect a new service
+            function_name=words[2]
+            # store the name of new service
+            list_of_services.append(function_name) 
+            # create a dict to store informations relative to this service
+            service_definition[function_name]={} 
+            service_definition[function_name]["ret"]=words[1]  # return type
+            service_definition[function_name]["inports"]=[]
+            service_definition[function_name]["outports"]=[]
+            service_definition[function_name]["ports"]=[]
+            service_definition[function_name]["impl"]=[]
+
+        # an argument type and argument name of the current service
+        if len(words) == 2:  
+            current_service=list_of_services[-1]
+            current_service_dict=service_definition[current_service]
+            typename=words[0]
+            argname=words[1]
+            # store in c++ order the arg names
+            current_service_dict["ports"].append( (argname,typename) ) 
+
+            # separate in from out parameters
+            inout=cpp2idl_mapping[typename][0:2]
+            assert inout=="in" or inout=="ou",'Error in table cpp2idl_mapping'
+            if inout == "in":
+                current_service_dict["inports"].append((argname, typename) )
+            else:
+                current_service_dict["outports"].append((argname, typename) )
+    #
+    # For each service : 
+    #  - generate implementation of c++ servant
+    #  - store it in service_definition[serv]["impl"]
+    for serv in list_of_services:
+        if debug:
+            print "service : ",serv
+            print "  inports  -> ",service_definition[serv]["inports"]
+            print "  outports -> ",service_definition[serv]["outports"]
+            print "  return   -> ",service_definition[serv]["ret"]
+
+
+        # Part 1 : Argument pre-processing
+        s_argument_processing="//\tArguments processing\n"
+        for (argname,argtype) in service_definition[serv]["inports"] + \
+                                 service_definition[serv]["outports"]:
+            format=cpp_impl_a[argtype]
+            s_argument_processing += format % {"arg" : argname }
+
+        # if there was no args
+        if s_argument_processing=="//\tArguments processing\n": 
+            s_argument_processing=""
+
+
+        # Part 2 : Call to the underlying c++ function
+        s_call_cpp_function="//\tCall cpp component\n\t"
+        rtn_type=service_definition[serv]["ret"]
+
+        # if return type is void, the call syntax is different
+        if rtn_type == "void" : 
+            s_call_cpp_function += "cppCompo_->%s(" % serv
+        else:
+            s_call_cpp_function +=\
+                "%s _rtn_cpp = cppCompo_->%s(" % (rtn_type ,serv )
+
+        for (argname,argtype) in service_definition[serv]["ports"]:
+              # special treatment for some arguments
+              post=""
+              pre=""
+
+              if string.find(cpp_impl_a[argtype],"auto_ptr" ) != -1 :
+                  # for auto_ptr argument, retrieve the raw pointer behind
+                  post=".get()" 
+              if  argtype == "const MEDMEM::MESH&"  or  \
+                  argtype == "const MEDMEM::SUPPORT&" : 
+                  # we cannot create MESHClient on the stack 
+                  # (private constructor!), 
+                  # so we create it on the heap and dereference it
+                  pre="*"  
+
+              post+="," # separator between arguments
+              s_call_cpp_function += " %s_%s%s" % ( pre,argname,post)
+        if s_call_cpp_function[-1]==',':
+            # get rid of trailing comma
+            s_call_cpp_function=s_call_cpp_function[0:-1] 
+
+        s_call_cpp_function=s_call_cpp_function+');\n'
+
+        # Part 3.a : Out Argument Post-processing
+        s_argument_postprocessing="//\tPost-processing & return\n"
+        for (argname,argtype) in service_definition[serv]["outports"]:
+            format=cpp_impl_c[argtype]
+            # the treatment of %(module) is postponed in makecxx() 
+            # because we don't know here the module name
+            s_argument_postprocessing += \
+                format % {"arg" : argname, "module" : "%(module)s" } 
+
+        # Part 3.b : In Argument Post-processing
+        for (argname,argtype) in service_definition[serv]["inports"]:
+            # not all in types require a treatment
+            if cpp_impl_c.has_key(argtype): 
+                format=cpp_impl_c[argtype]
+                # id : treatment of %(module) is postponed in makecxx
+                s_argument_postprocessing += \
+                        format % {"arg" : argname, "module" : "%(module)s" } 
+
+        # Part 3.c : return processing
+        s_rtn_processing=cpp_impl_b[rtn_type]
+
+        format_end_serv = "\tendService(\"%(class_name)s_i::%(serv_name)s\");"
+        format_end_serv += "\n\tEND_OF(\"%(class_name)s_i::%(serv_name)s\");\n"
+        s_rtn_processing += format_end_serv %\
+                { "serv_name" : serv, "class_name" : class_name }
+
+        if  rtn_type != "void":
+            s_rtn_processing += "\treturn _rtn_ior;"
+
+        service_definition[serv]["impl"] = s_argument_processing + \
+                                           s_call_cpp_function + \
+                                           s_argument_postprocessing + \
+                                           s_rtn_processing
+        if debug:
+            print "implementation :\n",service_definition[serv]["impl"]
+
+    #
+    # Create a list of Service objects (called services), 
+    # and give it to Component constructor
+    #
+    services=[]
+    self.use_medmem=False
+    self.use_medcoupling=False
+    for serv in list_of_services:
+        # for inports and outports, Service class expects a list of tuples, 
+        # each tuple containing the name and the yacs type of the port
+        # thus we need to convert c++ types to yacs types  
+        # (we use for that the cpp2yacs_mapping table)
+        inports=[]
+        for op in service_definition[serv]["inports"]:
+            inports.append([op[0], cpp2yacs_mapping[op[1]] ] )
+
+        outports = []
+        for op in service_definition[serv]["outports"]:
+            outports.append([op[0], cpp2yacs_mapping[op[1]] ] )
+
+        Return="void"
+        if service_definition[serv]["ret"] != "void":
+            Return=cpp2yacs_mapping[service_definition[serv]["ret"]]
+
+        # find out if component uses medmem types and/or medcoupling types
+        for (argname,argtype) in inports + outports + [("return",Return)]:
+            if moduleTypes[argtype]=="MED":
+                if argtype.count("Coupling")>0:
+                    self.use_medcoupling=True
+                else:
+                    self.use_medmem=True
+                break
+
+        code=service_definition[serv]["impl"]
+        if debug:
+            print "service : ",serv
+            print "  inports  -> ",service_definition[serv]["inports"]
+            print "  converted inports  -> ",inports
+            print "  outports -> ",service_definition[serv]["outports"]
+            print "  converted outports  -> ",outports
+            print "  Return  -> ",service_definition[serv]["ret"]
+            print "  converted Return  -> ",Return
+
+        services.append(Service(serv, 
+           inport=inports, 
+           outport=outports,
+           ret=Return, 
+           defs="", 
+           body=code,
+           ) )
+
+    Includes="-I${"+name+"CPP_ROOT_DIR}/include"
+    Libs="-L${"+name+"CPP_ROOT_DIR}/lib -l"+name+"CXX"
+    Compodefs=""
+    Inheritedclass=""
+    self.inheritedconstructor=""
+    if self.use_medmem:
+        Compodefs="""
+#include CORBA_CLIENT_HEADER(MED)
+#include CORBA_CLIENT_HEADER(MED_Gen)
+#include "FIELDClient.hxx"
+#include "MESHClient.hxx"
+#include "MEDMEM_Support_i.hxx"
+#include "MEDMEM_Mesh_i.hxx"
+#include "MEDMEM_FieldTemplate_i.hxx"
+#include "Med_Gen_Driver_i.hxx"
+"""
+        Inheritedclass="Med_Gen_Driver_i, public SALOMEMultiComm"
+        self.inheritedconstructor="Med_Gen_Driver_i(orb),"
+
+    if self.use_medcoupling:
+        Compodefs+="""
+#include CORBA_CLIENT_HEADER(MEDCouplingCorbaServant)
+#include CORBA_CLIENT_HEADER(MED_Gen)
+#include "MEDCouplingFieldDoubleServant.hxx"
+#include "MEDCouplingUMeshServant.hxx"
+#include "MEDCouplingFieldDouble.hxx"
+#include "MEDCouplingUMesh.hxx"
+#include "MEDCouplingUMeshClient.hxx"
+#include "MEDCouplingFieldDouble.hxx"
+#include "MEDCouplingFieldDoubleClient.hxx"
+"""
+
+    Component.__init__(self, name, services, impl="CPP", libs=Libs,
+                             rlibs="", includes=Includes, kind="lib",
+                             sources=None,inheritedclass=Inheritedclass,
+                             compodefs=Compodefs)
+
+# ------------------------------------------------------------------------------
+  def makeCompo(self, gen):
+    """generate files for C++ component
+       return a dict where key is the file name and 
+       value is the content of the file
+    """
+    cxxfile = "%s_i.cxx" % self.name
+    hxxfile = "%s_i.hxx" % self.name
+    return {"Makefile.am":gen.makeMakefile(self.getMakefileItems(gen)),
+            cxxfile:self.makecxx(gen),
+            hxxfile:self.makehxx(gen)
+           }
+
+# ------------------------------------------------------------------------------
+  def getMakefileItems(self,gen):
+      makefileItems={"header":"""
+include $(top_srcdir)/adm_local/make_common_starter.am
+
+"""}
+      makefileItems["lib_LTLIBRARIES"]=["lib"+self.name+"Engine.la"]
+      makefileItems["salomeinclude_HEADERS"]=["%s_i.hxx" % self.name]
+      makefileItems["body"]=compoMakefile.substitute(module=gen.module.name,
+                                                     component=self.name,
+                                                     libs=self.libs,
+                                                     includes=self.includes)
+      return makefileItems
+
+# ------------------------------------------------------------------------------
+  def makehxx(self, gen):
+    """return a string that is the content of .hxx file
+    """
+    services = []
+    for serv in self.services:
+      service = "    %s %s(" % (corba_rtn_type(serv.ret,gen.module.name),
+                                serv.name)
+      service = service+gen.makeArgs(serv)+") throw (SALOME::SALOME_Exception);"
+      services.append(service)
+    servicesdef = "\n".join(services)
+
+    inheritedclass=self.inheritedclass
+    if self.inheritedclass:
+      inheritedclass= " public virtual " + self.inheritedclass + ","
+
+    return hxxCompo.substitute(component=self.name, 
+                               module=gen.module.name,
+                               servicesdef=servicesdef, 
+                               inheritedclass=inheritedclass,
+                               compodefs=self.compodefs)
+
+# ------------------------------------------------------------------------------
+  def makecxx(self, gen, exe=0):
+    """return a string that is the content of .cxx file
+    """
+    services = []
+    inits = []
+    defs = []
+    for serv in self.services:
+      defs.append(serv.defs)
+      print "CNC bug : ",serv.body
+      service = cxxService.substitute(
+                           component=self.name, 
+                           service=serv.name,
+                           ret=corba_rtn_type(serv.ret,gen.module.name),
+                           parameters=gen.makeArgs(serv),
+                           body=serv.body % {"module":gen.module.name+"_ORB"} )
+      services.append(service)
+    return cxxCompo.substitute(component=self.name, 
+                               inheritedconstructor=self.inheritedconstructor,
+                               servicesdef="\n".join(defs),
+                               servicesimpl="\n".join(services))
+
+# ------------------------------------------------------------------------------
+  def getGUIfilesTemplate(self):
+      """generate in a temporary directory files for a generic GUI, 
+         and return a list with file names.
+         it is the responsability of the user to get rid 
+         of the temporary directory when finished
+      """
+      gui_cxx=hxxgui_cxx.substitute(component_name=self.name)
+      gui_h=hxxgui_h.substitute(component_name=self.name)
+      gui_icon_ts=hxxgui_icon_ts.substitute(component_name=self.name)
+      gui_message_en=hxxgui_message_en.substitute(component_name=self.name)
+      gui_message_fr=hxxgui_message_fr.substitute(component_name=self.name)
+      gui_config=hxxgui_config.substitute(component_name=self.name)
+      gui_xml_fr=hxxgui_xml_fr.substitute(component_name=self.name)
+      gui_xml_en=hxxgui_xml_en.substitute(component_name=self.name)
+      temp_dir=mkdtemp()
+      gui_cxx_file_name=os.path.join(temp_dir,self.name+"GUI.cxx")
+      gui_h_file_name=os.path.join(temp_dir,self.name+"GUI.h")
+      gui_icon_ts_file_name=os.path.join(temp_dir,self.name+"_icons.ts")
+      gui_message_en_file_name=os.path.join(temp_dir,self.name+"_msg_en.ts")
+      gui_message_fr_file_name=os.path.join(temp_dir,self.name+"_msg_fr.ts")
+      gui_config_file_name=os.path.join(temp_dir,"config")
+      gui_xml_fr_file_name=os.path.join(temp_dir,self.name+"_en.xml")
+      gui_xml_en_file_name=os.path.join(temp_dir,self.name+"_fr.xml")
+
+      list_of_gui_names=[]
+
+      gui_cxx_file=open(gui_cxx_file_name,"w")
+      gui_cxx_file.write(gui_cxx)
+      gui_cxx_file.close()
+      list_of_gui_names.append(gui_cxx_file_name)
+
+      gui_h_file=open(gui_h_file_name,"w")
+      gui_h_file.write(gui_h)
+      gui_h_file.close()
+      list_of_gui_names.append(gui_h_file_name)
+
+      gui_icon_ts_file=open(gui_icon_ts_file_name,"w")
+      gui_icon_ts_file.write(gui_icon_ts)
+      gui_icon_ts_file.close()
+      list_of_gui_names.append(gui_icon_ts_file_name)
+
+      gui_message_en_file=open(gui_message_en_file_name,"w")
+      gui_message_en_file.write(gui_message_en)
+      gui_message_en_file.close()
+      list_of_gui_names.append(gui_message_en_file_name)
+
+      gui_message_fr_file=open(gui_message_fr_file_name,"w")
+      gui_message_fr_file.write(gui_message_fr)
+      gui_message_fr_file.close()
+      list_of_gui_names.append(gui_message_fr_file_name)
+
+      gui_config_file=open(gui_config_file_name,"w")
+      gui_config_file.write(gui_config)
+      gui_config_file.close()
+      list_of_gui_names.append(gui_config_file_name)
+
+      gui_xml_fr_file=open(gui_xml_fr_file_name,"w")
+      gui_xml_fr_file.write(gui_xml_fr)
+      gui_xml_fr_file.close()
+      list_of_gui_names.append(gui_xml_fr_file_name)
+
+      gui_xml_en_file=open(gui_xml_en_file_name,"w")
+      gui_xml_en_file.write(gui_xml_en)
+      gui_xml_en_file.close()
+      list_of_gui_names.append(gui_xml_en_file_name)
+
+
+      return list_of_gui_names
diff --git a/module_generator/hxxparacompo.py b/module_generator/hxxparacompo.py
new file mode 100644 (file)
index 0000000..2b0478a
--- /dev/null
@@ -0,0 +1,439 @@
+# Copyright (C) 2009-2012  EDF R&D
+#
+# 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
+#
+"""
+  Module that generates SALOME c++ Component from a non SALOME c++ component (its header and its shares library)
+"""
+
+debug=1
+import os
+from gener import Component, Invalid
+from hxx_para_tmpl import cxxService, hxxCompo, cxxCompo, compoMakefile
+from module_generator import Service
+import string
+from tempfile import mkstemp
+from yacstypes import corba_rtn_type,moduleTypes
+
+class HXX2SALOMEParaComponent(Component):
+  def __init__(self, hxxfile , cpplib , cpp_path ):
+    # search a file within a directory tree
+    import fnmatch
+    def search_file(pattern, root):
+        matches = []
+        for path, dirs, files in os.walk(os.path.abspath(root)):
+            for filename in fnmatch.filter(files, pattern):
+                 matches.append(os.path.join(path, filename))
+        return matches
+
+    hxxfileful=search_file(hxxfile,cpp_path)
+    cpplibful=search_file(cpplib,cpp_path)
+    assert len(hxxfileful) > 0  ,'Error in HXX2SALOMEComponent : file ' + hxxfile + ' not found in ' + cpp_path
+    assert len(cpplibful) > 0   ,'Error in HXX2SALOMEComponent : file ' + cpplib + ' not found in ' + cpp_path
+
+    self.hxxfile=hxxfile  # to include it in servant implementation
+
+    # grab name of c++ component
+    from hxx_awk import parse01,parse1,parse2,parse3
+    cmd1="""awk '$1 == "class" && $0 !~ /;/ {print $2}' """ + hxxfileful[0] + """|awk -F: '{printf "%s",$1}' """
+    f=os.popen(cmd1)
+    class_name=f.readlines()[0]
+    name=class_name
+    print "classname=",class_name
+
+    if cpplib[:3]=="lib" and cpplib[-3:]==".so":
+        cpplibname=cpplib[3:-3]  # get rid of lib and .so, to use within makefile.am
+    else:
+        cpplibname=class_name+"CXX"  # the default name
+
+    f.close()
+
+    # create temporary awk files
+    (fd01,p01n)=mkstemp()
+    f01=os.fdopen(fd01,"w")
+    f01.write(parse01)
+    f01.close()
+
+    (fd1,p1n)=mkstemp()
+    f1=os.fdopen(fd1,"w")
+    f1.write(parse1)
+    f1.close()
+
+    (fd2,p2n)=mkstemp()
+    f2=os.fdopen(fd2,"w")
+    f2.write(parse2)
+    f2.close()
+
+    (fd3,p3n)=mkstemp()
+    f3=os.fdopen(fd3,"w")
+    f3.write(parse3)
+    f3.close()
+
+    # awk parsing of hxx files - result written in file parse_type_result
+    cmd2="cat " + hxxfileful[0] + " | awk -f " + p01n + """ | sed 's/virtual //g' | sed 's/MEDMEM_EXPORT//g' | sed 's/throw.*;/;/g' | awk -f """ + p1n + " | awk -f " + p2n + " | awk -v class_name=" + class_name + " -f " + p3n
+    os.system(cmd2)
+    os.remove(p01n)
+    os.remove(p1n)
+    os.remove(p2n)
+    os.remove(p3n)
+
+    # Retrieve the information which was generated in the file parse_type_result.
+    # The structure of the file is :
+    #
+    #   Function  return_type   function_name
+    #   [arg1_type  arg1_name]
+    #   [arg2_type  arg2_name]
+    #   ...
+    # The service names are stored in list_of_services
+    # The information relative to a service (called service_name) is stored in the dictionnary service_definition[service_name]
+    from hxx_awk import cpp2idl_mapping
+    from hxx_awk import cpp2yacs_mapping
+    cpp2yacs_mapping["const ParaMEDMEM::MEDCouplingFieldDouble*"]="SALOME_MED/MPIMEDCouplingFieldDoubleCorbaInterface"
+    cpp2yacs_mapping["const ParaMEDMEM::MEDCouplingFieldDouble&"]="SALOME_MED/MPIMEDCouplingFieldDoubleCorbaInterface"
+    cpp2yacs_mapping["ParaMEDMEM::MEDCouplingFieldDouble*&"]="SALOME_MED/MPIMEDCouplingFieldDoubleCorbaInterface"
+    cpp2yacs_mapping["ParaMEDMEM::MEDCouplingFieldDouble*"]="SALOME_MED/MPIMEDCouplingFieldDoubleCorbaInterface"
+    list_of_services=[]
+    service_definition={}
+    result_parsing=open("parse_type_result","r")
+    for line in result_parsing.readlines():
+        line=line[0:-1] # get rid of trailing \n
+        words = string.split(line,';')
+
+        if len(words) >=3 and words[0] == "Function": # detect a new service
+            function_name=words[2]
+            if function_name != "getInputFieldTemplate":
+                list_of_services.append(function_name)
+            service_definition[function_name]={}
+            service_definition[function_name]["ret"]=words[1]  # return type
+            service_definition[function_name]["inports"]=[]
+            service_definition[function_name]["outports"]=[]
+            service_definition[function_name]["ports"]=[]
+            service_definition[function_name]["impl"]=[]
+            service_definition[function_name]["thread_func_decl"]=[]
+            service_definition[function_name]["thread_str_decl"]=[]
+
+        if len(words) == 2 and function_name != "getInputFieldTemplate":  # an argument type and argument name of a previous service
+            typename=words[0]
+            argname=words[1]
+            service_definition[list_of_services[-1]]["ports"].append( (argname,typename) ) # store in c++ order the arg names
+
+            # separate in from out parameters
+            inout=cpp2idl_mapping[typename][0:2]
+            assert inout=="in" or inout=="ou",'Error in table cpp2idl_mapping'
+            if inout == "in":
+                service_definition[list_of_services[-1]]["inports"].append( (argname,typename) )
+            else:
+                service_definition[list_of_services[-1]]["outports"].append( (argname,typename) )
+
+    if service_definition.has_key('getInputFieldTemplate'):
+        del service_definition['getInputFieldTemplate']
+    #
+    # generate implementation of c++ servant
+    # store it in service_definition[serv]["impl"]
+    #
+    from hxx_awk import cpp_impl_a,cpp_impl_b,cpp_impl_c  # these tables contain the part of code which depends upon c++ types
+    cpp_impl_b["ParaMEDMEM::MEDCouplingFieldDouble*"]="""\tParaMEDMEM::MPIMEDCouplingFieldDoubleServant * _rtn_field_i = new ParaMEDMEM::MPIMEDCouplingFieldDoubleServant(_orb,_poa,this,_rtn_cpp);
+\t_rtn_cpp->decrRef();
+\tSALOME_MED::MPIMEDCouplingFieldDoubleCorbaInterface_ptr _rtn_ior = _rtn_field_i->_this();\n"""
+    cpp_impl_a["const ParaMEDMEM::MEDCouplingFieldDouble*"]="\tParaMEDMEM::MEDCouplingFieldDouble* _%(arg)s=cppCompo_->getInputFieldTemplate();\n\t_setInputField(%(arg)s,_%(arg)s);\n\t_initializeCoupling(%(arg)s);\n"
+
+    from yacstypes import corbaTypes,corbaOutTypes
+    format_thread_signature="void * th_%s(void * st);" # this thread declaration will be included in servant's header
+    format_thread_struct="typedef struct {\n  int ip;\n  Engines::IORTab* tior;\n%(arg_decl)s} thread_%(serv_name)s_str;" # this thread declaration will be included in servant's header
+    format_thread_create="""
+//      create threads to forward to other processes the service invocation
+        if(_numproc == 0)
+        {
+            th = new pthread_t[_nbproc];
+            for(int ip=1;ip<_nbproc;ip++)
+            {
+                %(init_thread_str)s
+                pthread_create(&(th[ip]),NULL,th_%(serv_name)s,(void*)st);
+            }
+        }
+"""
+    s_thread_join="""
+//      waiting for all threads to complete
+        if(_numproc == 0)
+        {
+            for(int ip=1;ip<_nbproc;ip++)
+            {
+                pthread_join(th[ip],&ret_th);
+                est = (except_st*)ret_th;
+                if(est->exception)
+                {
+                    ostringstream msg;
+                    msg << "[" << ip << "] " << est->msg;
+                    THROW_SALOME_CORBA_EXCEPTION(msg.str().c_str(),SALOME::INTERNAL_ERROR);
+                }
+                delete est;
+            }
+          delete[] th;
+        }
+"""
+    format_thread_impl="""
+void *th_%(serv_name)s(void *s)
+{
+  ostringstream msg;
+  thread_%(serv_name)s_str *st = (thread_%(serv_name)s_str*)s;
+  except_st *est = new except_st;
+  est->exception = false;
+
+  try
+    {
+      %(module)s_ORB::%(component_name)s_Gen_var compo = %(module)s_ORB::%(component_name)s_Gen::_narrow((*(st->tior))[st->ip]);
+      compo->%(serv_name)s(%(arg_thread_invocation)s);
+    }
+  catch(const SALOME::SALOME_Exception &ex)
+    {
+      est->exception = true;
+      est->msg = ex.details.text;
+    }
+  catch(const CORBA::Exception &ex)
+    {
+      est->exception = true;
+      msg << "CORBA::Exception: " << ex;
+      est->msg = msg.str();
+    }
+  delete st;
+  return((void*)est);
+}
+
+"""
+
+    self.thread_impl=""  # the implementation of the thread functions used to invoque services on slave processors 
+    for serv in list_of_services:
+        if debug:
+            print "service : ",serv
+            print "  inports  -> ",service_definition[serv]["inports"]
+            print "  outports -> ",service_definition[serv]["outports"]
+            print "  return   -> ",service_definition[serv]["ret"]
+
+        # Part 0 : specific treatments for parallel components (call threads to forward the invocation to the service to all processes)
+        service_definition[serv]["thread_func_decl"]=format_thread_signature % serv
+        arg_declaration=""
+        arg_thread_invocation=""
+        init_thread_str="thread_%s_str *st = new thread_%s_str;" % (serv,serv) 
+        init_thread_str+="\n                st->ip = ip;"
+        init_thread_str+="\n                st->tior = _tior;"
+        for (argname,argtype) in service_definition[serv]["inports"]:
+            arg_declaration+="  "+corbaTypes[cpp2yacs_mapping[argtype]]+" "+argname+";\n"
+            init_thread_str+="\n                st->"+argname+" = "+argname+";"
+        for (argname,argtype) in service_definition[serv]["outports"]:
+            arg_declaration+="  "+corbaOutTypes[cpp2yacs_mapping[argtype]]+" "+argname+";\n"
+            init_thread_str+="\n                st->"+argname+" = "+argname+";"
+        for (argname,argtype) in service_definition[serv]["ports"]:
+            arg_thread_invocation+="st->"+argname+", "
+        if len(arg_thread_invocation)>0:
+            arg_thread_invocation=arg_thread_invocation[0:-2] # get rid of trailing comma
+        service_definition[serv]["thread_str_decl"]=format_thread_struct % { "serv_name" : serv, "arg_decl" : arg_declaration }
+        s_thread_call=format_thread_create % { "serv_name" : serv , "init_thread_str" : init_thread_str}
+        # within format_thread_impl the treatment of %(module) is postponed in makecxx() because we don't know here the module name
+        self.thread_impl+=format_thread_impl % {"serv_name" : serv , "arg_thread_invocation" : arg_thread_invocation , "component_name" : name, "module" : "%(module)s" } 
+
+        # Part 1 : Argument pre-processing
+        s_argument_processing="//\tArguments processing\n"
+        for (argname,argtype) in service_definition[serv]["inports"] + service_definition[serv]["outports"]:
+            format=cpp_impl_a[argtype]
+            s_argument_processing += format % {"arg" : argname }
+        if s_argument_processing=="//\tArguments processing\n": # if there was no args
+            s_argument_processing=""
+
+        # if an argument called name is of type const char*, this argument is transmitted to getInputFieldTemplate()
+        # => we insert "name" between the bracket of getInputFieldTemplate()
+        indice_getInputFieldTemplate=s_argument_processing.find ("cppCompo_->getInputFieldTemplate();")
+        if s_argument_processing.find ("const std::string _name") != -1  and  indice_getInputFieldTemplate != -1:
+            ind_insertion=indice_getInputFieldTemplate+33
+            s_argument_processing=s_argument_processing[:ind_insertion]+"name"+s_argument_processing[ind_insertion:-1]
+
+        # Part 2 : Call to the underlying c++ function
+        s_call_cpp_function="//\tCall cpp component\n\t"
+        rtn_type=service_definition[serv]["ret"]
+        if rtn_type == "void" : # if return type is void, the call syntax is different
+            s_call_cpp_function += "cppCompo_->%s(" % serv
+        else:
+            s_call_cpp_function += "%s _rtn_cpp = cppCompo_->%s(" % (rtn_type ,serv )
+
+        for (argname,argtype) in service_definition[serv]["ports"]:
+              # special treatment for some arguments
+              post=""
+              pre=""
+              if string.find(cpp_impl_a[argtype],"auto_ptr" ) != -1 :
+                  post=".get()" # for auto_ptr argument, retrieve the raw pointer behind
+              if  argtype == "const MEDMEM::MESH&"  or  argtype == "const MEDMEM::SUPPORT&" : 
+                  pre="*"  # we cannot create MESHClient on the stack (private constructor), so we create it on the heap and dereference it
+              post+="," # separator between arguments
+              s_call_cpp_function += " %s_%s%s" % ( pre,argname,post)
+        if s_call_cpp_function[-1]==',':
+            s_call_cpp_function=s_call_cpp_function[0:-1] # get rid of trailing comma
+        s_call_cpp_function=s_call_cpp_function+');\n'
+
+        # Part 3.a : Out Argument Post-processing
+        s_argument_postprocessing="//\tPost-processing & return\n"
+        for (argname,argtype) in service_definition[serv]["outports"]:
+            format=cpp_impl_c[argtype]
+            s_argument_postprocessing += format % {"arg" : argname, "module" : "%(module)s" } # the treatment of %(module) is postponed in makecxx() 
+                                                                                              # because we don't know here the module name
+        # Part 3.b : In Argument Post-processing
+        for (argname,argtype) in service_definition[serv]["inports"]:
+            if cpp_impl_c.has_key(argtype): # not all in types require a treatment
+                format=cpp_impl_c[argtype]
+                s_argument_postprocessing += format % {"arg" : argname, "module" : "%(module)s" } # id : treatment of %(module) is postponed in makecxx
+
+        # Part 3.c : return processing
+        s_rtn_processing=cpp_impl_b[rtn_type]
+        if  rtn_type != "void":
+            s_rtn_processing += "\treturn _rtn_ior;"
+
+        service_definition[serv]["impl"] = s_thread_call + s_argument_processing + s_call_cpp_function + s_thread_join  + s_argument_postprocessing + s_rtn_processing
+        if debug:
+            print "implementation :\n",service_definition[serv]["impl"]
+
+    #
+    # Create a list of Service objects (called services), and give it to Component constructor
+    #
+    services=[]
+    self.use_medmem=False
+    self.use_medcoupling=False
+    self.thread_func_decl=[]
+    self.thread_str_decl=[]
+    for serv in list_of_services:
+        # for inports and outports, Service class expects a list of tuples, each tuple containing the name and the yacs type of the port
+        # thus we need to convert c++ types to yacs types  (we use for that the cpp2yacs_mapping table
+        inports=[]
+        for i in range( len(service_definition[serv]["inports"]) ):
+            inports.append( [service_definition[serv]["inports"][i][0], cpp2yacs_mapping[service_definition[serv]["inports"][i][1]] ] )
+        outports=[]
+        for i in range( len(service_definition[serv]["outports"]) ):
+            outports.append( [service_definition[serv]["outports"][i][0], cpp2yacs_mapping[service_definition[serv]["outports"][i][1]] ] )
+
+        Return="void"
+        if service_definition[serv]["ret"] != "void":
+            Return=cpp2yacs_mapping[service_definition[serv]["ret"]]
+
+        # find out if component uses medmem types and/or medcoupling types
+        for (argname,argtype) in inports + outports + [("return",Return)]:
+            if moduleTypes[argtype]=="MED":
+                if argtype.count("Coupling")>0:
+                    self.use_medcoupling=True
+                else:
+                    self.use_medmem=True
+                break
+
+        code=service_definition[serv]["impl"]
+        if debug:
+            print "service : ",serv
+            print "  inports  -> ",service_definition[serv]["inports"]
+            print "  converted inports  -> ",inports
+            print "  outports -> ",service_definition[serv]["outports"]
+            print "  converted outports  -> ",outports
+            print "  Return  -> ",service_definition[serv]["ret"]
+            print "  converted Return  -> ",Return
+
+        services.append(Service(serv, 
+           inport=inports, 
+           outport=outports,
+           ret=Return, 
+           defs="", 
+           body=code,
+           ) )
+        self.thread_func_decl.append(service_definition[serv]["thread_func_decl"])
+        self.thread_str_decl.append(service_definition[serv]["thread_str_decl"])
+    Includes="-I${"+name+"CPP_ROOT_DIR}/include"
+    Libs="-L${"+name+"CPP_ROOT_DIR}/lib -l"+cpplibname
+    Compodefs=""
+    Inheritedclass=""
+    self.inheritedconstructor=""
+    Compodefs="""
+#include CORBA_SERVER_HEADER(MEDCouplingCorbaServantTest)
+#include "MPIMEDCouplingFieldDoubleServant.hxx"
+"""
+
+    Component.__init__(self, name, services, impl="CPP", libs=Libs,
+                             rlibs="", includes=Includes, kind="lib",
+                             sources=None,inheritedclass=Inheritedclass,
+                             compodefs=Compodefs)
+
+  def makeCompo(self, gen):
+    """generate files for C++ component
+
+       return a dict where key is the file name and value is the content of the file
+    """
+    cxxfile = "%s_i.cxx" % self.name
+    hxxfile = "%s_i.hxx" % self.name
+    return {"Makefile.am":gen.makeMakefile(self.getMakefileItems(gen)),
+            cxxfile:self.makecxx(gen),
+            hxxfile:self.makehxx(gen)
+           }
+
+  def getMakefileItems(self,gen):
+      makefileItems={"header":"""
+include $(top_srcdir)/adm_local/make_common_starter.am
+
+"""}
+      makefileItems["lib_LTLIBRARIES"]=["lib"+self.name+"Engine.la"]
+      makefileItems["salomeinclude_HEADERS"]=["%s_i.hxx" % self.name]
+      makefileItems["body"]=compoMakefile.substitute(module=gen.module.name,
+                                                     component=self.name,
+                                                     libs=self.libs,
+                                                     includes=self.includes)
+      return makefileItems
+
+  def makehxx(self, gen):
+    """return a string that is the content of .hxx file
+    """
+    services = []
+    for serv in self.services:
+      service = "    %s %s(" % (corba_rtn_type(serv.ret,gen.module.name),serv.name)
+      service = service+gen.makeArgs(serv)+") throw (SALOME::SALOME_Exception);"
+      services.append(service)
+    servicesdef = "\n".join(services)
+
+    inheritedclass=self.inheritedclass
+    thread_func_decl="\n".join(self.thread_func_decl)
+    thread_str_decl="\n".join(self.thread_str_decl)
+    if debug:
+        print "thread_func_decl : "
+        print thread_func_decl
+        print "thread_str_decl : "
+        print thread_str_decl
+
+    if self.inheritedclass:
+      inheritedclass= " public virtual " + self.inheritedclass + ","
+
+    return hxxCompo.substitute(component=self.name, module=gen.module.name, thread_func_decl=thread_func_decl,
+                               thread_str_decl=thread_str_decl, servicesdef=servicesdef, inheritedclass=inheritedclass,
+                               compodefs=self.compodefs)
+
+  def makecxx(self, gen, exe=0):
+    """return a string that is the content of .cxx file
+    """
+    services = []
+    inits = []
+    defs = []
+    for serv in self.services:
+      defs.append(serv.defs)
+      service = cxxService.substitute(component=self.name, service=serv.name,ret=corba_rtn_type(serv.ret,gen.module.name),
+                                      parameters=gen.makeArgs(serv),
+                                      body=serv.body % {"module":gen.module.name+"_ORB"} )
+      services.append(service)
+    return cxxCompo.substitute(component=self.name, cxx_include_file=self.hxxfile,
+                               inheritedconstructor=self.inheritedconstructor,
+                               servicesdef="\n".join(defs),
+                               servicesimpl="\n".join(services),
+                               thread_impl=self.thread_impl % {"module":gen.module.name} )
+
index 1a5746c0dd629604809bb07f8bd483493599bda5..9291230c50ecb7af0c8bb279eb32134baaabef2d 100644 (file)
@@ -1,3 +1,22 @@
+# Copyright (C) 2009-2012  EDF R&D
+#
+# 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
+#
+
 try:
   from string import Template
 except:
@@ -6,6 +25,7 @@ except:
 application="""
 <application>
 <prerequisites path="${prerequisites}"/>
+${resources}
 <modules>
 ${modules}
 </modules>
@@ -26,13 +46,14 @@ echo "Running libtoolize..." ; libtoolize --copy --force           || exit 1
 echo "Running automake..."   ; automake --add-missing --copy       || exit 1
 """
 
-mainMakefile="""include $(top_srcdir)/adm_local/make_common_starter.am
-SUBDIRS = idl resources src
+mainMakefile="""include $$(top_srcdir)/adm_local/make_common_starter.am
+SUBDIRS = idl resources src ${docsubdir}
 ACLOCAL_AMFLAGS = -I adm_local
 """
+mainMakefile=Template(mainMakefile)
 
 configure="""
-AC_INIT(salome,4.1)
+AC_INIT(${module}, 1.0)
 AC_CONFIG_AUX_DIR(adm_local)
 AM_INIT_AUTOMAKE
 AM_CONFIG_HEADER(${module}_config.h)
@@ -43,18 +64,24 @@ if test "x$$Kernel_ok" = "xno"; then
   AC_MSG_ERROR([You must define a correct KERNEL_ROOT_DIR or use the --with-kernel= configure option !])
 fi
 
+dnl Check Salome modules Install
+${modules}
+
 AC_PROG_LIBTOOL
 AC_PROG_CC
 AC_PROG_CXX
 CHECK_F77
-CHECK_BOOST
 CHECK_OMNIORB
+CHECK_PACO
+CHECK_MPI
 
 MODULE_NAME=${module}
 AC_SUBST(MODULE_NAME)
 
 AC_CHECK_ASTER
 
+${other_check}
+
 echo
 echo
 echo
@@ -64,14 +91,15 @@ echo "------------------------------------------------------------------------"
 echo
 echo "Configuration Options Summary:"
 echo
-echo "Mandatory products:"
 echo "  Threads ................ : $$threads_ok"
 echo "  OmniOrb (CORBA) ........ : $$omniORB_ok"
 echo "  OmniOrbpy (CORBA) ...... : $$omniORBpy_ok"
 echo "  Python ................. : $$python_ok"
-echo "  Boost  ................. : $$boost_ok"
 echo "  SALOME KERNEL .......... : $$Kernel_ok"
+echo "  PaCO++ ................. : $$PaCO_ok"
+echo "  MPI .................... : $$mpi_ok"
 echo "  Code Aster ............. : $$Aster_ok"
+${other_summary}
 echo
 echo "------------------------------------------------------------------------"
 echo
@@ -89,8 +117,11 @@ if test "x$$omniORBpy_ok" = "xno"; then
   AC_MSG_ERROR([OmniOrbpy is required],1)
 fi
 if test "x$$Kernel_ok" = "xno"; then
-  AC_MSG_ERROR([Expat is required],1)
+  AC_MSG_ERROR([SALOME KERNEL is required],1)
 fi
+${other_require}
+
+${paco_configure}
 
 AC_CONFIG_FILES([
         Makefile
@@ -103,36 +134,47 @@ AC_OUTPUT
 """
 configure=Template(configure)
 
+paco_configure="""\
+if test "x$$PaCO_ok" = "xno"; then
+  AC_MSG_ERROR([PaCO++ is required],1)
+fi
+"""
+
 makecommon="""
 # Standard directory for installation
-salomeincludedir   = $(includedir)/salome
-libdir             = $(prefix)/lib/salome
-bindir             = $(prefix)/bin/salome
-salomescriptdir    = $(bindir)
-salomepythondir    = $(prefix)/lib/python$(PYTHON_VERSION)/site-packages/salome
+salomeincludedir   = $$(includedir)/salome
+libdir             = $$(prefix)/lib/salome
+bindir             = $$(prefix)/bin/salome
+salomescriptdir    = $$(bindir)
+salomepythondir    = $$(prefix)/lib/python$$(PYTHON_VERSION)/site-packages/salome
 
 # Directory for installing idl files
-salomeidldir       = $(prefix)/idl/salome
+salomeidldir       = $$(prefix)/idl/salome
 
 # Directory for installing resource files
-salomeresdir       = $(prefix)/share/salome/resources/${MODULE_NAME}
+salomeresdir       = $$(prefix)/share/salome/resources/$${MODULE_NAME}
 
 # Directories for installing admin files
-admlocaldir       = $(prefix)/adm_local
-admlocalunixdir     = $(admlocaldir)/unix
-admlocalm4dir        = $(admlocaldir)/unix/config_files
+admlocaldir       = $$(prefix)/adm_local
+admlocalunixdir     = $$(admlocaldir)/unix
+admlocalm4dir        = $$(admlocaldir)/unix/config_files
 
 # Shared modules installation directory
-sharedpkgpythondir =$(pkgpythondir)/shared_modules
+sharedpkgpythondir =$$(pkgpythondir)/shared_modules
 
 # Documentation directory
-docdir             = $(datadir)/doc/salome
+salomedocdir             = $$(prefix)/share/doc/salome/gui/$${MODULE_NAME}
+
+IDL_INCLUDES = -I$$(KERNEL_ROOT_DIR)/idl/salome
+KERNEL_LIBS= -L$$(KERNEL_ROOT_DIR)/lib/salome -lSalomeContainer -lOpUtil -lSalomeDSCContainer -lSalomeDSCSuperv -lSalomeDatastream -lSalomeDSCSupervBasic -lCalciumC
+KERNEL_INCLUDES= -I$$(KERNEL_ROOT_DIR)/include/salome $$(OMNIORB_INCLUDES) ${other_includes}
 
-IDL_INCLUDES = -I$(KERNEL_ROOT_DIR)/idl/salome
-KERNEL_LIBS= -L$(KERNEL_ROOT_DIR)/lib/salome -lSalomeContainer -lOpUtil -lSalomeDSCContainer -lSalomeDSCSuperv -lSalomeDatastream -lSalomeDSCSupervBasic -lCalciumC
-KERNEL_INCLUDES= -I$(KERNEL_ROOT_DIR)/include/salome $(OMNIORB_INCLUDES) $(BOOST_CPPFLAGS)
+SALOME_LIBS= $${KERNEL_LIBS}
+SALOME_IDL_LIBS= -L$$(KERNEL_ROOT_DIR)/lib/salome -lSalomeIDLKernel
+SALOME_INCLUDES= $${KERNEL_INCLUDES}
 
 """
+makecommon=Template(makecommon)
 
 resMakefile="""
 include $$(top_srcdir)/adm_local/make_common_starter.am
@@ -141,3 +183,42 @@ salomeres_DATA = $${DATA_INST}
 EXTRA_DIST = $${DATA_INST}
 """
 resMakefile=Template(resMakefile)
+
+check_sphinx="""
+AC_DEFUN([CHECK_SPHINX],[
+
+AC_CHECKING(for sphinx doc generator)
+
+sphinx_ok=yes
+dnl where is sphinx ?
+AC_PATH_PROG(SPHINX,sphinx-build)
+if test "x$SPHINX" = "x"
+then
+  AC_MSG_WARN(sphinx not found)
+  sphinx_ok=no
+fi
+
+dnl Can I load ths sphinx module ?
+dnl This code comes from the ax_python_module macro.
+if test -z $PYTHON;
+then
+   PYTHON="python"
+fi
+PYTHON_NAME=`basename $PYTHON`
+AC_MSG_CHECKING($PYTHON_NAME module: sphinx)
+   $PYTHON -c "import sphinx" 2>/dev/null
+   if test $? -eq 0;
+   then
+     AC_MSG_RESULT(yes)
+     eval AS_TR_CPP(HAVE_PYMOD_sphinx)=yes
+   else
+     AC_MSG_RESULT(no)
+     eval AS_TR_CPP(HAVE_PYMOD_sphinx)=no
+     sphinx_ok=no
+   fi
+
+AM_CONDITIONAL(SPHINX_IS_OK, [test x"$sphinx_ok" = xyes])
+
+])
+"""
+
diff --git a/module_generator/paco_tmpl.py b/module_generator/paco_tmpl.py
new file mode 100644 (file)
index 0000000..85acbda
--- /dev/null
@@ -0,0 +1,421 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 *-
+# Copyright (C) 2009-2012  EDF R&D
+#
+# 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
+#
+
+#  Author : Andre RIBES (EDF R&D)
+
+try:
+  from string import Template
+except:
+  from compat import Template,set
+  
+compoMakefile="""
+include $$(top_srcdir)/adm_local/make_common_starter.am
+
+BUILT_SOURCES = SALOME_Exception.hxx SALOME_GenericObj.hxx SALOMEDS.hxx SALOME_PyNode.hxx SALOME_Comm.hxx SALOME_Parametric.hxx
+
+%.hxx : @KERNEL_ROOT_DIR@/idl/salome/%.idl
+\t$$(OMNIORB_IDL) -bcxx $$(IDLCXXFLAGS) $$(OMNIORB_IDLCXXFLAGS) $$(IDL_INCLUDES) -I@KERNEL_ROOT_DIR@/idl/salome -Wbh=.hxx -Wbs=.cxx $$<
+
+AM_CFLAGS=$$(KERNEL_INCLUDES) $$(PACO_INCLUDES) -fexceptions
+
+lib_LTLIBRARIES = lib${component}Engine.la
+lib${component}Engine_la_SOURCES      = ${component}.cxx ${sources}
+nodist_lib${component}Engine_la_SOURCES =
+lib${component}Engine_la_CXXFLAGS = -I$$(top_builddir)/idl $$(SALOME_INCLUDES) $$(PACO_INCLUDES) $$(MPI_INCLUDES) ${includes}
+lib${component}Engine_la_LIBADD   = -L$$(top_builddir)/idl -lSalomeIDL${module} @KERNEL_ROOT_DIR@/lib/salome/libSalomeParallelDSCContainer.la @PACOPATH@/lib/libPaCO_direct_comScheduling.la $$(FLIBS) ${libs} $$(PACO_LIBS) $$(SALOME_LIBS)
+lib${component}Engine_la_LDFLAGS = ${rlibs}
+salomeinclude_HEADERS = ${component}.hxx
+"""
+compoMakefile=Template(compoMakefile)
+
+paco_sources = """\
+$$(top_builddir)/idl/${module}PaCO_${module}_ORB_${component}_client.cxx $$(top_builddir)/idl/${module}PaCO_${module}_ORB_${component}_server.cxx $$(top_builddir)/idl/${module}PaCO.cxx $$(top_builddir)/idl/${module}.cxx
+"""
+paco_sources = Template(paco_sources)
+
+hxxCompo="""
+#ifndef _${component}_HXX_
+#define _${component}_HXX_
+
+#include "${module}PaCO_${module}_ORB_${component}_server.hxx"
+#include "ParallelDSC_i.hxx"
+#include "Param_Double_Port_uses_i.hxx"
+#include "Param_Double_Port_provides_i.hxx"
+
+#include "PortProperties_i.hxx"
+#include <Utils_SALOME_Exception.hxx>
+#include <paco_omni.h>
+#include <paco_${parallel_lib}.h>
+#include <paco_dummy.h>
+
+class ${component}_i:
+  public virtual ${module}_ORB::${component}_serv,
+  public virtual Engines_ParallelDSC_i
+{
+  public:
+    ${component}_i(CORBA::ORB_ptr orb,
+                   char * ior,
+                   int rank,
+                   PortableServer::POA_ptr poa,
+                   PortableServer::ObjectId * contId, 
+                   const char *instanceName, 
+                   const char *interfaceName);
+
+    virtual ~${component}_i();
+
+    void provides_port_changed(const char* provides_port_name,
+                              int connection_nbr,
+                              const Engines::DSC::Message message) {}
+
+    void uses_port_changed(const char* uses_port_name,
+                          Engines::DSC::uses_port * new_uses_port,
+                          const Engines::DSC::Message message) {delete new_uses_port;}
+
+    CORBA::Boolean init_service(const char * service_name);
+
+${servicesdef}
+ private:
+   PortProperties_i *  _fake_properties;
+${services_init_ok} 
+${parallelstreamports}
+};
+
+extern "C"
+{
+  PortableServer::ObjectId * ${component}Engine_factory(CORBA::ORB_ptr orb,
+                                                        char * ior,
+                                                        int rank,
+                                                        PortableServer::POA_ptr poa,
+                                                        PortableServer::ObjectId * contId,
+                                                        const char *instanceName,
+                                                        const char *interfaceName);
+
+  PortableServer::ObjectId * ${component}EngineProxy_factory(CORBA::ORB_ptr orb,
+                                                             paco_fabrique_thread * fab_thread,
+                                                             PortableServer::POA_ptr poa,
+                                                             PortableServer::ObjectId * contId,
+                                                             RegistryConnexion **,
+                                                             const char *instanceName,
+                                                             int node_number);
+  void ${component}_isAPACO_Component() {};                                                             
+}
+#endif
+
+"""
+hxxCompo=Template(hxxCompo)
+
+hxxinit_ok = """\
+   bool _${service_name}_init_ok;"""
+hxxinit_ok = Template(hxxinit_ok)
+
+hxxparallel_outstream = """\
+   ${type}_uses_i * _${name}_port;
+   bool _${name}_port_start_ok;"""
+hxxparallel_outstream = Template(hxxparallel_outstream)
+
+hxxparallel_instream = """\
+   ${type}_provides_i * _${name}_port;"""
+hxxparallel_instream = Template(hxxparallel_instream)
+
+cxxCompo="""
+#include "${component}.hxx"
+#include <string>
+
+//DEFS
+${servicesdef}
+//ENDDEF
+
+//! Constructor for component "${component}" instance
+/*!
+ *
+ */
+${component}_i::${component}_i(CORBA::ORB_ptr orb,
+                              char * ior,
+                               int rank,
+                               PortableServer::POA_ptr poa,
+                               PortableServer::ObjectId * contId, 
+                               const char *instanceName, 
+                               const char *interfaceName) :
+  ${module}_ORB::${component}_serv(orb, ior, rank),
+  ${module}_ORB::${component}_base_serv(orb, ior, rank),
+  Engines_ParallelDSC_i(orb, ior, rank, poa, contId, instanceName, interfaceName),
+  Engines_Parallel_Component_i(orb, ior, rank, poa, contId, instanceName, interfaceName),
+  Engines::Parallel_DSC_serv(orb, ior, rank),
+  InterfaceParallel_impl(orb,ior, rank),
+  Engines::Superv_Component_serv(orb, ior, rank),
+  Engines::DSC_serv(orb, ior, rank), 
+  Engines::EngineComponent_serv(orb,ior, rank), 
+  Engines::Parallel_Component_serv(orb,ior, rank), 
+  Engines::Parallel_DSC_base_serv(orb, ior, rank),
+  Engines::Superv_Component_base_serv(orb, ior, rank),
+  Engines::DSC_base_serv(orb, ior, rank), 
+  Engines::EngineComponent_base_serv(orb,ior, rank), 
+  Engines::Parallel_Component_base_serv(orb,ior, rank) 
+
+{
+  std::cerr << "creating paralle component" << std::endl;
+  _thisObj = this ;
+  _id = _poa->activate_object(_thisObj);
+${cons_services}  
+}
+
+//! Destructor for component "${component}" instance
+${component}_i::~${component}_i()
+{
+${des_services}  
+}
+
+//! Register datastream ports for a component service given its name
+/*!
+ *  \param service_name : service name
+ *  \\return true if port registering succeeded, false if not
+ */
+CORBA::Boolean
+${component}_i::init_service(const char * service_name) {
+  CORBA::Boolean rtn = false;
+  string s_name(service_name);
+${initservice}
+  return rtn;
+}
+
+${servicesimpl}
+"""
+cxxCompo=Template(cxxCompo)
+
+cxx_cons_service = """\
+  _${service_name}_init_ok = false;
+"""
+cxx_cons_service = Template(cxx_cons_service)
+
+cxx_cons_parallel_outstream = """\
+  _${name}_port = NULL;
+  _${name}_port_start_ok = false;
+"""
+cxx_cons_parallel_outstream = Template(cxx_cons_parallel_outstream)
+
+cxx_cons_parallel_instream = """\
+  _${name}_port = NULL;
+"""
+cxx_cons_parallel_instream = Template(cxx_cons_parallel_instream)
+
+cxx_des_parallel_stream = """\
+  if (_${name}_port)
+    delete _${name}_port;
+"""
+cxx_des_parallel_stream = Template(cxx_des_parallel_stream)
+
+initService="""\
+  if (s_name == "${service_name}")
+  {
+    if (!_${service_name}_init_ok)
+    {
+${init_parallel_datastream_ports}
+      _${service_name}_init_ok = true;
+    }
+    rtn = true;
+  }
+"""
+initService=Template(initService)
+
+hxxparallel_outstream_init = """\
+      _${name}_port = new ${type}_uses_i(this, \"${name}\", _orb);
+      _${name}_port->add_port_to_component();
+"""
+hxxparallel_outstream_init = Template(hxxparallel_outstream_init)
+
+hxxparallel_instream_init = """\
+      _${name}_port = ${type}_provides_i::init_port(this, \"${name}\", _orb);
+      ${type}_provides_i::wait_init_port(this, \"${name}\", _orb);
+"""
+hxxparallel_instream_init = Template(hxxparallel_instream_init)
+
+cxxService="""
+void ${component}_i::${service}(${parameters})
+{
+  std::cerr << "Begin of ${component}_i::${service} of node " << _myRank << std::endl;
+  if (_myRank == 0)
+    beginService("${component}_i::${service}");
+${connect_parallel_streamport}
+  try
+    {
+//BODY
+${body}
+//ENDBODY
+    }
+  catch ( const SALOME_Exception & ex)
+    {
+      SALOME::ExceptionStruct es;
+      es.text=CORBA::string_dup(ex.what());
+      es.type=SALOME::INTERNAL_ERROR;
+      throw SALOME::SALOME_Exception(es);
+    }
+  catch ( const SALOME::SALOME_Exception & ex)
+    {
+      throw;
+    }
+  catch ( const std::exception& ex)
+    {
+      SALOME::ExceptionStruct es;
+      es.text=CORBA::string_dup(ex.what());
+      es.type=SALOME::INTERNAL_ERROR;
+      throw SALOME::SALOME_Exception(es);
+    }
+  catch (...)
+    {
+      std::cerr << "unknown exception" << std::endl;
+      SALOME::ExceptionStruct es;
+      es.text=CORBA::string_dup(" unknown exception");
+      es.type=SALOME::INTERNAL_ERROR;
+      throw SALOME::SALOME_Exception(es);
+    }
+  if (_myRank == 0)
+    endService("${component}_i::${service}");
+  std::cerr << "End of ${component}_i::${service} of node " << _myRank << std::endl;
+}
+
+"""
+cxxService=Template(cxxService)
+
+cxxService_connect = """\
+  if (!_${name}_port_start_ok)
+  {
+    _${name}_port->start_port();
+    _${name}_port_start_ok = true;
+  }
+"""
+cxxService_connect = Template(cxxService_connect)
+
+cxxFactoryDummy = """
+extern "C"
+{
+  PortableServer::ObjectId * ${component}Engine_factory(CORBA::ORB_ptr orb, char * ior, int rank,
+                                                       PortableServer::POA_ptr poa, 
+                                                        PortableServer::ObjectId * contId,
+                                                        const char *instanceName, 
+                                                        const char *interfaceName)
+  {
+    std::cerr << "Begin of ${component}Engine_factory()" << std::endl;
+
+    paco_fabrique_manager * pfm = paco_getFabriqueManager();
+    pfm->register_com("${component}_node_dummy", new paco_dummy_fabrique());
+    pfm->register_thread("${component}_node_omni", new paco_omni_fabrique());
+    ${component}_i * ${component}_node = new ${component}_i(CORBA::ORB::_duplicate(orb), ior, rank, poa, contId, instanceName, interfaceName);
+    ${component}_node->setLibCom("${component}_node_dummy", ${component}_node);
+    ${component}_node->setLibThread("${component}_node_omni");
+
+    std::cerr << "End of ${component}Engine_factory()" << std::endl;
+    return ${component}_node->getId();
+  }
+
+  PortableServer::ObjectId * ${component}EngineProxy_factory(CORBA::ORB_ptr orb, 
+                                                            paco_fabrique_thread * fab_thread,
+                                                             PortableServer::POA_ptr poa,
+                                                             PortableServer::ObjectId * contId,
+                                                             RegistryConnexion ** connexion,
+                                                             const char *instanceName,
+                                                             int node_number)
+  {
+    cerr << "Begin of ${component}EngineProxy_factory()" << endl;
+    
+    paco_fabrique_manager* pfm = paco_getFabriqueManager();
+    pfm->register_com("proxy_dummy", new paco_dummy_fabrique());
+    pfm->register_thread("proxy_thread", new paco_omni_fabrique());
+    ${module}_ORB::${component}_proxy_impl * proxy = new ${module}_ORB::${component}_proxy_impl(CORBA::ORB::_duplicate(orb),
+                                                                                        fab_thread);
+    PortableServer::ObjectId * id = poa->activate_object(proxy);
+    proxy->_remove_ref();
+    // Initialisation du proxy
+    proxy->setLibCom("proxy_dummy", proxy);
+    proxy->setLibThread("proxy_thread");
+    PaCO::PacoTopology_t serveur_topo;
+    serveur_topo.total = node_number;
+    proxy->setTopology(serveur_topo);
+
+    // Ajout dans le registry ...
+    CORBA::Object_var o = poa->id_to_reference(*contId); // container ior...  
+    const CORBA::String_var the_ior = orb->object_to_string(o);
+    *connexion = new RegistryConnexion(0, 0, the_ior, "theSession", instanceName);
+
+    cerr << "End of ${component}EngineProxy_factory()" << endl;
+    return id;
+  }
+}
+"""
+cxxFactoryDummy = Template(cxxFactoryDummy)
+
+cxxFactoryMpi = """
+extern "C"
+{
+  PortableServer::ObjectId * ${component}Engine_factory(CORBA::ORB_ptr orb, char * ior, int rank,
+                                                       PortableServer::POA_ptr poa, 
+                                                        PortableServer::ObjectId * contId,
+                                                        const char *instanceName, 
+                                                        const char *interfaceName)
+  {
+    std::cerr << "Begin of ${component}Engine_factory()" << std::endl;
+
+    paco_fabrique_manager * pfm = paco_getFabriqueManager();
+    pfm->register_com("${component}_node_mpi", new paco_mpi_fabrique());
+    pfm->register_thread("${component}_node_omni", new paco_omni_fabrique());
+    ${component}_i * ${component}_node = new ${component}_i(CORBA::ORB::_duplicate(orb), ior, rank, poa, contId, instanceName, interfaceName);
+    MPI_Comm parallel_object_group = MPI_COMM_WORLD;
+    ${component}_node->setLibCom("${component}_node_mpi", &parallel_object_group);
+    ${component}_node->setLibThread("${component}_node_omni");
+
+    std::cerr << "End of ${component}Engine_factory()" << std::endl;
+    return ${component}_node->getId();
+  }
+
+  PortableServer::ObjectId * ${component}EngineProxy_factory(CORBA::ORB_ptr orb, 
+                                                            paco_fabrique_thread * fab_thread,
+                                                             PortableServer::POA_ptr poa,
+                                                             PortableServer::ObjectId * contId,
+                                                             RegistryConnexion ** connexion,
+                                                             const char *instanceName,
+                                                             int node_number)
+  {
+    cerr << "Begin of ${component}EngineProxy_factory()" << endl;
+    
+    paco_fabrique_manager* pfm = paco_getFabriqueManager();
+    pfm->register_com("proxy_dummy", new paco_dummy_fabrique());
+    pfm->register_thread("proxy_thread", new paco_omni_fabrique());
+    ${module}_ORB::${component}_proxy_impl * proxy = new ${module}_ORB::${component}_proxy_impl(CORBA::ORB::_duplicate(orb),
+                                                                                        fab_thread);
+    PortableServer::ObjectId * id = poa->activate_object(proxy);
+    proxy->_remove_ref();
+    // Initialisation du proxy
+    proxy->setLibCom("proxy_dummy", proxy);
+    proxy->setLibThread("proxy_thread");
+    PaCO::PacoTopology_t serveur_topo;
+    serveur_topo.total = node_number;
+    proxy->setTopology(serveur_topo);
+
+    // Ajout dans le registry ...
+    CORBA::Object_var o = poa->id_to_reference(*contId); // container ior...  
+    const CORBA::String_var the_ior = orb->object_to_string(o);
+    *connexion = new RegistryConnexion(0, 0, the_ior, "theSession", instanceName);
+
+    cerr << "End of ${component}EngineProxy_factory()" << endl;
+    return id;
+  }
+}
+"""
+cxxFactoryMpi = Template(cxxFactoryMpi)
diff --git a/module_generator/pacocompo.py b/module_generator/pacocompo.py
new file mode 100644 (file)
index 0000000..a767a66
--- /dev/null
@@ -0,0 +1,167 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 *-
+# Copyright (C) 2009-2012  EDF R&D
+#
+# 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
+#
+
+#  Author : Andre RIBES (EDF R&D)
+
+"""
+  Module that defines PACOComponent for SALOME PaCO++ components implemented in C++
+"""
+import os
+from gener import Component, Invalid
+from paco_tmpl import compoMakefile, hxxCompo, cxxService
+from paco_tmpl import initService, cxxCompo, paco_sources
+from paco_tmpl import cxxFactoryDummy, cxxFactoryMpi, cxx_des_parallel_stream
+from paco_tmpl import hxxparallel_instream, hxxparallel_outstream, hxxinit_ok
+from paco_tmpl import hxxparallel_instream_init, hxxparallel_outstream_init, cxxService_connect
+from paco_tmpl import cxx_cons_service, cxx_cons_parallel_outstream, cxx_cons_parallel_instream
+
+class PACOComponent(Component):
+
+  def __init__(self, name, parallel_lib, services=None, libs="", rlibs="", includes="", 
+                     kind="lib", exe_path=None, sources=None):
+    self.exe_path = exe_path
+    self.parallel_lib = parallel_lib
+    Component.__init__(self, name, services, impl="PACO", libs=libs, 
+                       rlibs=rlibs, includes=includes, kind=kind,
+                       sources=sources)
+  def validate(self):
+    """ validate component definition parameters"""
+    Component.validate(self)
+    kinds = ("lib")
+    if self.kind not in kinds:
+      raise Invalid("kind must be one of %s for component %s" % (kinds,self.name))
+    parallel_libs = ("dummy", "mpi")
+    if self.parallel_lib not in parallel_libs:
+      raise Invalid("parallel_lib must be one of %s" % parallel_libs)
+
+  def makeCompo(self, gen):
+    """generate files for PaCO++ component
+       
+       return a dict where key is the file name and value is the content of the file
+    """
+    cxxfile = "%s.cxx" % self.name
+    hxxfile = "%s.hxx" % self.name
+    if self.kind == "lib":
+      sources = " ".join(map(os.path.basename, self.sources))
+      sources += " "
+      sources += paco_sources.substitute(module=gen.module.name,
+                                         component=self.name)
+      return {"Makefile.am":compoMakefile.substitute(module=gen.module.name, 
+                                                     component=self.name,
+                                                     libs=self.libs, 
+                                                     rlibs=self.rlibs,
+                                                     sources=sources,
+                                                     includes=self.includes),
+              cxxfile:self.makecxx(gen), 
+              hxxfile:self.makehxx(gen)}
+
+  def makehxx(self, gen):
+    """return a string that is the content of .hxx file
+    """
+    services = []
+    parallel_instream = ""
+    parallel_outstream = ""
+    services_init_ok = ""
+    parallelstreamports = ""
+    for serv in self.services:
+      service = "    void %s(" % serv.name
+      service = service+gen.makeArgs(serv)+");"
+      services.append(service)
+      services_init_ok += hxxinit_ok.substitute(service_name=serv.name)
+
+      # Ajout des ports parallel DataStream
+      for name, type in serv.parallel_instream:
+        parallel_instream += hxxparallel_instream.substitute(name=name,
+                                                             type=type)
+      for name, type in serv.parallel_outstream:
+        parallel_outstream += hxxparallel_outstream.substitute(name=name,
+                                                               type=type)
+    servicesdef = "\n".join(services)
+    parallelstreamports += parallel_instream
+    parallelstreamports += parallel_outstream
+    return hxxCompo.substitute(component=self.name, 
+                               module=gen.module.name, 
+                               servicesdef=servicesdef,
+                               services_init_ok=services_init_ok,
+                               parallelstreamports=parallelstreamports,
+                               parallel_lib=self.parallel_lib)
+
+  def makecxx(self, gen):
+    """return a string that is the content of .cxx file
+    """
+    services = []
+    inits = []
+    defs = []
+    cons_services = ""
+    des_services = ""
+    for serv in self.services:
+      defs.append(serv.defs)
+    
+      # Constructeur
+      cons_services += cxx_cons_service.substitute(service_name=serv.name)
+      for name, type in serv.parallel_instream:
+        cons_services += cxx_cons_parallel_instream.substitute(name=name)
+      for name, type in serv.parallel_outstream:
+        cons_services += cxx_cons_parallel_outstream.substitute(name=name)
+
+      # Destructeur  
+      # On détruit uniquement les ports uses
+      # Les ports provides sont détruit lors de la destruction du poa
+      for name, type in serv.parallel_outstream:
+        des_services += cxx_des_parallel_stream.substitute(name=name)
+
+      # init_service
+      init_parallel_datastream_ports=""
+      for name, type in serv.parallel_instream:
+        init_parallel_datastream_ports += hxxparallel_instream_init.substitute(name=name,
+                                                                               type=type)
+      for name, type in serv.parallel_outstream:
+        init_parallel_datastream_ports += hxxparallel_outstream_init.substitute(name=name,
+                                                                                type=type)
+      init = initService.substitute(service_name=serv.name,
+                                    init_parallel_datastream_ports=init_parallel_datastream_ports)
+      inits.append(init)
+
+      # Code du service
+      connect_parallel_streamport = ""
+      for name, type in serv.parallel_outstream:
+        connect_parallel_streamport += cxxService_connect.substitute(name=name)
+
+      service = cxxService.substitute(component=self.name, service=serv.name, 
+                                      parameters=gen.makeArgs(serv),
+                                      body=serv.body,
+                                      connect_parallel_streamport=connect_parallel_streamport)
+      services.append(service)
+    
+    cxxfile = cxxCompo.substitute(component=self.name, module=gen.module.name, 
+                                  servicesdef="\n".join(defs), 
+                                  servicesimpl="\n".join(services), 
+                                  initservice='\n'.join(inits),
+                                  cons_services=cons_services,
+                                  des_services=des_services)
+
+    if self.parallel_lib == "dummy":
+      cxxfile += cxxFactoryDummy.substitute(component=self.name, module=gen.module.name)
+    elif self.parallel_lib == "mpi":
+      cxxfile += cxxFactoryMpi.substitute(component=self.name, module=gen.module.name)
+
+    return cxxfile
+
index 69ac03f5e49f49d2e74607fa5a04523212ad8016..b6e6b9494cebdb64995b1f45ed0ad321f8bd949f 100644 (file)
+# Copyright (C) 2009-2012  EDF R&D
+#
+# 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
+#
+
 """
   Module that defines PYComponent for SALOME components implemented in Python
 """
+import os
 from gener import Component, Invalid
 from pyth_tmpl import pyinitService, pyService, pyCompoEXE, pyCompo
-from pyth_tmpl import pycompoEXEMakefile, pycompoMakefile
+import textwrap
+from string import split,rstrip,join
+
+def indent(text, prefix='    '):
+  """Indent text by prepending a given prefix to each line."""
+  if not text: return ''
+  lines = split(text, '\n')
+  lines = map(lambda line, prefix=prefix: prefix + line, lines)
+  if lines: lines[-1] = rstrip(lines[-1])
+  return join(lines, '\n')
 
 class PYComponent(Component):
-  def __init__(self, name, services=None, python_path=None, kind="lib",
-                     sources=None):
+  """
+   A :class:`PYComponent` instance represents a Python SALOME component with services given as a list of :class:`Service`
+   instances with the parameter *services*.
+
+   :param name: gives the name of the component.
+   :type name: str
+   :param services: the list of services (:class:`Service`) of the component.
+   :param kind: If it is given and has the value "exe", the component will be built as a standalone
+      component (python executable). The default is to build the component as a python module.
+   :param sources: gives all the external Python source files to add in the component directory (list of paths).
+   :param python_path: If it is given (as a list of paths), all the paths are added to the python path (sys.path).
+   :param compodefs: can be used to add extra definition code in the component for example when using a base class
+      to define the component class by deriving it (see *inheritedclass* parameter)
+   :param inheritedclass: can be used to define a base class for the component. The base class can be defined in external
+      source or with the *compodefs* parameter. The value of the *inheritedclass* parameter is the name of the base class.
+   :param idls: can be used to add extra idl CORBA interfaces. This parameter must gives a list of idl file names that are
+      added into the generated module (idl directory) and compiled with the generated idl of the module.
+   :param interfacedefs: can be used to add idl definitions (or includes of idl files) into the generated idl of the module.
+   :param inheritedinterface: can be used to make the component inherit an extra idl interface that has been included through
+      the *idls* and *interfacedefs* parameters. See the pygui1 example for how to use these last parameters.
+
+   For example, the following call defines a Python component named "mycompo" with one service s1 (it must have been defined before)::
+
+      >>> c1 = module_generator.PYComponent('mycompo', services=[s1,],
+                                                       python_path="apath")
+
+  """
+  def __init__(self, name, services=None, kind="lib", sources=None, python_path=None,
+                     compodefs="", inheritedclass="", idls=None, interfacedefs="", inheritedinterface=""):
+    """initialise component attributes"""
     self.python_path = python_path or []
-    Component.__init__(self, name, services, impl="PY", kind=kind,
-                             sources=sources)
+    Component.__init__(self, name, services, impl="PY", kind=kind, sources=sources,
+                             inheritedclass=inheritedclass, compodefs=compodefs,
+                             idls=idls,interfacedefs=interfacedefs,inheritedinterface=inheritedinterface)
 
   def validate(self):
+    """validate component attributes"""
     Component.validate(self)
     kinds = ("lib","exe")
     if self.kind not in kinds:
-      raise Invalid("kind must be one of %s" % kinds)
+      raise Invalid("kind must be one of %s for component %s" % (kinds,self.name))
 
   def makeCompo(self, gen):
+    """generate component sources as a dictionary containing
+       file names (key) and file content (values)
+    """
     pyfile = "%s.py" % self.name
-    sources = " ".join(self.sources)
+    sources = " ".join(map(os.path.basename,self.sources))
     if self.kind == "lib":
-      return {"Makefile.am":pycompoMakefile.substitute(module=gen.module.name, 
-                                                       component=self.name,
-                                                       sources=sources), 
+      return {"Makefile.am":gen.makeMakefile(self.getMakefileItems(gen)),
               pyfile:self.makepy(gen)
              }
     if self.kind == "exe":
-      return {"Makefile.am":pycompoEXEMakefile.substitute(module=gen.module.name, 
-                                                          component=self.name,
-                                                          sources=sources), 
+      return {"Makefile.am":gen.makeMakefile(self.getMakefileItems(gen)),
               self.name+".exe":self.makepyexe(gen),
              }
 
+  def getMakefileItems(self,gen):
+    makefileItems={"header":"include $(top_srcdir)/adm_local/make_common_starter.am"}
+    if self.kind == "lib":
+      makefileItems["salomepython_PYTHON"]=[self.name+".py"]+self.sources
+    if self.kind == "exe":
+      makefileItems["salomepython_PYTHON"]=self.sources
+      makefileItems["dist_salomescript_SCRIPTS"]=[self.name+".exe"]
+    return makefileItems
+
   def makepy(self, gen):
+    """generate standard SALOME component source (python module)"""
     services = []
     inits = []
     defs = []
@@ -43,6 +111,7 @@ class PYComponent(Component):
       params = []
       pyparams = []
       for name, typ in serv.inport:
+        if typ=="file":continue #files are not passed through service interface
         params.append(name)
         if typ == "pyobj":
           pyparams.append("      %s=cPickle.loads(%s)" %(name, name))
@@ -52,13 +121,18 @@ class PYComponent(Component):
       params = []
       pyparams = []
       for name, typ in serv.outport:
+        if typ=="file":continue #files are not passed through service interface
         params.append(name)
         if typ == "pyobj":
           pyparams.append("      %s=cPickle.dumps(%s,-1)" %(name, name))
       outparams = ",".join(params)
       convertoutparams = '\n'.join(pyparams)
+      #dedent and indent the body
+      body=textwrap.dedent(serv.body)
+      body=indent(body,' '*6)
+
       service = pyService.substitute(component=self.name, service=serv.name, inparams=inparams,
-                                     outparams=outparams, body=serv.body, 
+                                     outparams=outparams, body= body,
                                      convertinparams=convertinparams,
                                      convertoutparams=convertoutparams)
       streams = []
@@ -76,12 +150,23 @@ class PYComponent(Component):
       inits.append(init)
 
     python_path = ",".join([repr(p) for p in self.python_path])
+
+    inheritedclass=self.inheritedclass
+    callconstructor=""
+    if self.inheritedclass:
+      inheritedclass= self.inheritedclass + ","
+      callconstructor="""
+    if hasattr(%s,"__init__"):
+      %s.__init__(self)""" % (self.inheritedclass,self.inheritedclass)
+
     return pyCompo.substitute(component=self.name, module=gen.module.name,
-                              servicesdef="\n".join(defs), servicesimpl="\n".join(services), 
+                              servicesdef="\n".join(defs), servicesimpl="\n".join(services),
                               initservice='\n'.join(inits),
-                              python_path=python_path)
+                              python_path=python_path,inheritedclass=inheritedclass,
+                              compodefs=self.compodefs, callconstructor=callconstructor)
 
   def makepyexe(self, gen):
+    """generate standalone component source (python executable)"""
     services = []
     inits = []
     defs = []
@@ -90,6 +175,7 @@ class PYComponent(Component):
       params = []
       pyparams = []
       for name, typ in serv.inport:
+        if typ=="file":continue #files are not passed through service interface
         params.append(name)
         if typ == "pyobj":
           pyparams.append("      %s=cPickle.loads(%s)" %(name, name))
@@ -99,14 +185,18 @@ class PYComponent(Component):
       params = []
       pyparams = []
       for name, typ in serv.outport:
+        if typ=="file":continue #files are not passed through service interface
         params.append(name)
         if typ == "pyobj":
           pyparams.append("      %s=cPickle.dumps(%s,-1)" %(name, name))
       outparams = ",".join(params)
       convertoutparams = '\n'.join(pyparams)
-      service = pyService.substitute(component=self.name, service=serv.name, 
-                                     inparams=inparams, outparams=outparams, 
-                                     body=serv.body, 
+      #dedent and indent the body
+      body=textwrap.dedent(serv.body)
+      body=indent(body,' '*6)
+      service = pyService.substitute(component=self.name, service=serv.name,
+                                     inparams=inparams, outparams=outparams,
+                                     body=body,
                                      convertinparams=convertinparams,
                                      convertoutparams=convertoutparams,
                                     )
@@ -125,11 +215,19 @@ class PYComponent(Component):
       inits.append(init)
 
     python_path = ",".join([repr(p) for p in self.python_path])
-    return pyCompoEXE.substitute(component=self.name, module=gen.module.name,
-                                 servicesdef="\n".join(defs), 
-                                 servicesimpl="\n".join(services),
-                                 initservice='\n'.join(inits), 
-                                 python_path=python_path)
 
+    inheritedclass=self.inheritedclass
+    callconstructor=""
+    if self.inheritedclass:
+      inheritedclass= self.inheritedclass + ","
+      callconstructor="""
+    if hasattr(%s,"__init__"):
+      %s.__init__(self)""" % (self.inheritedclass,self.inheritedclass)
 
+    return pyCompoEXE.substitute(component=self.name, module=gen.module.name,
+                                 servicesdef="\n".join(defs),
+                                 servicesimpl="\n".join(services),
+                                 initservice='\n'.join(inits),
+                                 python_path=python_path,inheritedclass=inheritedclass,
+                                 compodefs=self.compodefs, callconstructor=callconstructor)
 
index dd745760965150477d76715e2d6d3b90c25dff75..bef9bb9e1b8b7fed70186e6ac8a009a47f941be0 100644 (file)
@@ -1,3 +1,22 @@
+# Copyright (C) 2009-2012  EDF R&D
+#
+# 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
+#
+
 try:
   from string import Template
 except:
@@ -6,10 +25,11 @@ except:
 pyCompo="""
 import sys,traceback,os
 sys.path=sys.path+[${python_path}]
-import ${module}__POA
+import ${module}_ORB__POA
 import calcium
 import dsccalcium
 import SALOME
+import Engines
 import cPickle
 
 try:
@@ -17,20 +37,24 @@ try:
 except:
   numpy=None
 
+#COMPODEFS
+${compodefs}
+#ENDDEF
+
 #DEFS
 ${servicesdef}
 #ENDDEF
 
-class ${component}(${module}__POA.${component},dsccalcium.PyDSCComponent):
+class ${component}(${module}_ORB__POA.${component}, ${inheritedclass} dsccalcium.PyDSCComponent):
   '''
      To be identified as a SALOME component this Python class
      must have the same name as the component, inherit omniorb
-     class ${module}__POA.${component} and DSC class dsccalcium.PyDSCComponent
+     class ${module}_ORB__POA.${component} and DSC class dsccalcium.PyDSCComponent
      that implements DSC API.
   '''
   def __init__ ( self, orb, poa, contID, containerName, instanceName, interfaceName ):
-    print "${component}.__init__: ", containerName, ';', instanceName,interfaceName
     dsccalcium.PyDSCComponent.__init__(self, orb, poa,contID,containerName,instanceName,interfaceName)
+${callconstructor}
 
   def init_service(self,service):
 ${initservice}
@@ -42,7 +66,6 @@ ${servicesimpl}
 pyCompoEXE="""#!/usr/bin/env python
 """+pyCompo+"""
   def destroy(self):
-     dsccalcium.PyDSCComponent.destroy(self)
      self._orb.shutdown(0)
 
 if __name__ == '__main__':
@@ -80,7 +103,6 @@ pyCompoEXE=Template(pyCompoEXE)
 
 pyService="""
   def ${service}(self,${inparams}):
-    print "${component}.${service}"
     self.beginService("${component}.${service}")
     component=self.proxy
     returns=None
@@ -89,7 +111,6 @@ ${convertinparams}
 #BODY
 ${body}
 #ENDBODY
-      print "End of ${component}.${service}"
       sys.stdout.flush()
       self.endService("${component}.${service}")
 ${convertoutparams}
@@ -111,16 +132,3 @@ pyinitService=Template(pyinitService)
 pyinitCEXEService=pyinitService
 pyinitEXEService=pyinitService
 
-#Makefile
-
-pycompoMakefile="""include $$(top_srcdir)/adm_local/make_common_starter.am
-salomepython_PYTHON = ${component}.py ${sources}
-"""
-pycompoMakefile=Template(pycompoMakefile)
-
-pycompoEXEMakefile="""include $$(top_srcdir)/adm_local/make_common_starter.am
-salomepython_PYTHON = ${sources}
-dist_salomescript_SCRIPTS= ${component}.exe
-"""
-pycompoEXEMakefile=Template(pycompoEXEMakefile)
-
diff --git a/module_generator/salomemodules.py b/module_generator/salomemodules.py
new file mode 100644 (file)
index 0000000..a6d673c
--- /dev/null
@@ -0,0 +1,140 @@
+# Copyright (C) 2009-2012  EDF R&D
+#
+# 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
+#
+
+#######################################################################
+#         SALOME modules                                              #
+#######################################################################
+salome_modules={}
+
+def add_module(module,idldefs="",makefiledefs="",configdefs=""):
+  """ add a module configuration for other module than KERNEL
+
+       :param module: module name (GEOM, SMESH, VISU, ...)
+       :type module: string
+       :param idldefs:  definition instructions to add to idl files when using this module
+       :type idldefs: string
+       :param makefiledefs:  definition instructions to add to Makefile files when using this module
+       :type makefiledefs: string
+       :param configdefs:  instructions to add to configure file when using this module
+       :type configdefs: string
+  """
+  salome_modules[module]={"idldefs" : idldefs, "makefiledefs" : makefiledefs, "configdefs" : configdefs}
+
+#module GEOM
+idldefs="""
+#include "GEOM_Gen.idl"
+"""
+makefiledefs="""
+#module GEOM
+GEOM_IDL_INCLUDES = -I$(GEOM_ROOT_DIR)/idl/salome
+GEOM_INCLUDES= -I$(GEOM_ROOT_DIR)/include/salome
+GEOM_IDL_LIBS= -L$(GEOM_ROOT_DIR)/lib/salome -lSalomeIDLGEOM
+GEOM_LIBS= -L$(GEOM_ROOT_DIR)/lib/salome
+SALOME_LIBS += ${GEOM_LIBS}
+SALOME_IDL_LIBS += ${GEOM_IDL_LIBS}
+SALOME_INCLUDES += ${GEOM_INCLUDES}
+IDL_INCLUDES += ${GEOM_IDL_INCLUDES}
+"""
+configdefs="""
+if test "x${GEOM_ROOT_DIR}" != "x" && test -d ${GEOM_ROOT_DIR} ; then
+  AC_MSG_RESULT(Using GEOM installation in ${GEOM_ROOT_DIR})
+else
+  AC_MSG_ERROR([Cannot find module GEOM. Have you set GEOM_ROOT_DIR ?],1)
+fi
+"""
+add_module("GEOM",idldefs,makefiledefs,configdefs)
+
+#module MED
+idldefs="""
+#include "MED_Gen.idl"
+#include "MED.idl"
+#include "MEDCouplingCorbaServant.idl"
+"""
+makefiledefs="""
+#module MED
+MED_IDL_INCLUDES = -I$(MED_ROOT_DIR)/idl/salome
+MED_INCLUDES= -I${MED2HOME}/include -I${MED_ROOT_DIR}/include/salome -DH5_USE_16_API -I${HDF5HOME}/include
+MED_IDL_LIBS= -L$(MED_ROOT_DIR)/lib/salome -lSalomeIDLMED
+MED_LIBS= -L${MED2HOME}/lib -lmed -L${HDF5HOME}/lib -lhdf5 -L${MED_ROOT_DIR}/lib/salome -lSalomeIDLMED -lMEDClientcmodule -lmedcouplingcorba -lmedcouplingclient 
+SALOME_LIBS += ${MED_LIBS}
+SALOME_IDL_LIBS += ${MED_IDL_LIBS}
+SALOME_INCLUDES += ${MED_INCLUDES}
+IDL_INCLUDES += ${MED_IDL_INCLUDES}
+"""
+configdefs="""
+if test "x${MED_ROOT_DIR}" != "x" && test -d ${MED_ROOT_DIR} ; then
+  AC_MSG_RESULT(Using MED installation in ${MED_ROOT_DIR})
+else
+  AC_MSG_ERROR([Cannot find module MED. Have you set MED_ROOT_DIR ?],1)
+fi
+"""
+
+salome_modules["MED"]={"idldefs" : idldefs, "makefiledefs" : makefiledefs, "configdefs" : configdefs}
+
+#module SMESH
+idldefs="""
+#include "SMESH_Gen.idl"
+#include "SMESH_Mesh.idl"
+"""
+makefiledefs="""
+#module SMESH
+SMESH_IDL_INCLUDES = -I$(SMESH_ROOT_DIR)/idl/salome
+SMESH_INCLUDES= -I$(SMESH_ROOT_DIR)/include/salome
+SMESH_IDL_LIBS= -L$(SMESH_ROOT_DIR)/lib/salome -lSalomeIDLSMESH
+SMESH_LIBS= -L$(SMESH_ROOT_DIR)/lib/salome
+SALOME_LIBS += ${SMESH_LIBS}
+SALOME_IDL_LIBS += ${SMESH_IDL_LIBS}
+SALOME_INCLUDES += ${SMESH_INCLUDES}
+IDL_INCLUDES += ${SMESH_IDL_INCLUDES}
+"""
+configdefs="""
+if test "x${SMESH_ROOT_DIR}" != "x" && test -d ${SMESH_ROOT_DIR} ; then
+  AC_MSG_RESULT(Using SMESH installation in ${SMESH_ROOT_DIR})
+else
+  AC_MSG_ERROR([Cannot find module SMESH. Have you set SMESH_ROOT_DIR ?],1)
+fi
+"""
+
+salome_modules["SMESH"]={"idldefs" : idldefs, "makefiledefs" : makefiledefs, "configdefs" : configdefs,
+                         "depends":["GEOM","MED"]}
+
+#module VISU
+idldefs="""
+#include "VISU_Gen.idl"
+"""
+makefiledefs="""
+#module VISU
+VISU_IDL_INCLUDES = -I$(VISU_ROOT_DIR)/idl/salome
+VISU_INCLUDES= -I$(VISU_ROOT_DIR)/include/salome
+VISU_IDL_LIBS= -L$(VISU_ROOT_DIR)/lib/salome -lSalomeIDLVISU
+VISU_LIBS= -L$(VISU_ROOT_DIR)/lib/salome
+SALOME_LIBS += ${VISU_LIBS}
+SALOME_IDL_LIBS += ${VISU_IDL_LIBS}
+SALOME_INCLUDES += ${VISU_INCLUDES}
+IDL_INCLUDES += ${VISU_IDL_INCLUDES}
+"""
+configdefs="""
+if test "x${VISU_ROOT_DIR}" != "x" && test -d ${VISU_ROOT_DIR} ; then
+  AC_MSG_RESULT(Using VISU installation in ${VISU_ROOT_DIR})
+else
+  AC_MSG_ERROR([Cannot find module VISU. Have you set VISU_ROOT_DIR ?],1)
+fi
+"""
+
+salome_modules["VISU"]={"idldefs" : idldefs, "makefiledefs" : makefiledefs, "configdefs" : configdefs}
diff --git a/module_generator/yacstypes.py b/module_generator/yacstypes.py
new file mode 100644 (file)
index 0000000..c267ff5
--- /dev/null
@@ -0,0 +1,138 @@
+# Copyright (C) 2009-2012  EDF R&D
+#
+# 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
+#
+
+###########################################################
+#             Types definitions                           #
+###########################################################
+corbaTypes = {"double":"CORBA::Double", "long":"CORBA::Long",
+              "string":"const char*", "dblevec":"const %s::dblevec&",
+              "stringvec":"const %s::stringvec&", "intvec":"const %s::intvec&",
+              "file":None, "boolean":"CORBA::Boolean", "void":"void"
+             }
+
+corbaOutTypes = {"double":"CORBA::Double&", "long":"CORBA::Long&",
+                 "string":"CORBA::String_out", "dblevec":"%s::dblevec_out",
+                 "stringvec":"%s::stringvec_out", "intvec":"%s::intvec_out",
+                 "file":None, "boolean":"CORBA::Boolean_out", "void":None
+                }
+moduleTypes = {"double":"", "long":"", "string":"", "dblevec":"", "stringvec":"", "intvec":"", "file":"", "pyobj":"", "boolean":"", "void":"" }
+
+idlTypes = {"double":"double", "long":"long", "string":"string", "dblevec":"dblevec", "stringvec":"stringvec", "intvec":"intvec", 
+            "file":"", "boolean":"boolean", "void":"void" }
+
+corbaRtnTypes = {"double":"CORBA::Double", "long":"CORBA::Long",
+                 "string":"char*", "dblevec":"%s::dblevec*",
+                 "stringvec":"%s::stringvec*", "intvec":"%s::intvec*",
+                 "file":None, "boolean":"CORBA::Boolean", "void":"void"
+                }
+
+
+
+def corba_in_type(typ, module):
+  if corbaTypes[typ].count("%s")>0:
+    return corbaTypes[typ] % (module+"_ORB")
+  else:
+    return corbaTypes[typ]
+
+def corba_out_type(typ, module):
+  if corbaOutTypes[typ].count("%s")>0:
+    return corbaOutTypes[typ] % (module+"_ORB")
+  else:
+    return corbaOutTypes[typ]
+
+def corba_rtn_type(typ, module):
+  if corbaRtnTypes[typ].count("%s")>0:
+    return corbaRtnTypes[typ] % (module+"_ORB")
+  else:
+    return corbaRtnTypes[typ]
+
+ValidTypes = corbaTypes.keys()
+PyValidTypes = ValidTypes+["pyobj"]
+
+def add_type(typename, corbaType=None, corbaOutType=None, module="", idltype=None, corbaRtnType=None):
+  """ add a data type YACS from other module than KERNEL to the list of available types
+
+       :param typename: YACS data type name
+       :type typename: string
+       :param corbaType: representation for C++ CORBA in parameter
+       :type corbaType: string
+       :param corbaOutType: representation for C++ CORBA out parameter
+       :type corbaOutType: string
+       :param module: name of the module that defines the data type (GEOM for GEOM_Object)
+       :type module: string
+       :param idltype: representation for CORBA idl
+       :type idltype: string
+       :param corbaRtnType: representation for C++ CORBA return parameter
+       :type corbaRtnType: string
+  """
+  corbaTypes[typename] = corbaType or "const "+typename.replace("/","::")+"&"
+  corbaOutTypes[typename] = corbaOutType or typename.replace("/","::")+"_out"
+  corbaRtnTypes[typename] = corbaRtnType or typename.replace("/","::")+"*"
+  moduleTypes[typename] = module
+  idlTypes[typename] = idltype or typename.replace("/","::")
+  ValidTypes.append(typename)
+  PyValidTypes.append(typename)
+
+calciumTypes = {"CALCIUM_double":"CALCIUM_double",
+                "CALCIUM_integer":"CALCIUM_integer",
+                "CALCIUM_real":"CALCIUM_real",
+                "CALCIUM_string":"CALCIUM_string",
+                "CALCIUM_complex":"CALCIUM_complex",
+                "CALCIUM_logical":"CALCIUM_logical",
+                "CALCIUM_long":"CALCIUM_long",
+               }
+
+DatastreamParallelTypes = {"Param_Double_Port":"Param_Double_Port"}
+
+ValidImpl = ("CPP", "PY", "F77", "ASTER", "PACO")
+ValidImplTypes = ("sequential", "parallel")
+ValidStreamTypes = calciumTypes.keys()
+ValidParallelStreamTypes = DatastreamParallelTypes.keys()
+ValidDependencies = ("I", "T")
+
+#Add KERNEL YACS types : YACS name, c++ corba arg in, c++ corba arg out,defining module, repr corba idl, c++ corba return
+add_type("dataref", "const Engines::dataref&", "Engines::dataref_out", "", "dataref","Engines::dataref*")
+add_type("SALOME_TYPES/Parameter")
+add_type("SALOME_TYPES/ParameterList", "const SALOME_TYPES::ParameterList&", "SALOME_TYPES::ParameterList_out", "", "SALOME_TYPES::ParameterList","SALOME_TYPES::ParameterList*")
+add_type("SALOME_TYPES/VarList", "const SALOME_TYPES::VarList&", "SALOME_TYPES::VarList_out", "", "SALOME_TYPES::VarList","SALOME_TYPES::VarList*")
+add_type("SALOME_TYPES/Variable", "const SALOME_TYPES::Variable&", "SALOME_TYPES::Variable_out", "", "SALOME_TYPES::Variable","SALOME_TYPES::Variable*")
+add_type("SALOME_TYPES/VariableSequence", "const SALOME_TYPES::VariableSequence&", "SALOME_TYPES::VariableSequence_out", "", "SALOME_TYPES::VariableSequence","SALOME_TYPES::VariableSequence*")
+add_type("SALOME_TYPES/StateSequence", "const SALOME_TYPES::StateSequence&", "SALOME_TYPES::StateSequence_out", "", "SALOME_TYPES::StateSequence","SALOME_TYPES::StateSequence*")
+add_type("SALOME_TYPES/TimeSequence", "const SALOME_TYPES::TimeSequence&", "SALOME_TYPES::TimeSequence_out", "", "SALOME_TYPES::TimeSequence","SALOME_TYPES::TimeSequence*")
+add_type("SALOME_TYPES/ParametricInput", "const SALOME_TYPES::ParametricInput&", "SALOME_TYPES::ParametricInput_out", "", "SALOME_TYPES::ParametricInput","SALOME_TYPES::ParametricInput*")
+add_type("SALOME_TYPES/ParametricOutput", "const SALOME_TYPES::ParametricOutput&", "SALOME_TYPES::ParametricOutput_out", "", "SALOME_TYPES::ParametricOutput","SALOME_TYPES::ParametricOutput*")
+
+#Add GEOM YACS types
+add_type("GEOM_Object", "GEOM::GEOM_Object_ptr", "GEOM::GEOM_Object_out", "GEOM", "GEOM::GEOM_Object","GEOM::GEOM_Object_ptr")
+
+#Add SMESH YACS types
+add_type("SMESH_Mesh", "SMESH::SMESH_Mesh_ptr", "SMESH::SMESH_Mesh_out", "SMESH", "SMESH::SMESH_Mesh","SMESH::SMESH_Mesh_ptr")
+add_type("SMESH_Hypothesis", "SMESH::SMESH_Hypothesis_ptr", "SMESH::SMESH_Hypothesis_out", "SMESH", "SMESH::SMESH_Hypothesis", "SMESH::SMESH_Hypothesis_ptr")
+
+#Add MED YACS types
+add_type("SALOME_MED/MED", "SALOME_MED::MED_ptr", "SALOME_MED::MED_out", "MED", "SALOME_MED::MED", "SALOME_MED::MED_ptr")
+add_type("SALOME_MED/MESH", "SALOME_MED::MESH_ptr", "SALOME_MED::MESH_out", "MED", "SALOME_MED::MESH", "SALOME_MED::MESH_ptr")
+add_type("SALOME_MED/SUPPORT", "SALOME_MED::SUPPORT_ptr", "SALOME_MED::SUPPORT_out", "MED", "SALOME_MED::SUPPORT", "SALOME_MED::SUPPORT_ptr")
+add_type("SALOME_MED/FIELD", "SALOME_MED::FIELD_ptr", "SALOME_MED::FIELD_out", "MED", "SALOME_MED::FIELD", "SALOME_MED::FIELD_ptr")
+add_type("SALOME_MED/FIELDDOUBLE", "SALOME_MED::FIELDDOUBLE_ptr", "SALOME_MED::FIELDDOUBLE_out", "MED", "SALOME_MED::FIELDDOUBLE", "SALOME_MED::FIELDDOUBLE_ptr")
+add_type("SALOME_MED/FIELDINT", "SALOME_MED::FIELDINT_ptr", "SALOME_MED::FIELDINT_out", "MED", "SALOME_MED::FIELDINT", "SALOME_MED::FIELDINT_ptr")
+add_type("SALOME/Matrix", "SALOME::Matrix_ptr", "SALOME::Matrix_out", "MED", "SALOME::Matrix", "SALOME::Matrix_ptr")
+add_type("SALOME_MED/MEDCouplingFieldDoubleCorbaInterface", "SALOME_MED::MEDCouplingFieldDoubleCorbaInterface_ptr", "SALOME_MED::MEDCouplingFieldDoubleCorbaInterface_out", "MED", "SALOME_MED::MEDCouplingFieldDoubleCorbaInterface", "SALOME_MED::MEDCouplingFieldDoubleCorbaInterface_ptr")
+add_type("SALOME_MED/MPIMEDCouplingFieldDoubleCorbaInterface", "SALOME_MED::MPIMEDCouplingFieldDoubleCorbaInterface_ptr", "SALOME_MED::MPIMEDCouplingFieldDoubleCorbaInterface_out", "MED", "SALOME_MED::MPIMEDCouplingFieldDoubleCorbaInterface", "SALOME_MED::MPIMEDCouplingFieldDoubleCorbaInterface_ptr")
+add_type("SALOME_MED/MEDCouplingUMeshCorbaInterface", "SALOME_MED::MEDCouplingUMeshCorbaInterface_ptr", "SALOME_MED::MEDCouplingUMeshCorbaInterface_out", "MED", "SALOME_MED::MEDCouplingUMeshCorbaInterface", "SALOME_MED::MEDCouplingUMeshCorbaInterface_ptr")
diff --git a/script/hxx2salome.py b/script/hxx2salome.py
new file mode 100755 (executable)
index 0000000..43a8cca
--- /dev/null
@@ -0,0 +1,197 @@
+#! /usr/bin/env python
+#  -*- coding: iso-8859-1 -*-
+# Copyright (C) 2009-2012  EDF R&D
+#
+# 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
+#
+usage="""
+hxx2salome.py [options] <CPPCOMPO>_root_dir lib<CPPCOMPO>.hxx <CPPCOMPO>.so installDir
+
+generate a SALOME component that wrapps given the C++ component
+
+Mandatory arguments:
+
+  - <CPPCOMPO>_root_dir   : install directory (absolute path) of the c++ component
+  - <CPPCOMPO>.hxx        : header of the c++ component"
+  - lib<CPPCOMPO>.so      : the shared library containing the c++ component
+  - installDir            : directory where the generated files and the build should be installed 
+
+  Note that <CPPCOMPO>.hxx and lib<CPPCOMPO>.so should be found in <CPPCOMPO>_root_dir)
+  
+"""
+
+import os
+import sys
+import string
+import optparse
+from module_generator import Generator,Module,Service,HXX2SALOMEComponent
+
+# ------------------------------------------------------------------------------
+
+def main():
+#   Reproduce the main options of original hxx2salome script
+    parser = optparse.OptionParser(usage=usage)
+    parser.add_option(
+        '-e', 
+        dest="environ_file", 
+        default='sh', 
+        help="specify the name of a environment file (bash/sh) that will" +\
+             " be updated")
+    parser.add_option(
+        '-g', 
+        action="store_true", 
+        dest="do_gui", 
+        default=False,
+        help="to create a generic gui in your component building tree")
+    parser.add_option(
+        '-c', 
+        action="store_true", 
+        dest="do_compile", 
+        default=False,
+        help="to compile after generation")
+    parser.add_option(
+        '-s', 
+        dest="shell_syntax", 
+        help="use this option with csh to update the environment " +\
+             "with the CSH syntax")
+
+    options, args = parser.parse_args()
+
+    assert len(args) == 4, \
+        'ERROR, four mandatory arguments are expected!\n\n%s\n' % usage
+    cppdir = args[0]      # install directory of the c++ component
+    hxxfile = args[1]     # header of the c++ component
+    libfile = args[2]     # the shared library containing the c++ component
+    installpath = args[3] # directory where the generated files are installed
+
+#   Make sure given paths/files are valid
+    if not os.path.exists(cppdir):
+        print "ERROR: cppdir %s does not exist. It is mandatory" % cppdir
+        print usage
+        sys.exit(1)
+
+    if not os.path.exists(installpath):
+        print "ERROR: installpath %s does not exist. It is mandatory" \
+              % installpath
+        print usage
+        sys.exit(1)
+
+    if options.environ_file != None:
+        if not os.path.exists(options.environ_file):
+            print "ERROR: environ_file %s does not exist. It is mandatory" \
+                  % options.environ_file
+            print usage
+            sys.exit(1)
+
+    hxx2salome(cppdir=cppdir,
+               hxxfile=hxxfile,
+               libfile=libfile,
+               installpath=installpath,
+               do_gui=options.do_gui,
+               do_compile=options.do_compile,
+               environ_file=options.environ_file,
+               shell_syntax=options.shell_syntax
+               )
+    pass
+
+# ------------------------------------------------------------------------------
+
+def hxx2salome(cppdir,
+        hxxfile,
+        libfile,
+        installpath,
+        do_gui,
+        do_compile,
+        environ_file,
+        shell_syntax):
+
+    # setup from environment a minimal context
+    kernel_root_dir=os.environ["KERNEL_ROOT_DIR"]
+    gui_root_dir=os.environ["GUI_ROOT_DIR"]
+    context={'update':1,
+             "makeflags":"-j2",
+             "kernel":kernel_root_dir,
+             "gui":gui_root_dir,
+            }
+    #
+    salome_compo = HXX2SALOMEComponent(hxxfile,libfile,cppdir)
+    install_root_dir = os.path.join(installpath,salome_compo.name)
+    module_root_dir = os.path.join(install_root_dir,
+            salome_compo.name+"_INSTALL")
+
+    # to be able to compile the generated component
+    os.environ[salome_compo.name+"CPP_ROOT_DIR"]=cppdir  
+
+    # if necessary creates the directory in which the component 
+    # will be geberated and compiled.
+    try: 
+        os.mkdir(install_root_dir)
+    except OSError:
+        print "Warning : directory %s already exixts!" % install_root_dir
+
+    # if a graphical user interface is required,
+    # ask HXX2SALOMEComponent to generate template files
+    if do_gui:
+        gui_files=salome_compo.getGUIfilesTemplate()
+        g=Generator(Module(salome_compo.name,components=[salome_compo],
+            prefix=module_root_dir,
+            gui=gui_files),
+            context)
+    else:
+        g=Generator(Module(salome_compo.name,components=[salome_compo],
+            prefix=module_root_dir),
+            context)
+
+    # go in install_root_dir, generate the component
+    os.chdir(install_root_dir)
+    g.generate()
+
+    # if specified : compile and install the generated component
+    if do_compile:
+        g.bootstrap()
+        g.configure()
+        g.make()
+        g.install()
+        pass
+    #
+    # update environment file if furnished
+    if environ_file != None:
+       envfile=open(environ_file,"a")
+       if shell_syntax == "csh":
+           update_environ="""
+#------ ${compo_name}
+setenv ${compo_name}_SRC_DIR ${install_root_dir}/${compo_name}_SRC
+setenv ${compo_name}_ROOT_DIR ${install_root_dir}/${compo_name}_INSTALL
+"""
+       else:
+           update_environ="""
+#------ ${compo_name}
+export ${compo_name}_SRC_DIR=${install_root_dir}/${compo_name}_SRC
+export ${compo_name}_ROOT_DIR=${install_root_dir}/${compo_name}_INSTALL
+"""
+       update_environ=string.Template(update_environ)
+       update_environ=update_environ.substitute(compo_name=salome_compo.name,
+               install_root_dir=install_root_dir)
+       envfile.write(update_environ)
+       envfile.close()
+    pass
+
+# ------------------------------------------------------------------------------
+
+if __name__ == '__main__':
+    main()
+    pass
index eea8893f9452dda746f3c1eaf0f5d7eba1ce8d93..ee6b019ae43ec6521d086e6c4f5ccf5772278deb 100644 (file)
--- a/setup.py
+++ b/setup.py
@@ -1,6 +1,26 @@
+# Copyright (C) 2009-2012  EDF R&D
+#
+# 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
+#
+
 from distutils.core import setup
 setup(name='YACSGEN',
-      version='5.1.0',
+      version='6.5.0',
       author='C. Caremoli',
       packages=['module_generator'],
+      scripts=['script/hxx2salome.py',]
      )