On Thursday 30 May 2002 5:57 pm, Jean-Marc Lasgouttes wrote:
> >>>>> "Angus" == Angus Leeming <[EMAIL PROTECTED]> writes:
> Angus> Perhaps the best fix is that suggested by Lars in a recent
> Angus> patch he posted to the list. Ie, #include the .tmpl files in
> Angus> the approprite .h files, scrubbing #include .tmpl from any .C
> Angus> file.
>
> Seems a bit too complicated for me :)

Apply this script from the frontends directory of your 1_2_X branch.

Note that I use diff and mv -i so that you can see exactly what has been 
changed.

#!/bin/sh

TEMPFILE=.tempfile
for FILE in */*.C
do
        RESULT=x`grep "tmpl" ${FILE}`
        if [ "${RESULT}" != "x" ]; then
                sed -e "/tmpl/d" < ${FILE} > ${TEMPFILE}
                diff -u ${FILE} ${TEMPFILE}
                mv -i ${TEMPFILE} ${FILE}
        fi
done
rm -f ${TEMPFILE}

SEDFILE=tmpl.sed
for FILE in controllers/*.tmpl
do
        TMPL=`basename ${FILE}`
        HFILE=controllers/`basename ${FILE} tmpl`h

        # ${SEDFILE} contains the code needed to create the
        # following change:
#       +
#       +#include "ButtonController.tmpl"
#       +
#       #endif // BUTTONCONTROLLER_H

        echo "/#endif/i\\" > ${SEDFILE}
        echo "\\" >> ${SEDFILE}
        echo "#include \"${TMPL}\"\\" >> ${SEDFILE}
        echo "" >> ${SEDFILE}

        sed -f ${SEDFILE} < ${HFILE} > ${TEMPFILE}
        diff -u ${HFILE} ${TEMPFILE}
        mv -i ${TEMPFILE} ${HFILE}
done
rm -f ${TEMPFILE} ${SEDFILE}

Reply via email to