]> git.lyx.org Git - features.git/commitdiff
Fail gracefully if fdesign fails.
authorAngus Leeming <leeming@lyx.org>
Fri, 14 Jun 2002 10:51:32 +0000 (10:51 +0000)
committerAngus Leeming <leeming@lyx.org>
Fri, 14 Jun 2002 10:51:32 +0000 (10:51 +0000)
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

src/frontends/xforms/ChangeLog
src/frontends/xforms/forms/README
src/frontends/xforms/forms/fdfix.sh

index fb67613d563251db2cc199929b4790f2ef956397..827643a63ad5add8ea5768bb55a09505bc3be814 100644 (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
        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.
 
index 4bbbf0922fd3c3c99fe1a9ce66dc157885ceb2af..c5c941d7e28a910602ad899449ec358ef6143f78 100644 (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.
index 6a4d143dc8fb924c9d531867b2860ae268a52541..154fa09dbb191a7eb325cac2e1780a2718b5f3a6 100644 (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