97/08/06 K.Fujii Original from: ftp://preprints.cern.ch/electronic/xviewer/xtiff/xtiff.tar.gz ------------------------------------------------------------------------------- Modifications for MkLinux ------------------------------------------------------------------------------- (1) help.c Window size adjusted to work with Xaw3d. (2) makefile Modified to use installed tiff-v3.4beta036 library and header files instead of v1.14 coming with the xtiff source package. Added install as a make target. (3) transform.c Modified function prototypes to match the actual implementations. (4) xtiff.c Window size adjusted to work with Xaw3d. Reset zoomMemory to NULL after invoking XDestroyImage, since otherwise it causes segmentation fault. diff -c -r xtiff.ORIG/makefile xtiff/makefile *** xtiff.ORIG/makefile Wed Sep 7 20:17:34 1994 --- xtiff/makefile Wed Aug 6 19:53:34 1997 *************** *** 1,5 **** --- 1,7 ---- # makefile - for revised xtiff (tiff viewer w/rotate, zoom & pretty buttons) + BINDIR = /usr/local/bin + #configuration for the program BUTTONS = -DTEXTBUTTONS=1 -Dbutton_width=32 -Dbutton_height=32 *************** *** 17,34 **** #where things are - this is a mess, sorry ! X11INCDIR = /loc/usr/openwin/include ! X11LIBDIR = /usr/openwin/lib ! LIBTIFFDIR = ./libtiff ! LIBTIFFINCDIR = $(LIBTIFFDIR) #need all these libraries XAWLIB = -lXaw ! XMULIB = /loc/usr/openwin/lib/libXmu.a XTLIB = -lXt XTEXTLIB = -lXext X11LIB = -lX11 MATHSLIB = -lm LIBTIFFLIB = -ltiff --- 19,39 ---- #where things are - this is a mess, sorry ! X11INCDIR = /usr/X11R6/include ! X11LIBDIR = /usr/X11R6/lib ! LIBTIFFDIR = $(X11LIBDIR) ! # LIBTIFFINCDIR = $(LIBTIFFDIR) ! LIBTIFFINCDIR = $(X11INCDIR)/tiff #need all these libraries XAWLIB = -lXaw ! XMULIB = -lXmu XTLIB = -lXt XTEXTLIB = -lXext X11LIB = -lX11 + ICELIB = -lICE + SMLIB = -lSM MATHSLIB = -lm LIBTIFFLIB = -ltiff *************** *** 42,75 **** $(XTLIB) \ $(XTEXTLIB) \ $(X11LIB) \ $(MATHSLIB) \ $(LIBTIFFLIB) #are we compiling to debug ? ! DEBUG_OR_OPTIMISE = -O #compiler & flags ! CC = cc #these are for gcc ! #CFLAGS = -DNOSTDHDRS \ ! # -fstrength-reduce \ ! # -fpcc-struct-return \ ! # -fwritable-strings \ ! # -traditional \ ! # -c \ ! # -target sun4 \ ! # $(DEBUG_OR_OPTIMISE) \ ! # $(INCLUDES) #these are for cc ! CFLAGS = -c \ ! $(DEBUG_OR_OPTIMISE) \ ! -target sun4 \ ! $(INCLUDES) #linker & flags ! LD = cc LDFLAGS = -o $(EXECNAME) --- 47,80 ---- $(XTLIB) \ $(XTEXTLIB) \ $(X11LIB) \ + $(ICELIB) \ + $(SMLIB) \ $(MATHSLIB) \ $(LIBTIFFLIB) #are we compiling to debug ? ! DEBUG_OR_OPTIMISE = -O -g #compiler & flags ! CC = gcc #these are for gcc ! CFLAGS = -DNOSTDHDRS \ ! -fstrength-reduce \ ! -fpcc-struct-return \ ! -fwritable-strings \ ! -c \ ! $(DEBUG_OR_OPTIMISE) \ ! $(INCLUDES) #these are for cc ! # CFLAGS = -c \ ! # $(DEBUG_OR_OPTIMISE) \ ! # -target sun4 \ ! # $(INCLUDES) #linker & flags ! LD = gcc LDFLAGS = -o $(EXECNAME) *************** *** 77,121 **** all: $(EXECNAME) ! $(EXECNAME): xtiff.o transform.o help.o $(LIBTIFFDIR)/libtiff.a $(LD) $(LDFLAGS) xtiff.o transform.o help.o $(LIBS) ! xtiff.o: xtiff.c xtifficon.h buttons.h makefile $(LIBTIFFDIR)/libtiff.a ! $(CC) -o xtiff.o xtiff.c $(CFLAGS) $(CONFIG_FLAGS) transform.o: transform.c ! $(CC) -o transform.o transform.c $(CFLAGS) $(CONFIG_FLAGS) help.o: help.c endhelp.h ! $(CC) -o help.o help.c $(CFLAGS) $(CONFIG_FLAGS) ! ! $(LIBTIFFDIR)/libtiff.a: ! @if [ ! -f $(LIBTIFFDIR)/libtiff.a ]; then\ ! if [ -f libtiff.tar.Z ]; then\ ! echo -n uncompressing libtiff.tar.Z...;\ ! uncompress libtiff.tar.Z;\ ! echo finished;\ ! fi;\ ! if [ -f libtiff.tar ]; then\ ! echo -n extracting libtiff files...;\ ! tar xf libtiff.tar;\ ! echo finished;\ ! fi;\ ! sh -c "cd $(LIBTIFFDIR); make; rm -f *.c *.o Make* mkg3*;";\ ! if [ -f libtiff.tar ]; then\ ! echo -n recompressing libtiff.tar...;\ ! compress libtiff.tar;\ ! echo finished;\ ! fi;\ ! fi rebuild: clean ./collate-buttons $(MAKE) -f $(MAKEFILE) clean: ! rm -f xtiff.o transform.o help.o lint: lint $(INCLUDES) $(CONFIG_FLAGS) xtiff.c transform.c help.c --- 82,110 ---- all: $(EXECNAME) ! $(EXECNAME): xtiff.o transform.o help.o $(LD) $(LDFLAGS) xtiff.o transform.o help.o $(LIBS) ! xtiff.o: xtiff.c xtifficon.h buttons.h makefile ! $(CC) xtiff.c $(CFLAGS) $(CONFIG_FLAGS) transform.o: transform.c ! $(CC) transform.c $(CFLAGS) $(CONFIG_FLAGS) help.o: help.c endhelp.h ! $(CC) help.c $(CFLAGS) $(CONFIG_FLAGS) ! ! install: xtiff ! cp xtiff $(DESTDIR)$(BINDIR)/xtiff ! chmod a+rx $(DESTDIR)$(BINDIR)/xtiff rebuild: clean ./collate-buttons $(MAKE) -f $(MAKEFILE) clean: ! rm -f xtiff.o transform.o help.o xtiff lint: lint $(INCLUDES) $(CONFIG_FLAGS) xtiff.c transform.c help.c diff -c -r xtiff.ORIG/transform.c xtiff/transform.c *** xtiff.ORIG/transform.c Thu Sep 1 21:25:35 1994 --- xtiff/transform.c Wed Aug 6 21:08:21 1997 *************** *** 24,32 **** int transformmimage PP((int status)); int zoomimage PP((void)); int rotateimage PP((void)); ! void rotate90 PP((int width, int height, int padding)); ! void rotate180 PP((int width, int height)); ! void rotate270 PP((int width, int height, int padding)); void setzoomfactor PP((int newzoomfactor)); int getzoomfactor PP((void)); void setrotationfactor PP((int newrotationfactor)); --- 24,32 ---- int transformmimage PP((int status)); int zoomimage PP((void)); int rotateimage PP((void)); ! void rotate90 PP((u_long width, u_long height)); ! void rotate180 PP((u_long width, u_long height)); ! void rotate270 PP((u_long width, u_long height)); void setzoomfactor PP((int newzoomfactor)); int getzoomfactor PP((void)); void setrotationfactor PP((int newrotationfactor)); diff -c -r xtiff.ORIG/xtiff.c xtiff/xtiff.c *** xtiff.ORIG/xtiff.c Thu Sep 1 21:25:36 1994 --- xtiff/xtiff.c Wed Aug 6 19:14:51 1997 *************** *** 114,121 **** } #define MIN(a, b) (((a) < (b)) ? (a) : (b)) #define MAX(a, b) (((a) > (b)) ? (a) : (b)) ! #define VIEWPORT_WIDTH 700 ! #define VIEWPORT_HEIGHT 500 #define KEY_TRANSLATE 20 #define ZOOMFACTOR 1 --- 114,121 ---- } #define MIN(a, b) (((a) < (b)) ? (a) : (b)) #define MAX(a, b) (((a) > (b)) ? (a) : (b)) ! #define VIEWPORT_WIDTH 735 ! #define VIEWPORT_HEIGHT 610 #define KEY_TRANSLATE 20 #define ZOOMFACTOR 1 *************** *** 1485,1490 **** --- 1485,1491 ---- else XDestroyImage(xImage); + zoomMemory = NULL; CreateXImage(status); /*