From: crouzet Date: Fri, 28 Aug 2009 11:59:40 +0000 (+0000) Subject: - add an explicite print of the non compatible types X-Git-Tag: V5_1_3rc1~5 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=0c3041750b307e51b7843b38a8fe9771f8fa7326;p=tools%2Fhxx2salome.git - add an explicite print of the non compatible types - add the management of the bool type --- diff --git a/scripts/parse3.awk b/scripts/parse3.awk index 05df68b..704cd4c 100644 --- a/scripts/parse3.awk +++ b/scripts/parse3.awk @@ -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" @@ -56,6 +58,7 @@ BEGIN { # 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" @@ -85,12 +88,14 @@ BEGIN { # 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" @@ -109,6 +114,7 @@ BEGIN { 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*" @@ -124,6 +130,7 @@ BEGIN { # 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,6 +139,7 @@ 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" @@ -170,6 +178,7 @@ BEGIN { # 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" @@ -261,6 +270,7 @@ BEGIN { # "\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" @@ -287,6 +297,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 ) { @@ -299,6 +310,10 @@ 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 @@ -317,6 +332,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 @@ -331,6 +349,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