# ------------------------- 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
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 ----------------------------------
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 ----------------------------------
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 ){
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
}
#