3 # NOTE: This is NOT the same fdfix.sh as in ${top_srcdir}/forms
4 # It is a modified version to suit use for gui-indep.
8 echo "Input file does not exist. Cannot continue"
14 # names of the files generated by fdesign and by running the sed scripts
15 BASE=`basename $1 .fd`
17 if [ $1 = $BASE ]; then
18 echo "Input file is not a .fd file. Cannot continue"
27 # Ascertain the class name from the name of the file
28 # eg form_my_new_dialog -> FormMyNewDialog
34 SECTION=`echo $BASE | cut -d_ -f$i`
39 FIRST=`echo $SECTION | cut -c1 | tr a-z A-Z`
40 SECOND=`echo $SECTION | cut -c2-`
41 CLASSNAME=$CLASSNAME$FIRST$SECOND
47 # Create .c and .h files
51 FDFIXC_MOD=fdfixc_modified.sed
53 # Modify .h file for use by LyX
54 echo "// File modified by fdfix.sh for use by lyx (with xforms >= 0.88) and gettext" > $HOUT
55 sed -f $FDFIXH < $HIN >> $HOUT
57 # Patch the .h file if a patch exists
58 if [ -f "$HOUT.patch" ] ; then
59 echo "Patching $HOUT with $HOUT.patch"
60 patch -s $HOUT < $HOUT.patch
63 # Modify the .c file sed-script
64 # (Quicker to modify the sed script than the .c file!)
65 sed -e "s/CLASSNAME/$CLASSNAME/" < $FDFIXC > $FDFIXC_MOD
67 # Modify .c file for use by LyX
68 echo "// File modified by fdfix.sh for use by lyx (with xforms >= 0.88) and gettext" > $COUT
69 echo "#include <config.h>" >> $COUT
70 echo "#include \"xforms_helpers.h\"" >> $COUT
71 echo "#include \"gettext.h\"" >> $COUT
73 grep bmtable $CIN > /dev/null
75 echo "#include \"bmtable.h\"" >> $COUT
80 sed -f $FDFIXC_MOD < $CIN >> $COUT
82 # Patch the .C file if a patch exists
83 if [ -f "$COUT.patch" ] ; then
84 echo "Patching $COUT with $COUT.patch"
85 patch -s $COUT < $COUT.patch
88 # Clean up, to leave .C and .h files
89 rm -f $CIN $HIN $FDFIXC_MOD