From: crouzet Date: Thu, 27 Aug 2009 13:26:41 +0000 (+0000) Subject: Implement the management of exceptions X-Git-Tag: V5_1_3rc1~6 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=b77d6c583c0698face7d63caf9a2742dcd64666a;p=tools%2Fhxx2salome.git Implement the management of exceptions --- diff --git a/scripts/hxx2salome b/scripts/hxx2salome index a35be2d..1fd7733 100755 --- a/scripts/hxx2salome +++ b/scripts/hxx2salome @@ -164,7 +164,8 @@ generate_module_source() # ------------------------- parse hxx file and generate code --------------------------------------- # echo -e "\n-> Extract public functions\n" - cat ${hxx_file} | awk -f ${gene_dir}/parse01.awk | awk -f ${gene_dir}/parse1.awk > ${CLASS_NAME}_public_functions + # we get first rid of the c like comments (parse01), then of the excetion specification (sed filter), finnaly we extract public functions (parse1) + cat ${hxx_file} | awk -f ${gene_dir}/parse01.awk | sed 's/throw.*;/;/g' | awk -f ${gene_dir}/parse1.awk > ${CLASS_NAME}_public_functions cat ${CLASS_NAME}_public_functions if [ ! -s ${CLASS_NAME}_public_functions ] then diff --git a/scripts/parse3.awk b/scripts/parse3.awk index b5eeb19..05df68b 100644 --- a/scripts/parse3.awk +++ b/scripts/parse3.awk @@ -347,7 +347,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 ---------------------------------- @@ -361,7 +361,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 ---------------------------------- @@ -377,7 +377,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 ){ @@ -415,6 +415,7 @@ BEGIN { 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 } # diff --git a/scripts/template_src.tgz b/scripts/template_src.tgz index a8b7b24..ca61020 100644 Binary files a/scripts/template_src.tgz and b/scripts/template_src.tgz differ