# ------------------------- 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/virtual //g' | sed 's/MEDMEM_EXPORT//g' | 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
cat code_cxx >> hxx2salome_journal
echo
#
+# select archive for MEDMEM or MEDCoupling
+ grep MEDCoupling code_idl >& /dev/null
+ if [ $? -eq 0 ]
+ then
+ template_component_archive=${gene_dir}/template_coupling_src.tgz
+ else
+ template_component_archive=${gene_dir}/template_src.tgz
+ fi
+#
#
# ------------------- duplicates template module and insert generated code ------------------------------
#
echo -e "\n-> Duplicate template module" | tee hxx2salome_journal
- tar xvfz ${gene_dir}/template_src.tgz >> hxx2salome_journal
+ tar xvfz ${template_component_archive} >> hxx2salome_journal
mv HXX2SALOME_GENERIC_CLASS_NAME_SRC ${CLASS_NAME}_SRC
${gene_dir}/renameSalomeModule -i HXX2SALOME_GENERIC_CLASS_NAME ${CLASS_NAME} ${CLASS_NAME}_SRC
###>> hxx2salome_journal
get_info_makefile
echo -e "\n-> Substitute flags in Makefile.am"
- sed "s?HXX2SALOME_INCLUDE?${makefile_include}?g
- s?HXX2SALOME_PYTHON_FILE?${python_test_file}?g
- s?HXX2SALOME_LIB?${makefile_lib}?g
- " ${CLASS_NAME}_SRC/src/${CLASS_NAME}/Makefile.am > tmpfile
- mv tmpfile ${CLASS_NAME}_SRC/src/${CLASS_NAME}/Makefile.am
+ sed -i "s?HXX2SALOME_INCLUDE?${makefile_include}?g
+ s?HXX2SALOME_PYTHON_FILE?${python_test_file}?g
+ s?HXX2SALOME_LIB?${makefile_lib}?g
+ " ${CLASS_NAME}_SRC/src/${CLASS_NAME}/Makefile.am
+
#
# generate component catalog
echo -e "\n-> Generate component catalog" | tee hxx2salome_journal
cd ${CLASS_NAME}_SRC/resources
VER=`cat ${KERNEL_ROOT_DIR}/bin/salome/VERSION | awk ' { print $NF }'` # extract number of version
export PYTHONPATH=${PYTHONPATH}:${KERNEL_ROOT_DIR}/bin/salome # to be sure IDLparser is in PYTHONPATH
- ${idlparser} -Wbcatalog=tmp.xml,icon=${CLASS_NAME}.png,version=${VER} -I${KERNEL_ROOT_DIR}/idl/salome -I${MED_ROOT_DIR}/idl/salome ../idl/${CLASS_NAME}_Gen.idl >& /dev/null | tee hxx2salome_journal
- if [ -f tmp.xml ]
+ #${idlparser} -Wbcatalog=${CLASS_NAME}Catalog.xml,icon=${CLASS_NAME}.png,version=${VER} -I${KERNEL_ROOT_DIR}/idl/salome -I${MED_ROOT_DIR}/idl/salome ../idl/${CLASS_NAME}_Gen.idl >& /dev/null | tee hxx2salome_journal
+ ${idlparser} -Wbcatalog=${CLASS_NAME}Catalog.xml,icon=${CLASS_NAME}.png,version=${VER} -I${KERNEL_ROOT_DIR}/idl/salome -I${MED_ROOT_DIR}/idl/salome ../idl/${CLASS_NAME}_Gen.idl
+ if [ -f ${CLASS_NAME}Catalog.xml ]
then
- cat tmp.xml | sed 's/_Gen//g' > ${CLASS_NAME}Catalog.xml
+ sed -i "s?_Gen??g
+ s?SALOME/vectorOfDouble?dblevec?g
+ s?SALOME/vectorOfLong?intvec?g
+ s?${CLASS_NAME}_ORB/StrSeq?stringvec?g" ${CLASS_NAME}Catalog.xml
else
echo Error with runIDLparser - the catalog was not generated
exit
fi
- rm tmp.xml
-#
}
compile()
do_compile=0
do_launch=0
make_gui=0
- #
+#
welcome # print some welcome info
#
+gene_dir=`dirname $0`
+if [ ! -f ${gene_dir}/parse3.awk -o ! -f ${gene_dir}/template_src.tgz ] # final check
+then
+ echo -e "\nError : scripts parse3.awk or template_src.tgz not present in hxx2salome directory : $gene_dir"
+ usage
+fi
+#
while getopts "cs:e:h:lg" Option
do
case $Option in
# only if KERNEL_ROOT_DIR and MED_ROOT_DIR are defined
if [ "${SHELL_EXT}" == "sh" ] && [ ${ENVIRON_FILE} ] && [ -f ${ENVIRON_FILE} ]
then
+ pwd
echo -e "\n Environment file with sh syntax specified => we source ${ENVIRON_FILE}"
- source ${ENVIRON_FILE}
+ cat ${ENVIRON_FILE} | sed "s/ENV_FOR_LAUNCH=1/ENV_FOR_LAUNCH=0/g" > ${ENVIRON_FILE}.tmp
+ source ${ENVIRON_FILE}.tmp
+ #rm ${ENVIRON_FILE}.tmp
+ #source ${ENVIRON_FILE}
else
if [ ${KERNEL_ROOT_DIR} ] && [ -d ${KERNEL_ROOT_DIR} ] && [ ${MED_ROOT_DIR} ] && [ -d ${MED_ROOT_DIR} ]
then
fi
fi
fi
-
-# look up hxx2salome scripts
-# - first search in directory ${HXX2SALOME_ROOT_DIR} (if the variable is defined)
-# - then search in directory ${HXX2SALOME_ROOT_DIR}/bin
-# - finally seach locally.
-#
-if [ ${HXX2SALOME_ROOT_DIR} ] && [ -d ${HXX2SALOME_ROOT_DIR} ]
-then
- echo " HXX2SALOME_ROOT_DIR variable is defined : ${HXX2SALOME_ROOT_DIR} => we look up hxx2salome scripts inside"
- if [ -f ${HXX2SALOME_ROOT_DIR}/parse1.awk -a -f ${HXX2SALOME_ROOT_DIR}/parse2.awk ] # check if script are found in ${HXX2SALOME_ROOT_DIR}
- then
- gene_dir=${HXX2SALOME_ROOT_DIR}
- elif [ -f ${HXX2SALOME_ROOT_DIR}/bin/parse1.awk -a -f ${HXX2SALOME_ROOT_DIR}/bin/parse2.awk ] # else check /bin directory
- then
- gene_dir=${HXX2SALOME_ROOT_DIR}/bin
- else
- echo -e "\nError : Variable HXX2SALOME_ROOT_DIR not correctly set"
- usage
- fi
-else
- echo "HXX2SALOME_ROOT_DIR directory not set => we look up hxx2salome scripts locally"
- if [ -f parse1.awk -a -f parse2.awk ] # check if script are found locally
- then
- gene_dir=`pwd` # case where hxx2salome was launched from HXX2SALOME directory
- else
- echo -e "\nError : Variable HXX2SALOME_ROOT_DIR is not set, and hxx2salome didn't find his scripts locally"
- usage
- fi
-fi
-echo " hxx2salome directory found : $gene_dir"
-if [ ! -f ${gene_dir}/parse3.awk -o ! -f ${gene_dir}/template_src.tgz ] # final check
-then
- echo -e "\nError : scripts parse3.awk or template_src.tgz not present in hxx2salome directory : $gene_dir"
- usage
-fi
#
# get class name
#