Salome HOME
Merge from V6_main_20120808 08Aug12
[tools/hxx2salome.git] / scripts / parse3.awk
index 6bd586756ab669503a595ebf8b0f5bbe38add52f..0c5c560eb379630325b06eef2af83fbc93017ef1 100644 (file)
@@ -21,6 +21,7 @@ BEGIN {
 # 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"
@@ -29,6 +30,7 @@ BEGIN {
   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"
@@ -42,20 +44,24 @@ BEGIN {
   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::SenderDouble"
+  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::SenderDouble"
+  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::SenderInt"
-  idl_arg_type["std::vector<int>*&"]="out SALOME::SenderInt"
+  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"
@@ -73,24 +79,29 @@ BEGIN {
   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::SenderDouble"
+  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::SenderInt"
+  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"
 #
 #
 # Corba mapping table (for argument's types and returned types)
 #
   idl_impl_hxx["in long"]="CORBA::Long"
+  idl_impl_hxx["in boolean"]="CORBA::Boolean"
   idl_impl_hxx["in double"]="CORBA::Double"
   idl_impl_hxx["in float"]="CORBA::Float"
   idl_impl_hxx["in short"]="CORBA::Short"
   idl_impl_hxx["in unsigned long"]="CORBA::ULong"
   idl_impl_hxx["in string"]="const char*"
   idl_impl_hxx["out long"]="CORBA::Long_out"
+  idl_impl_hxx["out boolean"]="CORBA::Boolean_out"
   idl_impl_hxx["out double"]="CORBA::Double_out"
   idl_impl_hxx["out float"]="CORBA::Float_out"
   idl_impl_hxx["out short"]="CORBA::Short_out"
@@ -100,30 +111,37 @@ BEGIN {
   idl_impl_hxx["in SALOME_MED::SUPPORT"]="SALOME_MED::SUPPORT_ptr"
   idl_impl_hxx["in SALOME_MED::FIELDDOUBLE"]="SALOME_MED::FIELDDOUBLE_ptr"
   idl_impl_hxx["out SALOME_MED::FIELDDOUBLE"]="SALOME_MED::FIELDDOUBLE_out"
-  idl_impl_hxx["in SALOME::SenderDouble"]="SALOME::SenderDouble_ptr"
-  idl_impl_hxx["out SALOME::SenderDouble"]="SALOME::SenderDouble_out"
+  idl_impl_hxx["in SALOME::vectorOfDouble"]="const SALOME::vectorOfDouble&"
+  idl_impl_hxx["out SALOME::vectorOfDouble"]="SALOME::vectorOfDouble_out"
   idl_impl_hxx["in SALOME::Matrix"]="SALOME::Matrix_ptr"
   idl_impl_hxx["in SALOME_MED::FIELDINT"]="SALOME_MED::FIELDINT_ptr"
   idl_impl_hxx["out SALOME_MED::FIELDINT"]="SALOME_MED::FIELDINT_out"
-  idl_impl_hxx["in SALOME::SenderInt"]="SALOME::SenderInt_ptr"
-  idl_impl_hxx["out SALOME::SenderInt"]="SALOME::SenderInt_out"
+  idl_impl_hxx["in SALOME::vectorOfLong"]="const SALOME::vectorOfLong&"
+  idl_impl_hxx["out SALOME::vectorOfLong"]="SALOME::vectorOfLong_out"
   idl_impl_hxx["void"]="void"
   idl_impl_hxx["long"]="CORBA::Long"
+  idl_impl_hxx["boolean"]="CORBA::Boolean"
   idl_impl_hxx["double"]="CORBA::Double"
   idl_impl_hxx["unsigned long"]="CORBA::ULong"
   idl_impl_hxx["string"]="char*"
   idl_impl_hxx["SALOME_MED::MESH"]="SALOME_MED::MESH_ptr"
   idl_impl_hxx["SALOME_MED::SUPPORT"]="SALOME_MED::SUPPORT_ptr"
   idl_impl_hxx["SALOME_MED::FIELDDOUBLE"]="SALOME_MED::FIELDDOUBLE_ptr"
-  idl_impl_hxx["SALOME::SenderDouble"]="SALOME::SenderDouble_ptr"
+  idl_impl_hxx["SALOME::vectorOfDouble"]="SALOME::vectorOfDouble*"
   idl_impl_hxx["SALOME::Matrix"]="SALOME::Matrix_ptr"
   idl_impl_hxx["SALOME_MED::FIELDINT"]="SALOME_MED::FIELDINT_ptr"
-  idl_impl_hxx["SALOME::SenderInt"]="SALOME::SenderInt_ptr"
+  idl_impl_hxx["SALOME::vectorOfLong"]="SALOME::vectorOfLong*"
+  idl_impl_hxx["StrSeq"]=class_name"_ORB::StrSeq*"
+  idl_impl_hxx["in SALOME_MED::MEDCouplingFieldDoubleCorbaInterface"]="SALOME_MED::MEDCouplingFieldDoubleCorbaInterface_ptr"
+  idl_impl_hxx["SALOME_MED::MEDCouplingUMeshCorbaInterface"]="SALOME_MED::MEDCouplingUMeshCorbaInterface_ptr"
+  idl_impl_hxx["SALOME_MED::MEDCouplingFieldDoubleCorbaInterface"]="SALOME_MED::MEDCouplingFieldDoubleCorbaInterface_ptr"
+  idl_impl_hxx["out SALOME_MED::MEDCouplingFieldDoubleCorbaInterface"]="SALOME_MED::MEDCouplingFieldDoubleCorbaInterface_out"
 #
 #
 # table for c++ code generation : argument's processing
 #
   cpp_impl_a["int"]="\tint _%s(%s);\n"
+  cpp_impl_a["bool"]="\tbool _%s(%s);\n"
   cpp_impl_a["double"]="\tdouble _%s(%s);\n"
   cpp_impl_a["float"]="\tfloat _%s(%s);\n"
   cpp_impl_a["long"]="\tlong _%s(%s);\n"
@@ -132,21 +150,24 @@ BEGIN {
   cpp_impl_a["const char*"]="\tconst char* _%s(%s);\n"
   cpp_impl_a["const std::string&"]="\tconst std::string _%s(%s);\n"
   cpp_impl_a["int&"]="\tint _%s;\n"
+  cpp_impl_a["bool&"]="\tbool _%s;\n"
   cpp_impl_a["double&"]="\tdouble _%s;\n"
   cpp_impl_a["float&"]="\tfloat _%s;\n"
   cpp_impl_a["long&"]="\tlong _%s;\n"
   cpp_impl_a["short&"]="\tshort _%s;\n"
   cpp_impl_a["unsigned&"]="\tunsigned _%s;\n"
-  cpp_impl_a["std::string&"]="std::string _%s;\n"
-  cpp_impl_a["const MEDMEM::MESH&"]="\tMEDMEM::MESHClient* _%s = new MEDMEM::MESHClient(%s);\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* _%s = new MEDMEM::MESHClient(%s);\n"
+  cpp_impl_a["std::string&"]="\tstd::string _%s;\n"
+  cpp_impl_a["const MEDMEM::MESH&"]="\tMEDMEM::MESHClient* _%s = new MEDMEM::MESHClient(%s);\n\t _%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* _%s = new MEDMEM::MESHClient(%s);\n\t _%s->fillCopy();\n"
   cpp_impl_a["const MEDMEM::SUPPORT&"]="\tMEDMEM::SUPPORTClient* _%s = new MEDMEM::SUPPORTClient(%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* _%s = new MEDMEM::SUPPORTClient(%s);\n"
   cpp_impl_a["MEDMEM::FIELD<double>*&"]="\tMEDMEM::FIELD<double>* _%s;\n"
   cpp_impl_a["const MEDMEM::FIELD<double>*"]="\tstd::auto_ptr<MEDMEM::FIELD<double> > _%s ( new MEDMEM::FIELDClient<double,MEDMEM::FullInterlace>(%s) );\n"
   cpp_impl_a["const MEDMEM::FIELD<double>&"]="\tMEDMEM::FIELDClient<double,MEDMEM::FullInterlace> _%s(%s);\n"
-  cpp_impl_a["const std::vector<double>&"]="\tlong _%s_size;\n\tdouble *_%s_value = ReceiverFactory::getValue(%s,_%s_size);\n"\
-             "\tstd::vector<double> _%s(_%s_value,_%s_value+_%s_size);\n\tdelete [] _%s_value;"
+  cpp_impl_a["const std::vector<double>&"]="\tlong _%s_size=%s.length();\n\tconst double *_%s_value = &%s[0];\n"\
+             "\tstd::vector<double> _%s(_%s_value,_%s_value+_%s_size);\n"
+#  cpp_impl_a["const std::vector<double>&"]="\tlong _%s_size;\n\tdouble *_%s_value = ReceiverFactory::getValue(%s,_%s_size);\n"\
+#             "\tstd::vector<double> _%s(_%s_value,_%s_value+_%s_size);\n\tdelete [] _%s_value;"
   cpp_impl_a["std::vector<double>*&"]="\tstd::vector<double>* _%s;\n"
   cpp_impl_a["const std::vector<std::vector<double> >&"]="\tMatrixClient _%s_client;\n\tint _%s_nbRow;\n\tint _%s_nbCol;\n"\
              "\tdouble* _%s_tab = _%s_client.getValue(%s,_%s_nbCol,_%s_nbRow);\n\tstd::vector<std::vector<double> > _%s(_%s_nbRow);\n"\
@@ -155,16 +176,25 @@ BEGIN {
   cpp_impl_a["MEDMEM::FIELD<int>*&"]="\tMEDMEM::FIELD<int>* _%s;\n"
   cpp_impl_a["const MEDMEM::FIELD<int>*"]="\tstd::auto_ptr<MEDMEM::FIELD<int> > _%s ( new MEDMEM::FIELDClient<int>(%s) );\n"
   cpp_impl_a["const MEDMEM::FIELD<int>&"]="\tMEDMEM::FIELDClient<int> _%s(%s);\n"
-  cpp_impl_a["const std::vector<int>&"]="\tlong _%s_size;\n\tint *_%s_value = ReceiverFactory::getValue(%s,_%s_size);\n"\
-             "\tstd::vector<int> _%s(_%s_value,_%s_value+_%s_size);\n\tdelete [] _%s_value;"
+  cpp_impl_a["const std::vector<int>&"]="\tlong _%s_size=%s.length();\n"\
+                        "\tstd::vector<int> _%s(_%s_size);\n"\
+                        "\tfor (int i=0; i!=_%s_size; ++i)\n\t    _%s[i]=%s[i];"
+#  cpp_impl_a["const std::vector<int>&"]="\tlong _%s_size;\n\tint *_%s_value = ReceiverFactory::getValue(%s,_%s_size);\n"\
+#             "\tstd::vector<int> _%s(_%s_value,_%s_value+_%s_size);\n\tdelete [] _%s_value;"
   cpp_impl_a["std::vector<int>*&"]="\tstd::vector<int>* _%s;\n"
-
+  cpp_impl_a["const ParaMEDMEM::MEDCouplingFieldDouble*"]=\
+            "\tParaMEDMEM::MEDCouplingFieldDouble* _%s=ParaMEDMEM::MEDCouplingFieldDoubleClient::New(%s);\n"
+  cpp_impl_a["const ParaMEDMEM::MEDCouplingFieldDouble&"]=\
+            "\tParaMEDMEM::MEDCouplingFieldDouble* __%s=ParaMEDMEM::MEDCouplingFieldDoubleClient::New(%s);\n"\
+            "\tParaMEDMEM::MEDCouplingFieldDouble& _%s=*__%s;\n"
+  cpp_impl_a["ParaMEDMEM::MEDCouplingFieldDouble*&"]="\tParaMEDMEM::MEDCouplingFieldDouble* _%s;\n"
 #
 #
 # table for c++ code generation : returned value processing
 #
   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"
@@ -202,7 +232,12 @@ BEGIN {
              "\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>*"]=\
-             "\tSALOME::SenderDouble_ptr _rtn_ior = SenderFactory::buildSender(*this,&(*_rtn_cpp)[0],(*_rtn_cpp).size(),true);\n"
+             "\tSALOME::vectorOfDouble * _rtn_ior = new SALOME::vectorOfDouble;\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<double>*"]=\
+#             "\tSALOME::SenderDouble_ptr _rtn_ior = SenderFactory::buildSender(*this,&(*_rtn_cpp)[0],(*_rtn_cpp).size(),true);\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"\
@@ -222,7 +257,26 @@ BEGIN {
              "\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>*"]=\
-             "\tSALOME::SenderInt_ptr _rtn_ior = SenderFactory::buildSender(*this,&(*_rtn_cpp)[0],(*_rtn_cpp).size(),true);\n"
+             "\tSALOME::vectorOfLong * _rtn_ior = new SALOME::vectorOfLong;\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::string>"]=\
+            "\t"class_name"_ORB::StrSeq*_rtn_ior = new "class_name"_ORB::StrSeq;\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].c_str();\n"
+  cpp_impl_b["ParaMEDMEM::MEDCouplingFieldDouble*"]=\
+             "\tParaMEDMEM::MEDCouplingFieldDoubleServant * _rtn_field_i = new ParaMEDMEM::MEDCouplingFieldDoubleServant(_rtn_cpp);\n"\
+             "\t_rtn_cpp->decrRef();\n"\
+             "\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);\n"\
+             "\t_rtn_cpp->decrRef();\n"\
+             "\tSALOME_MED::MEDCouplingUMeshCorbaInterface_ptr _rtn_ior = _rtn_mesh_i->_this();\n"
+#  cpp_impl_b["std::vector<int>*"]=\
+#             "\tSALOME::SenderInt_ptr _rtn_ior = SenderFactory::buildSender(*this,&(*_rtn_cpp)[0],(*_rtn_cpp).size(),true);\n"
 
 #
 #
@@ -235,11 +289,18 @@ BEGIN {
              "\tMEDMEM::FIELDINT_i * %s_ior = new MEDMEM::FIELDINT_i(_%s, true);\n"\
             "\t%s = %s_ior->_this();\n"
   cpp_impl_c["std::vector<double>*&"]=\
-             "\t%s = SenderFactory::buildSender(*this,&(*_%s)[0],(*_%s).size(),true);\n"
+             "\t%s = new SALOME::vectorOfDouble;\n"\
+            "\t%s->length((*_%s).size());\n"\
+            "\tfor (int i=0; i<(*_%s).size(); ++i)\n\t    (*%s)[i] = (*_%s)[i];\n"
+#             "\t%s = SenderFactory::buildSender(*this,&(*_%s)[0],(*_%s).size(),true);\n"
   cpp_impl_c["std::vector<int>*&"]=\
-             "\t%s = SenderFactory::buildSender(*this,&(*_%s)[0],(*_%s).size(),true);\n"
+             "\t%s = new SALOME::vectorOfLong;\n"\
+            "\t%s->length((*_%s).size());\n"\
+            "\tfor (int i=0; i<(*_%s).size(); ++i)\n\t    (*%s)[i] = (*_%s)[i];\n"
+#             "\t%s = SenderFactory::buildSender(*this,&(*_%s)[0],(*_%s).size(),true);\n"
   cpp_impl_c["std::string&"]="\t%s = CORBA::string_dup(_%s.c_str());\n"
   cpp_impl_c["int&"]="\t%s = _%s;\n"
+  cpp_impl_c["bool&"]="\t%s = _%s;\n"
   cpp_impl_c["double&"]="\t%s = _%s;\n"
   cpp_impl_c["float&"]="\t%s = _%s;\n"
   cpp_impl_c["long&"]="\t%s = _%s;\n"
@@ -249,6 +310,12 @@ BEGIN {
   cpp_impl_c["const MEDMEM::MESH*"]="\t_%s->removeReference();\n"
   cpp_impl_c["const MEDMEM::SUPPORT&"]="\t_%s->removeReference();\n"
   cpp_impl_c["const MEDMEM::SUPPORT*"]="\t_%s->removeReference();\n"
+  cpp_impl_c["const ParaMEDMEM::MEDCouplingFieldDouble*"]="\t_%s->decrRef();\n"
+  cpp_impl_c["const ParaMEDMEM::MEDCouplingFieldDouble&"]="\t__%s->decrRef();\n"
+  cpp_impl_c["ParaMEDMEM::MEDCouplingFieldDouble*&"]= \
+      "\tParaMEDMEM::MEDCouplingFieldDoubleServant * %s_out=new ParaMEDMEM::MEDCouplingFieldDoubleServant(_%s);\
+       _%s->decrRef();                                                 \
+       %s = %s_out->_this();\n"
 #
 #
 # record sep is ");\n" whith blanks all around, and optional "(" at the beginning
@@ -266,6 +333,7 @@ BEGIN {
       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 ) {
@@ -278,13 +346,25 @@ BEGIN {
     }
   }
   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) {
-       if ( substr(item,1,length(cpptype)) == cpptype ) {
+       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)
@@ -296,6 +376,9 @@ BEGIN {
        }
     }
     ok*=ok2 # ok=0 if one of the type is not compatible
+    if ( ! ok2) {
+       error_message=error_message "\n\t\t-> "item
+    }
   }
 
   # print compatibility 
@@ -310,6 +393,9 @@ BEGIN {
           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
@@ -326,7 +412,7 @@ BEGIN {
       printf "%s %s,",idl_arg_type[type[i]],name[i] >> idl_file
     printf "%s %s", idl_arg_type[type[NF]],name[NF] >> idl_file
   }
-  printf ");\n" >> idl_file
+  printf ") raises (SALOME::SALOME_Exception);\n" >> idl_file
 }  
 #
 # --------------------- treatment 3 ----------------------------------
@@ -340,7 +426,7 @@ BEGIN {
          printf "%s %s,",idl_impl_hxx[idl_arg_type[type[i]]],name[i] >> hxx_file
       printf "%s %s", idl_impl_hxx[idl_arg_type[type[NF]]],name[NF] >> hxx_file
   }
-  printf ");\n" >> hxx_file
+  printf ") throw (SALOME::SALOME_Exception);\n" >> hxx_file
 }
 #
 # --------------------- treatment 4 ----------------------------------
@@ -356,7 +442,7 @@ BEGIN {
          printf "%s %s,",idl_impl_hxx[idl_arg_type[type[i]]],name[i] >> cxx_file
       printf "%s %s", idl_impl_hxx[idl_arg_type[type[NF]]],name[NF] >> cxx_file
   }
-  printf ")\n{\n\tbeginService(\"%s\");\n\tBEGIN_OF(\"%s\");\n",func_name,func_name >> cxx_file
+  printf ") throw (SALOME::SALOME_Exception)\n{\n    beginService(\"%s\");\n    BEGIN_OF(\"%s\");\n    try\n    {\n",func_name,func_name >> cxx_file
 
   # b) generate the argument processing part
   if ( NF >= 2 ){
@@ -389,11 +475,12 @@ BEGIN {
   # d) generate the post_processing of returned and out parameters
   printf ");\n//\tPost-processing & return\n" >> cxx_file
   for (i=2; i<=NF; i++)
-      printf cpp_impl_c[type[i]],name[i],name[i],name[i],name[i] >> cxx_file  # process for out parameters
+      printf cpp_impl_c[type[i]],name[i],name[i],name[i],name[i],name[i],name[i] >> cxx_file  # process for out parameters
   printf cpp_impl_b[type[1]] >> cxx_file  # process for returned value
   printf "\tendService(\"%s\");\n\tEND_OF(\"%s\");\n",func_name,func_name >> cxx_file
   if ( type[1] != "void" )
       printf "\treturn _rtn_ior;\n" >> cxx_file
+  printf "    }\n    catch (std::exception& ex)\n    {\n        THROW_SALOME_CORBA_EXCEPTION( ex.what(), SALOME::INTERNAL_ERROR );\n    }\n" >> cxx_file
   printf "}\n\n" >> cxx_file
 }
 #