From: crouzet Date: Tue, 25 Oct 2005 14:19:28 +0000 (+0000) Subject: Bug correction for multiple arguments of type std::vector X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=aefea31039ac7f6de69561d2a8fa6d9b2a5b4e84;p=tools%2Fhxx2salome.git Bug correction for multiple arguments of type std::vector --- diff --git a/scripts/parse3.awk b/scripts/parse3.awk index 0d8a22b..c1f0458 100644 --- a/scripts/parse3.awk +++ b/scripts/parse3.awk @@ -127,13 +127,13 @@ BEGIN { cpp_impl_a["MEDMEM::FIELD*&"]="\tMEDMEM::FIELD* _%s;\n" cpp_impl_a["const MEDMEM::FIELD*"]="\tstd::auto_ptr > _%s ( new MEDMEM::FIELDClient(%s) );\n" cpp_impl_a["const MEDMEM::FIELD&"]="\tMEDMEM::FIELDClient _%s(%s);\n" - cpp_impl_a["const std::vector&"]="\tlong _size;\n\tdouble *_value = ReceiverFactory::getValue(%s,_size);\n"\ - "\tstd::vector _%s(_value,_value+_size);\n\tdelete [] _value;" + cpp_impl_a["const std::vector&"]="\tlong _%s_size;\n\tdouble *_%s_value = ReceiverFactory::getValue(%s,_%s_size);\n"\ + "\tstd::vector _%s(_%s_value,_%s_value+_%s_size);\n\tdelete [] _%s_value;" cpp_impl_a["MEDMEM::FIELD*&"]="\tMEDMEM::FIELD* _%s;\n" cpp_impl_a["const MEDMEM::FIELD*"]="\tstd::auto_ptr > _%s ( new MEDMEM::FIELDClient(%s) );\n" cpp_impl_a["const MEDMEM::FIELD&"]="\tMEDMEM::FIELDClient _%s(%s);\n" - cpp_impl_a["const std::vector&"]="\tlong _size;\n\tint *_value = ReceiverFactory::getValue(%s,_size);\n"\ - "\tstd::vector _%s(_value,_value+_size);\n\tdelete [] _value;" + cpp_impl_a["const std::vector&"]="\tlong _%s_size;\n\tint *_%s_value = ReceiverFactory::getValue(%s,_%s_size);\n"\ + "\tstd::vector _%s(_%s_value,_%s_value+_%s_size);\n\tdelete [] _%s_value;" # # # table for c++ code generation : returned value processing @@ -308,8 +308,7 @@ BEGIN { # generate the C++ implementation of component (cxx file) # { - - + # a) generate the function declaration + macro declarations func_name=class_name"_i::"name[1] printf "%s %s(",idl_impl_hxx[idl_rtn_type[type[1]]],func_name >> cxx_file if ( NF >= 2 ){ # if there is arguments, print them @@ -319,12 +318,14 @@ BEGIN { } printf ")\n{\n\tbeginService(\"%s\");\n\tBEGIN_OF(\"%s\");\n",func_name,func_name >> cxx_file + # b) generate the argument processing part if ( NF >= 2 ){ printf "//\tArguments processing\n" >> cxx_file for (i=2; i<=NF; i++) - printf cpp_impl_a[type[i]],name[i],name[i] >> cxx_file + printf cpp_impl_a[type[i]],name[i],name[i],name[i],name[i],name[i],name[i],name[i],name[i],name[i] >> cxx_file } + # c) generate the call to the c++ component if ( type[1] == "void" ) # if return type is void, the call syntax is different. printf "//\tCall cpp component\n\tcppCompo_->%s(",name[1] >> cxx_file else @@ -343,6 +344,8 @@ BEGIN { printf " %s_%s%s",pre,name[i],post >> cxx_file } } + + # 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