Salome HOME
Update copyright
[tools/hxx2salome.git] / scripts / parse3.awk
index 704cd4cb2eb021b13ecf2b982691cfea279797b9..0c5c560eb379630325b06eef2af83fbc93017ef1 100644 (file)
@@ -52,6 +52,9 @@ BEGIN {
   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
@@ -83,6 +86,9 @@ BEGIN {
   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"
 #
 #
 # Corba mapping table (for argument's types and returned types)
@@ -125,6 +131,11 @@ BEGIN {
   idl_impl_hxx["SALOME::Matrix"]="SALOME::Matrix_ptr"
   idl_impl_hxx["SALOME_MED::FIELDINT"]="SALOME_MED::FIELDINT_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
@@ -146,8 +157,8 @@ BEGIN {
   cpp_impl_a["short&"]="\tshort _%s;\n"
   cpp_impl_a["unsigned&"]="\tunsigned _%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" # 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["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"
@@ -171,7 +182,12 @@ BEGIN {
 #  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
@@ -245,6 +261,20 @@ BEGIN {
             "\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"
 
@@ -280,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
@@ -319,8 +355,16 @@ BEGIN {
     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)