On 21-Jan-99 Fred Hucht wrote:
>2) Lines like
>[lyx.C:15]
>FD_form_title *fdui = (FD_form_title *) fl_calloc(1, sizeof(*fdui));
>gives the warning from AIX's xlC
>"lyx.C", line 15.64: 1540-101: (W) "fdui" may be used before being set.
This should be
FD_form_title *fdui = (FD_form_title *) fl_calloc(1, sizeof(FD_form_title));
to keep xLC (and other equally picky compilers) from complaining. As
Jean-Marc said, xforms does this automatically. I'm attaching a new
version of fdfix.sh that uses sed (awkwardly, I think) to make this
change. The patch for this one would be nearly as long as the file,
including the comments I added about the cryptic sed commands that I
added.
Also, I got a compiler warning in menus.C about bool LinuxDoc not being
used (in ShowInsertMenu). The following micropatch fixes this:
--- menus.C.old Sat Jan 16 13:01:16 1999
+++ menus.C Thu Jan 21 10:53:20 1999
@@ -1115,10 +1115,12 @@
Buffer *tmpbuffer = men->_view->currentBuffer();
LyXFunc *tmpfunc = men->_view->getLyXFunc();
+#if 0 // No longer used
// Is textclass LinuxDoc?
bool LinuxDoc = tmpbuffer->isLinuxDoc();
+#endif
int SubInsertAscii = fl_defpup(FL_ObjWin(ob),
_("Import ASCII file%t"
"|As Lines%x41"
Note that the "#if 0" matches stylistically with the way that the uses
of LinuxDoc later in the same function are currently handled. To remove
all of the (now unnecessary) special-case handling for LinuxDoc for this
menu, instead apply the following (slightly larger) patch.
--- menus.C.old Sat Jan 16 13:01:16 1999
+++ menus.C Thu Jan 21 11:06:09 1999
@@ -1115,11 +1115,8 @@
Buffer *tmpbuffer = men->_view->currentBuffer();
LyXFunc *tmpfunc = men->_view->getLyXFunc();
- // Is textclass LinuxDoc?
- bool LinuxDoc = tmpbuffer->isLinuxDoc();
-
int SubInsertAscii = fl_defpup(FL_ObjWin(ob),
_("Import ASCII file%t"
"|As Lines%x41"
"|As Paragraphs%x42"));
@@ -1220,30 +1217,18 @@
fl_setpup_shortcut(InsertMenu, 14, scex(_("IM|iI#i#I")));
fl_setpup_shortcut(InsertMenu, 15, scex(_("IM|dD#d#D")));
fl_setpup_shortcut(InsertMenu, 16, scex(_("IM|wW#w#W")));
-#if 0
- if (LinuxDoc) {
- /* for linuxdoc sgml */
-#endif
- fl_addtopup(InsertMenu, _("|URL"));
- fl_setpup_shortcut(InsertMenu, 17, scex(_("IM|Uu#u#U")));
- fl_addtopup(InsertMenu, _("|HTML URL"));
- fl_setpup_shortcut(InsertMenu, 18, scex(_("IM|Hh#h#H")));
-#if 0
- }
-#endif
+ fl_addtopup(InsertMenu, _("|URL"));
+ fl_setpup_shortcut(InsertMenu, 17, scex(_("IM|Uu#u#U")));
+ fl_addtopup(InsertMenu, _("|HTML URL"));
+ fl_setpup_shortcut(InsertMenu, 18, scex(_("IM|Hh#h#H")));
+
if (tmpbuffer->isReadonly()) {
for (int ii = 1; ii <= 18; ii++)
fl_setpup_mode(InsertMenu, ii, FL_PUP_GREY);
-#if 0
- if (LinuxDoc) {
-#endif
- fl_setpup_mode(InsertMenu, 17, FL_PUP_GREY);
- fl_setpup_mode(InsertMenu, 18, FL_PUP_GREY);
-#if 0
- }
-#endif
}
fl_setpup_position(
men->_view->getForm()->x + ob->x,
----------------------------------
Carl Ollivier-Gooch [EMAIL PROTECTED]
Department of Mechanical Engineering Voice: +1-604-822-1854
University of British Columbia Fax: +1-604-822-2403
2324 Main Mall URL: http://www.mech.ubc.ca/~cfog
Vancouver, BC V6T 1Z4 Canada
----------------------------------
#! /bin/sh
if [ "$1" = "$2" ]; then
echo "Input and Output file can not be the same."
exit 1
fi
if [ -f $2 ]; then
echo "Output file already exists, overwrite?"
read
if [ "$REPLY" != "y" ]; then
exit 0
fi
fi
if [ ! -f $1 ]; then
echo "Input file does not exist, can not continue"
exit 1
fi
# If there is a patch for the outputfile patch the input file with it.
if [ -f "$2.patch" ]; then
echo "Patching $1 with $2.patch"
patch -s $1 < "$2.patch"
fi
echo "// File modified by fdfix.sh for use by lyx (with xforms 0.81) and gettext
" > $2
echo "#include <config.h>" >> $2
echo "#include \"lyx_gui_misc.h\"" >> $2
echo "#include \"gettext.h\"" >> $2
echo >> $2
# The commands to sed does this:
#
# -e 's/#include "forms\.h"/#include FORMS_H_LOCATION/'
#
# Replace "forms.h" by FORMS_H_LOCATION in #include directives. This
# macro is defined in config.h and is either <forms.h> or
# <X11/forms.h>.
#
# -e '/fl_/ s/".[^|]*"/_(&)/'
#
# For all lines containing "fl_" and a string _not_ containging |,
# replace the string with _(string)
#
# -e '/shortcut/ s/".*[|].*"/scex(_(&))/'
#
# For all lines containing "shortcut" and a string containing |, replace
# the string with scex(_(string))
#
# -e '/fl_add/ s/".*[|].*"/idex(_(&))/'
# For all lines containing "fl_add" and a string containing |, replace
# the string with idex(_(string))
#
# -e '/fl_add/ s/idex("\(.*\)").*$/&fl_set_button_shortcut(obj,"\1",1);/'
# For all lines containing "fl_add" and a string containing |, add the
# shortcut command after the end of this line
#
# -e 's/fl_set_object_lcolor/fl_set_object_lcol/'
#
# For all lines replace "fl_set_object_lcolor" with "fl_set_object_lcol"
# This will be removed when we don't support 0.81
#
# -e 's/fdui->.*->fdui = fdui/\/\/&/'
#
# For all lines replace "fdui->...->fdui" with "//fdui->...->fdui"
# This will be removed when we don't support 0.81
#
# -e '/\*fdui = / {' \
# -e 's/sizeof(\*fdui.*/sizeof(/' \
# -e 'h' \
# -e 's/ \*fdui = .*/));/' \
# -e 's/ //' \
# -e 'H' \
# -e 'g' \
# -e 's/\n//' \
# -e '}' \
#
# Replace the braindead calls to sizeof(*fdui) (before fdui is assigned)
# with a call using the actual type involved. Probably the sed commands
# used are needlessly complicated, but it replaces (for example)
#
# FD_citation_form *fdui = (FD_citation_form *) fl_calloc(1, sizeof(*fdui));
#
# with
#
# FD_citation_form *fdui = (FD_citation_form *) fl_calloc(1, sizeof(FD_citation
_form));
#
# This fixes bitter complaints by some compilers.
cat $1 | sed \
-e 's/#include "forms\.h"/#include FORMS_H_LOCATION/' \
-e '/fl_/ s/".[^|]*"/_(&)/' \
-e '/shortcut/ s/".*[|].*"/scex(_(&))/' \
-e '/fl_add/ s/".*[|].*"/idex(_(&))/' \
-e '/fl_add/ s/idex(\(.*\)").*$/&fl_set_button_shortcut(obj,scex(\1")),1);/' \
-e 's/fl_set_object_lcolor/fl_set_object_lcol/' \
-e 's/fdui->.*->fdui = fdui/\/\/&/' \
-e '/\*fdui = / {' \
-e 's/sizeof(\*fdui.*/sizeof(/' \
-e 'h' \
-e 's/ \*fdui = .*/));/' \
-e 's/ //' \
-e 'H' \
-e 'g' \
-e 's/\n//' \
-e '}' \
>> $2