3 if [ "$1" = "$2" ]; then
4 echo "Input and Output file can not be the same."
9 echo "Output file already exists, overwrite?"
11 if [ "$REPLY" != "y" ]; then
17 echo "Input file does not exist, can not continue"
21 # If there is a patch for the outputfile patch the input file with it.
22 if [ -f "$2.patch" ]; then
23 echo "Patching $1 with $2.patch"
24 patch -s $1 < "$2.patch"
27 echo "// File modified by fdfix.sh for use by lyx (with xforms 0.81) and gettext" > $2
28 echo "#include <config.h>" >> $2
29 echo "#include \"lyx_gui_misc.h\"" >> $2
30 echo "#include \"gettext.h\"" >> $2
33 # The commands to sed does this:
35 # -e 's/#include "forms\.h"/#include FORMS_H_LOCATION/'
37 # Replace "forms.h" by FORMS_H_LOCATION in #include directives. This
38 # macro is defined in config.h and is either <forms.h> or
41 # -e '/fl_/ s/".[^|]*"/_(&)/'
43 # For all lines containing "fl_" and a string _not_ containging |,
44 # replace the string with _(string)
46 # -e '/shortcut/ s/".*[|].*"/scex(_(&))/'
48 # For all lines containing "shortcut" and a string containing |, replace
49 # the string with scex(_(string))
51 # -e '/fl_add/ s/".*[|].*"/idex(_(&))/'
52 # For all lines containing "fl_add" and a string containing |, replace
53 # the string with idex(_(string))
55 # -e '/fl_add/ s/idex("\(.*\)").*$/&fl_set_button_shortcut(obj,"\1",1);/'
56 # For all lines containing "fl_add" and a string containing |, add the
57 # shortcut command after the end of this line
59 # -e 's/fl_set_object_lcolor/fl_set_object_lcol/'
61 # For all lines replace "fl_set_object_lcolor" with "fl_set_object_lcol"
62 # This will be removed when we don't support 0.81
64 # -e 's/fdui->.*->fdui = fdui/\/\/&/'
66 # For all lines replace "fdui->...->fdui" with "//fdui->...->fdui"
67 # This will be removed when we don't support 0.81
69 # -e 's/\(\(FD_[^ ]*\) \*fdui.*\)sizeof(\*fdui)/\1sizeof(\2)/'
71 # Some picky/broken compilers (eg AIX's xlC) don't like evaluating
72 # sizeof(*fdui) before fdui has been given a value and output a warning.
73 # This will not be needed anymore as soon as fdesign is fixed (already
74 # reported to its authors).
78 -e 's/#include "forms\.h"/#include FORMS_H_LOCATION/' \
79 -e '/fl_/ s/".[^|]*"/_(&)/' \
80 -e '/shortcut/ s/".*[|].*"/scex(_(&))/' \
81 -e '/fl_add/ s/".*[|].*"/idex(_(&))/' \
82 -e '/fl_add/ s/idex(\(.*\)").*$/&fl_set_button_shortcut(obj,scex(\1")),1);/' \
83 -e 's/fl_set_object_lcolor/fl_set_object_lcol/' \
84 -e 's/fdui->.*->fdui = fdui/\/\/&/' \
85 -e 's/\(\(FD_[^ ]*\) \*fdui.*\)sizeof(\*fdui)/\1sizeof(\2)/' >> $2