Fail gracefully if fdesign fails.

Don't overwrite the .h file if the newly generated one is identical.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4400 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Angus Leeming 2002-06-14 10:51:32 +00:00
parent cfa1446531
commit 36b8a40cd7
3 changed files with 41 additions and 12 deletions

View File

@ -2,6 +2,12 @@
* forms/Makefile.am: make the .Ch files dependent on the fdfix files.
* fdfix.sh: test whether "fdesign -convert file.fd" succeeds and
if not, exit gracefully.
Test whether the newly generated .h file is different from the existing
one and if not discard it to prevent unnecessary recompilation in the
xforms directory.
2002-06-14 Angus Leeming <leeming@lyx.org>
* FormPreferences (XYZ::build): pass "&parent_" to build_xyz, not
@ -30,10 +36,10 @@
FormXyz class. It's unnecessary and needs patch files in addition to
the sed magic to work properly. Thus, the structs above are now
generated by routines
FD_aboutlyx * build_aboutlyx();
FD_aboutlyx_version * build_aboutlyx_version();
FD_aboutlyx_credits * build_aboutlyx_credits();
FD_aboutlyx_license * build_aboutlyx_license();
FD_aboutlyx * build_aboutlyx(void *);
FD_aboutlyx_version * build_aboutlyx_version(void *);
FD_aboutlyx_credits * build_aboutlyx_credits(void *);
FD_aboutlyx_license * build_aboutlyx_license(void *);
* forms/README: document all the above.

View File

@ -52,9 +52,13 @@ If you follow these simple rules then you will generate code for functions
build_xxx that will need no further editing to make them work. For example,
form_graphics.h contains the struct declarations and build methods, so:
extern FD_graphics * build_graphics();
extern FD_graphics_file * build_graphics_file();
extern FD_graphics_size * build_graphics_size();
extern FD_graphics_bbox * build_graphics_bbox();
extern FD_graphics_special * build_graphics_special();
extern FD_graphics_lyxview * build_graphics_lyxview();
extern FD_graphics * build_graphics(void *);
extern FD_graphics_file * build_graphics_file(void *);
extern FD_graphics_size * build_graphics_size(void *);
extern FD_graphics_bbox * build_graphics_bbox(void *);
extern FD_graphics_special * build_graphics_special(void *);
extern FD_graphics_lyxview * build_graphics_lyxview(void *);
where the function is to be passed a pointer to the parent dialog
(usually "this") so that this pointer can be cast of to FormBase * and
the appropriate method called.

View File

@ -52,6 +52,10 @@ fi
FDESIGN=fdesign
FDFILE=${BASENAME}.fd
(cd ${DIRNAME}; ${FDESIGN} -convert ${FDFILE})
if [ $? -ne 0 ]; then
echo "\"${FDESIGN} -convert ${FDFILE}\" failed. Please investigate."
exit 1
fi
#==================================
# Modify the .h file for use by LyX
@ -72,9 +76,24 @@ if [ -f "${HPATCH}" ] ; then
patch -s ${HOUT} < ${HPATCH}
fi
# Clean up, to leave the finished .h file
# Clean up, to leave the finished .h file. We can be a little tricky here
# testing to see if the finished file exists already and if it does
# testing whether there are any differences.
# If there are no differences, then don't overwrite to prevent unnecessary
# compilation in the xforms directory.
rm -f ${HIN}
mv ${HOUT} ${BASENAME}.h
MOVE_H_FILE=1
if [ -r ${BASENAME}.h ]; then
cmp -s ${HOUT} ${BASENAME}.h
if [ $? -eq 0 ]; then
MOVE_H_FILE=0
fi
fi
if [ ${MOVE_H_FILE} -eq 1 ]; then
mv ${HOUT} ${BASENAME}.h
else
rm -f ${HOUT}
fi
#==================================
# Create the .C file for use by LyX