]> SALOME platform Git repositories - tools/yacsgen.git/commitdiff
Salome HOME
CCAR: add the way to declare data types that are defined in SALOME modules
authorcaremoli <caremoli>
Mon, 29 Mar 2010 15:14:01 +0000 (15:14 +0000)
committercaremoli <caremoli>
Mon, 29 Mar 2010 15:14:01 +0000 (15:14 +0000)
other than KERNEL.
Only one module has been added : GEOM
Only one data type has been added : GEOM_Object
The structure is ready for other modules and data types.

17 files changed:
Examples/ast2/exeaster
Examples/ast2/myaster/config.txt
Examples/context.py
Examples/makefile.inc
Examples/paco1/components.py
Examples/paco2/components.py
Examples/paco3/components.py
Examples/pacocontext.py [new file with mode: 0644]
module_generator/__init__.py
module_generator/cata_tmpl.py
module_generator/cpp_tmpl.py
module_generator/cppcompo.py
module_generator/gener.py
module_generator/mod_tmpl.py
module_generator/paco_tmpl.py
module_generator/salomemodules.py [new file with mode: 0644]
module_generator/yacstypes.py [new file with mode: 0644]

index 1d352796d6e23efa841df9bb8bebe1d8c7fa113e..544e2a1dde28ea6a31e825c1ba22105397313d3a 100755 (executable)
@@ -4,7 +4,7 @@ END
 
 cat > temp.export << END
 P actions make_etude
-P version STA10.0
+P version STA10.1
 P nomjob salome
 P ncpus 1
 A memjeveux 4.000000
@@ -28,5 +28,5 @@ F resu $PWD/resu R 8
 F erre $PWD/erre R 9
 END
 
-/local/cchris/Aster/V10/Install/ASTK/ASTK_SERV/bin/as_run temp.export
+/local/cchris/Aster/V10.1/aster/ASTK/ASTK_SERV/bin/as_run temp.export
 
index d1724771c90d89fef551dfbb496c89f036fc925c..eeb378579bf605a6b77e34d59a99cbf6230255f0 100644 (file)
 #
 ID_PERF        | id      | -     | claui2c6
 #
-ENV_SH         | env     | -     | /local/cchris/Aster/V10/Install/STA10.0/profile.sh
+ENV_SH         | env     | -     | /local/cchris/Aster/V10.1/aster/STA10.1/profile.sh
 #
 LIB            | ar      | ?     | /usr/bin/ar -rv
 #
-BIBL           | python  | 2.4   | -lpython2.5
-BIBL           | med     | 2.3.5 | -Wl,-R -Wl,/local/cchris/pkg/med235/install/lib -L/local/cchris/pkg/med235/install/lib -lmed
-BIBL           | hdf5    | 1.6.5 | -lhdf5
+BIBL           | python  | 2.4   | -L/usr/lib -L/usr/lib/python2.5/config -lpython2.5
+BIBL           | med     | 2.3.5 | -L/local/cchris/Aster/V10.1/aster/public/med-2.3.6/lib -lmed
+BIBL           | hdf5    | 1.6.5 | -L/usr/lib -lhdf5
 BIBL           | zmat    | 8.4   | 
-BIBL           | mumps   | ?     | /local/cchris/Aster/V10/Install/public/mumps-4.7.3/lib/libdmumps.a /local/cchris/Aster/V10/Install/public/mumps-4.7.3/lib/libzmumps.a /local/cchris/Aster/V10/Install/public/mumps-4.7.3/lib/libpord.a /local/cchris/Aster/V10/Install/public/mumps-4.7.3/libseq/libmpiseq.a
+BIBL           | mumps   | ?     | /local/cchris/Aster/V10.1/aster/public/mumps-4.8.4/lib/libdmumps.a /local/cchris/Aster/V10.1/aster/public/mumps-4.8.4/lib/libzmumps.a /local/cchris/Aster/V10.1/aster/public/mumps-4.8.4/lib/libsmumps.a /local/cchris/Aster/V10.1/aster/public/mumps-4.8.4/lib/libcmumps.a /local/cchris/Aster/V10.1/aster/public/mumps-4.8.4/lib/libmumps_common.a /local/cchris/Aster/V10.1/aster/public/mumps-4.8.4/lib/libpord.a /local/cchris/Aster/V10.1/aster/public/mumps-4.8.4/lib/libmpiseq.a -L/local/cchris/Aster/V10.1/aster/public/metis-4.0/lib -lmetis
 BIBL           | scotch  | 4.0   | 
-BIBL           | math    | ?     | /usr/lib/liblapack.a /usr/lib/libblas.a /usr/lib/gcc/x86_64-linux-gnu/4.3/libgfortran.a /usr/lib/gcc/x86_64-linux-gnu/4.3/libgfortran.a
+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 -lieee -ldl -lpthread -lutil -lm -lz
@@ -63,24 +63,23 @@ LINK           | link    | ?     | /usr/bin/gfortran
 OPTL           | link    | ?     |  -fopenmp
 #
 CC             | cc      | ?     | /usr/bin/gcc
-OPTC_D         | cc      | ?     | -c -g  -fno-stack-protector
-OPTC_O         | cc      | ?     | -c -O2 -fno-stack-protector
-INCL           | include | ?     | -I/local/cchris/Aster/V10/Install/STA10.0/bibc/include -I/usr/include/python2.5 -I/local/cchris/Aster/V10/Install/public/hdf5-1.6.5/include
+OPTC_D         | cc      | ?     | -c -g  -fno-stack-protector -fPIC
+OPTC_O         | cc      | ?     | -c -O2 -fno-stack-protector -fPIC
+INCL           | include | ?     | -I/local/cchris/Aster/V10.1/aster/STA10.1/bibc/include -I/usr/include/python2.5
 #
 F77            | f77     | ?     | /usr/bin/gfortran
-OPTF_D         | f77     | ?     | -c -g  -fopenmp  -fdefault-double-8 -fdefault-integer-8 -fdefault-real-8
-OPTF_O         | f77     | ?     | -c -O2 -fopenmp  -fdefault-double-8 -fdefault-integer-8 -fdefault-real-8
+OPTF_D         | f77     | ?     | -c -g  -fopenmp -fPIC  -fdefault-double-8 -fdefault-integer-8 -fdefault-real-8
+OPTF_O         | f77     | ?     | -c -O2 -fopenmp -fPIC  -fdefault-double-8 -fdefault-integer-8 -fdefault-real-8
 INCLF          | include | ?     | -I/local/cchris/Salome/Install/KERNEL_V5/include/salome
 #
 F90            | f90     | ?     | /usr/bin/gfortran
-OPTF90_D       | f90     | ?     | -c -g  -ffixed-line-length-0 -x f77-cpp-input  -fdefault-double-8 -fdefault-integer-8 -fdefault-real-8
-OPTF90_O       | f90     | ?     | -c -O2 -ffixed-line-length-0 -x f77-cpp-input  -fdefault-double-8 -fdefault-integer-8 -fdefault-real-8
-INCLF90        | include | ?     |  -I/local/cchris/Aster/V10/Install/STA10.0/bibf90/include_mumps-4.7.3
+OPTF90_D       | f90     | ?     | -c -g  -ffixed-line-length-0 -x f77-cpp-input -fPIC  -fdefault-double-8 -fdefault-integer-8 -fdefault-real-8
+OPTF90_O       | f90     | ?     | -c -O2 -ffixed-line-length-0 -x f77-cpp-input -fPIC  -fdefault-double-8 -fdefault-integer-8 -fdefault-real-8
+INCLF90        | include | ?     |  -I/local/cchris/Aster/V10.1/aster/STA10.1/bibf90/include_mumps-4.8.4
 #
 G77_AGLA       | g77     | ?     | unused
 #
 SRCFOR         | src     | 11-04 | bibfor
-#Comment following line if you have no f90 compiler
 SRCF90         | src     | 11-04 | bibf90
 SRCFERM        | src     | 11-04 | fermetur
 SRCC           | src     | 11-04 | bibc
@@ -113,9 +112,9 @@ 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/cchris/Aster/V10/Install/outils
-REPMAT         | exec    | 02-05 | /local/cchris/Aster/V10/Install/STA10.0/materiau
-REPDEX         | exec    | 02-05 | /local/cchris/Aster/V10/Install/STA10.0/datg
+REPOUT         | exec    | 11-04 | /local/cchris/Aster/V10.1/aster/outils
+REPMAT         | exec    | 02-05 | /local/cchris/Aster/V10.1/aster/STA10.1/materiau
+REPDEX         | exec    | 02-05 | /local/cchris/Aster/V10.1/aster/STA10.1/datg
 #
 SUPERV         | exec    | 03-02 | Accas
 SUPERV         | exec    | 03-02 | Build
index a54f9c888657850c56658ee0b110fc10be0bb1f5..4ac8c3f13f7c7540dbe612d39a391cc4d9a40bdb 100644 (file)
@@ -9,12 +9,12 @@ 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/Install"
-aster_version="STA10.0"
+aster_home="/local/cchris/Aster/V10.1/aster"
+aster_version="STA10.1"
+#aster_home="/local/cchris/Aster/V10/Install"
+#aster_version="STA10.0"
 
 
index 2623cc8e96fbf7633131b275c5a6c362c1e34b16..ba991c1b16a5f8637e0d5d6c032ab61a90baca88 100644 (file)
@@ -1,7 +1,9 @@
 
 KERNEL_ROOT_DIR=/local/cchris/Salome/Install/KERNEL_V5
 
-ASTER_ROOT=/local/cchris/Aster/V10/Install
-ASTER_VERSION=STA10.0
+ASTER_ROOT=/local/cchris/Aster/V10.1/aster
+ASTER_VERSION=STA10.1
+#ASTER_ROOT=/local/cchris/Aster/V10/Install
+#ASTER_VERSION=STA10.0
 
 FC=gfortran
index 2d4cc724666304ab09775b181a3501367c17edfa..7d28aedb76bffa776fb8cff9515379e5b7aba858 100644 (file)
@@ -2,7 +2,7 @@ import os
 from module_generator import Generator,Module,Service,PACOComponent
 
 #import context from ..
-execfile("../context.py")
+execfile("../pacocontext.py")
 
 cwd=os.getcwd()
 
index 3ace344ed9ad84d91a10381fb0015c7a0f5dde37..8ce0e06016940a3beb0f030857954a973d2b3a7c 100644 (file)
@@ -2,7 +2,7 @@ import os
 from module_generator import Generator,Module,Service,PACOComponent
 
 #import context from ..
-execfile("../context.py")
+execfile("../pacocontext.py")
 
 cwd=os.getcwd()
 
index 56f8045ab23b9f6da2f62e83f3f101bacf51fe78..389670202038ad07749a0d475561daddb8482949 100644 (file)
@@ -3,7 +3,7 @@ import os
 from module_generator import Generator,Module,Service,PACOComponent
 
 #import context from ..
-execfile("../context.py")
+execfile("../pacocontext.py")
 
 cwd=os.getcwd()
 
diff --git a/Examples/pacocontext.py b/Examples/pacocontext.py
new file mode 100644 (file)
index 0000000..4d4e822
--- /dev/null
@@ -0,0 +1,22 @@
+
+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"
+
+
index e25bec1047af6681a605baae9275deb9dc1d428c..99b9b511e9098e1a9a4da80eb29b12b8a6284764 100644 (file)
@@ -1,7 +1,7 @@
 """
-  Pacakge to generate SALOME modules with components
+  Package to generate SALOME modules with components
   implemented in C++, Fortran or Python
-  that can use datastream ports 
+  that can use datastream ports
 """
 from gener import Module, Service, Generator
 from fcompo import F77Component
index 8b714d4af2c366783b87ed8414ce723cc228ecfc..71d60a88552c1596e706e0733537a24108a78cab 100644 (file)
@@ -13,6 +13,8 @@ idl="""
 #include "SALOME_Exception.idl"
 #include "SALOME_PACOExtension.idl"
 
+${idldefs}
+
 module ${module}
 {
 typedef sequence<string> stringvec;
@@ -82,8 +84,8 @@ salomepython_DATA = ${module}_idl.py ${PACO_salomepython_DATA}
 lib${module}_la_SOURCES      =
 nodist_lib${module}_la_SOURCES = ${module}SK.cc
 nodist_salomeinclude_HEADERS= ${module}.hh ${PACO_SALOMEINCLUDE_HEADERS}
-lib${module}_la_CXXFLAGS     = -I.  $$(KERNEL_INCLUDES)
-lib${module}_la_LIBADD     = $$(KERNEL_LIBS)
+lib${module}_la_CXXFLAGS     = -I.  $$(SALOME_INCLUDES)
+lib${module}_la_LIBADD     = $$(SALOME_IDL_LIBS)
 ##########################################################
 %SK.cc %.hh : %.idl
 \t$$(OMNIORB_IDL) -bcxx $$(IDLCXXFLAGS) $$(OMNIORB_IDLCXXFLAGS) $$(IDL_INCLUDES) $$<
index f56472851fbc232416e81cfcf122e6316cdc2ca2..e1b9721ea06cc307f824bc7f6690456fb0927d27 100644 (file)
@@ -377,9 +377,9 @@ exeCPP=Template(exeCPP)
 compoMakefile="""
 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 -l${module} $${SALOME_LIBS} $$(FLIBS)
 lib${component}Engine_la_LDFLAGS = ${rlibs}
 """
 compoMakefile=Template(compoMakefile)
@@ -387,9 +387,9 @@ compoMakefile=Template(compoMakefile)
 compoEXEMakefile="""
 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 -l${module} $${SALOME_LIBS} $$(FLIBS)
 lib${component}Exelib_la_LDFLAGS = ${rlibs}
 """
 compoEXEMakefile=Template(compoEXEMakefile)
index adc8977dce830681878f00a8b4cf255c4b0027ae..642750da847f957e4e25492e09a789aed7701483 100644 (file)
@@ -50,7 +50,7 @@ class CPPComponent(Component):
     makefileItems={"header":"""
 include $(top_srcdir)/adm_local/make_common_starter.am
 
-AM_CFLAGS=$(KERNEL_INCLUDES) -fexceptions
+AM_CFLAGS=$(SALOME_INCLUDES) -fexceptions
 """}
     if self.kind == "lib":
       makefileItems["lib_LTLIBRARIES"]=["lib"+self.name+"Engine.la"]
index dd5b8ac8cfadf9c89e966f62cd5f77efa169e8c7..c8a59ebb9300e68b685b02c7c0ce1640d97d31a8 100644 (file)
@@ -22,57 +22,19 @@ 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&",
-              "dataref":"const Engines::dataref&","file":None
-             }
-
-corbaOutTypes = {"double":"CORBA::Double&", "long":"CORBA::Long&",
-                 "string":"CORBA::String_out", "dblevec":"%s::dblevec_out",
-                 "stringvec":"%s::stringvec_out", "intvec":"%s::intvec_out",
-                 "dataref":"Engines::dataref_out","file":None
-                }
-
-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",
-                "CALCIUM_long":"CALCIUM_long",
-               }
-
-DatastreamParallelTypes = {"Param_Double_Port":"Param_Double_Port"}
-
-ValidImpl = ("CPP", "PY", "F77", "ASTER", "PACO")
-ValidImplTypes = ("sequential", "parallel")
-ValidTypes = corbaTypes.keys()
-ValidStreamTypes = calciumTypes.keys()
-ValidParallelStreamTypes = DatastreamParallelTypes.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
 
 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):
@@ -92,7 +54,7 @@ class Module(object):
   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 caracter - in the module name" % self.name)
+      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:
@@ -101,7 +63,7 @@ class Module(object):
       compo.validate()
 
 class Component(object):
-  def __init__(self, name, services=None, impl="PY", libs="", rlibs="", 
+  def __init__(self, name, services=None, impl="PY", libs="", rlibs="",
                      includes="", kind="lib", sources=None):
     self.name = name
     self.impl = impl
@@ -258,7 +220,7 @@ class Generator(object):
     makefile = "SUBDIRS="
     makefileItems={"header":"""
 include $(top_srcdir)/adm_local/make_common_starter.am
-AM_CFLAGS=$$(KERNEL_INCLUDES) -fexceptions
+AM_CFLAGS=$$(SALOME_INCLUDES) -fexceptions
 """,
                    "salomepython_PYTHON":[],
                    "dist_salomescript_SCRIPTS":[],
@@ -268,13 +230,23 @@ AM_CFLAGS=$$(KERNEL_INCLUDES) -fexceptions
                    "body":"",
                   }
 
+    #get the list of SALOME modules used and put it in used_modules attribute
+    modules = {}
+    for compo in module.components:
+      for serv in compo.services:
+        for name, typ in serv.inport + serv.outport:
+          mod = moduleTypes[typ]
+          if mod:
+            modules[mod] = 1
+    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
+        makefile = makefile + " " + compo.name
       else:
         srcs.update(fdict)
         #for src/Makefile.am
@@ -286,7 +258,7 @@ AM_CFLAGS=$$(KERNEL_INCLUDES) -fexceptions
         makefileItems["salomeinclude_HEADERS"]=makefileItems["salomeinclude_HEADERS"]+mdict.get("salomeinclude_HEADERS",[])
         makefileItems["body"]=makefileItems["body"]+mdict.get("body","")+'\n'
 
-    if self.module.layout=="multidir":
+    if self.module.layout == "multidir":
       srcs["Makefile.am"] = makefile+'\n'
     else:
       srcs["Makefile.am"] = self.makeMakefile(makefileItems)
@@ -294,14 +266,24 @@ AM_CFLAGS=$$(KERNEL_INCLUDES) -fexceptions
     #for catalog files
     catalogfile = "%sCatalog.xml" % module.name
 
+    #add makefile definitions to make_common_starter.am
+    common_starter = makecommon
+    for mod in self.used_modules:
+      common_starter = common_starter + salome_modules[mod]["makefiledefs"] + '\n'
+
     self.makeFiles({"autogen.sh":autogen,
                     "Makefile.am":mainMakefile,
                     "README":"", "NEWS":"", "AUTHORS":"", "ChangeLog":"",
                     "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":{"make_common_starter.am": common_starter, "check_aster.m4":check_aster},
                     }, 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":
@@ -320,20 +302,22 @@ AM_CFLAGS=$$(KERNEL_INCLUDES) -fexceptions
 
       self.makeFiles({"configure.ac":configure.substitute(module=module.name.lower(),
                                                           makefiles='\n'.join(configure_makefiles),
-                                                          paco_configure=paco_configure),
-                      "idl":{"Makefile.am":idlMakefile.substitute(module=module.name, 
+                                                          paco_configure=paco_configure,
+                                                          modules=configure_modules),
+                      "idl":{"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), 
-                             idlfile:self.makeidl(),
-                             xmlfile:self.makexml()},
+                                                                  PACO_salomeidl_DATA=PACO_salomeidl_DATA),
+                      idlfile:self.makeidl(),
+                      xmlfile:self.makexml()},
                       }, namedir)
     else :
-      self.makeFiles({"configure.ac":configure.substitute(module=module.name.lower(), 
+      self.makeFiles({"configure.ac":configure.substitute(module=module.name.lower(),
                                                           makefiles='\n'.join(configure_makefiles),
-                                                          paco_configure=""),
+                                                          paco_configure="",
+                                                          modules=configure_modules),
                       "idl":{"Makefile.am":idlMakefile.substitute(module=module.name,
                                                                   PACO_BUILT_SOURCES="",
                                                                   PACO_SALOMEINCLUDE_HEADERS="",
@@ -433,10 +417,10 @@ AM_CFLAGS=$$(KERNEL_INCLUDES) -fexceptions
           params = []
           for name, typ in serv.inport:
             if typ == "file":continue #files are not passed through IDL interface
-            params.append("in %s %s" % (typ, name))
+            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" % (typ, name))
+            params.append("out %s %s" % (idlTypes[typ], name))
           service = "    void %s(" % serv.name
           service = service+",".join(params)+");"
           services.append(service)
@@ -449,17 +433,27 @@ AM_CFLAGS=$$(KERNEL_INCLUDES) -fexceptions
             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 = "    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))
+
+    #build idl includes for SALOME modules
+    idldefs=""
+    for mod in self.used_modules:
+      idldefs = idldefs + salome_modules[mod]["idldefs"]
+
+    return idl.substitute(module=self.module.name, interfaces='\n'.join(interfaces),idldefs=idldefs)
 
   # For PaCO++
   def makexml(self):
index 9684500613119328fcbb2eb1b6bd2b4e4a2558fe..8698913a4af45a717be63fba3caaefefc62b1657 100644 (file)
@@ -44,6 +44,9 @@ 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
@@ -144,6 +147,10 @@ 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}
+
 """
 
 resMakefile="""
index b8312c2cde756a7e1d464f068fde1db2828fd8d9..d7d75cc72992b0eafdd43f3a648a48dbe2465ed1 100644 (file)
@@ -36,8 +36,8 @@ 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 $$(KERNEL_INCLUDES) $$(PACO_INCLUDES) $$(MPI_INCLUDES) ${includes}
-lib${component}Engine_la_LIBADD   = -L$$(top_builddir)/idl -l${module} @KERNEL_ROOT_DIR@/lib/salome/libSalomeParallelDSCContainer.la @PACOPATH@/lib/libPaCO_direct_comScheduling.la $$(FLIBS) ${libs} $$(PACO_LIBS)
+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 -l${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
 """
diff --git a/module_generator/salomemodules.py b/module_generator/salomemodules.py
new file mode 100644 (file)
index 0000000..7a2f515
--- /dev/null
@@ -0,0 +1,31 @@
+#######################################################################
+#         SALOME modules                                              #
+#######################################################################
+salome_modules={}
+
+#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
+"""
+
+salome_modules["GEOM"]={"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..cef9507
--- /dev/null
@@ -0,0 +1,60 @@
+###########################################################
+#             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
+             }
+
+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
+                }
+moduleTypes = {"double":"", "long":"", "string":"", "dblevec":"", "stringvec":"", "intvec":"", "file":"" }
+
+idlTypes = {"double":"double", "long":"long", "string":"string", "dblevec":"dblevec", "stringvec":"stringvec", "intvec":"intvec", "file":"" }
+
+def corba_in_type(typ, module):
+  if corbaTypes[typ].count("%s")>0:
+    return corbaTypes[typ] % module
+  else:
+    return corbaTypes[typ]
+
+def corba_out_type(typ, module):
+  if corbaOutTypes[typ].count("%s")>0:
+    return corbaOutTypes[typ] % module
+  else:
+    return corbaOutTypes[typ]
+
+ValidTypes = corbaTypes.keys()
+PyValidTypes = ValidTypes+["pyobj"]
+
+def add_type(typename, corbaType, corbaOutType, module, idltype):
+  corbaTypes[typename] = corbaType
+  corbaOutTypes[typename] = corbaOutType
+  moduleTypes[typename] = module
+  idlTypes[typename] = idltype
+  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_type("dataref", "const Engines::dataref&", "Engines::dataref_out", "", "dataref")
+add_type("GEOM_Object", "GEOM::GEOM_Object_ptr", "GEOM::GEOM_Object_out", "GEOM", "GEOM::GEOM_Object")