william@oahu.cs.ucla.edu (William Cheng) (08/28/90)
I've just put tgif-1.15 in the following places for anonymous ftp: expo.lcs.mit.edu contrib/tgif-1.15.tar.Z cs.ucla.edu pub/tgif-1.15.tar.Z Here's a short list of added features/bug fixes. 1) Fix bugs related to rewind() that it should not return any status. Thanks to Carl Witty@Stanford for the patch. 2) Upgrade 'tgif.pl' (Prolog hints) to handle file version 8. The following is the patch to take tgif from version 1.14 to 1.15. ---------------------------------> cut here <--------------------------------- *** copypaste.c.orig Mon Aug 27 11:30:57 1990 --- copypaste.c Mon Aug 27 11:30:58 1990 *************** *** 7,11 **** #ifndef lint static char RCSid[] = ! "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/copypaste.c,v 1.7 90/08/16 13:32:44 william Exp $"; #endif --- 7,11 ---- #ifndef lint static char RCSid[] = ! "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/copypaste.c,v 1.8 90/08/25 17:26:51 william Exp $"; #endif *************** *** 89,99 **** cutBuffer = (char *) calloc (stat.st_size, sizeof(char)); ! if (rewind (fp) < 0) { - sprintf (message, "Error in rewinding %s. Copy aborted!", tmpfile); - Msg (message); - } - else if (read (fileno(fp), cutBuffer, stat.st_size) < stat.st_size) - { sprintf (message, "READ error in %s. Copy aborted!", tmpfile); Msg (message); --- 89,95 ---- cutBuffer = (char *) calloc (stat.st_size, sizeof(char)); ! rewind(fp); ! if (read (fileno(fp), cutBuffer, stat.st_size) < stat.st_size) { sprintf (message, "READ error in %s. Copy aborted!", tmpfile); Msg (message); *************** *** 246,257 **** } fflush (fp); ! if (rewind (fp) < 0) ! { ! fclose (fp); ! unlink (tmpfile); ! sprintf (message, "Error in rewinding %s. Paste aborted!", tmpfile); ! Msg (message); ! return; ! } TieLooseEnds (); --- 242,246 ---- } fflush (fp); ! rewind (fp); TieLooseEnds (); *** version.c.orig Mon Aug 27 11:31:04 1990 --- version.c Mon Aug 27 11:31:04 1990 *************** *** 6,11 **** #ifndef lint static char RCSid[] = ! "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/version.c,v 1.17 90/08/21 21:30:03 william Exp $"; #endif ! char * version_string = "1.14"; --- 6,11 ---- #ifndef lint static char RCSid[] = ! "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/version.c,v 1.19 90/08/27 10:32:54 william Exp $"; #endif ! char * version_string = "1.15"; *** Makefile.noimake.orig Mon Aug 27 11:31:09 1990 --- Makefile.noimake Mon Aug 27 11:31:10 1990 *************** *** 4,8 **** # Copyright (C) 1990, William Cheng. # ! # @(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/Makefile.noimake,v 1.23 90/08/21 16:09:05 william Exp $ # --- 4,8 ---- # Copyright (C) 1990, William Cheng. # ! # @(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/Makefile.noimake,v 1.25 90/08/27 11:29:48 william Exp $ # *************** *** 10,14 **** LINK.c = $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) ! INSTALLDIR = /u/tangram/bin CC = cc --- 10,15 ---- LINK.c = $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) ! TGIFVERSION = 1.15 ! INSTALLDIR = /u/tangram/bin CC = cc *************** *** 215,219 **** tar: ! tar cvf tgif-1.0.tar *.c *.e *.h Makefile.noimake Imakefile \ bitmaps/*.bm .psmac .*port .*land tgificon.obj \ $(OBJDEMO) \ --- 216,226 ---- tar: ! @if [ `hostname` != rye ] ; then \ ! echo ''; \ ! echo ' Error: Can only generate tar file on rye'; \ ! echo ''; \ exit 1; \ ! fi; ! rm -f tgif-$(TGIFVERSION).tar* ! tar cvf tgif-$(TGIFVERSION).tar *.c *.e *.h Makefile.noimake Imakefile \ bitmaps/*.bm .psmac .*port .*land tgificon.obj \ $(OBJDEMO) \ *************** *** 220,224 **** $(SYMDEMO) \ $(MISCTAR) ! compress tgif-1.0.tar clean: --- 227,231 ---- $(SYMDEMO) \ $(MISCTAR) ! compress tgif-$(TGIFVERSION).tar clean: *** Imakefile.orig Mon Aug 27 11:31:16 1990 --- Imakefile Mon Aug 27 11:31:17 1990 *************** *** 4,11 **** /**/# Copyright (C) 1990, William Cheng. /**/# ! /**/# @(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/Imakefile,v 1.25 90/08/21 21:30:40 william Exp $ /**/# ! TGIFVERSION = 1.14 PROGRAMS = tgif prtgif tgif2ps frontend11.o /**/#CDEBUGFLAGS= -g --- 4,11 ---- /**/# Copyright (C) 1990, William Cheng. /**/# ! /**/# @(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/Imakefile,v 1.28 90/08/27 11:29:39 william Exp $ /**/# ! TGIFVERSION = 1.15 PROGRAMS = tgif prtgif tgif2ps frontend11.o /**/#CDEBUGFLAGS= -g *************** *** 66,69 **** --- 66,74 ---- tar: + @if [ `hostname` != rye ] ; then \ + echo ''; \ + echo ' Error: Can only generate tar file on rye'; \ + echo ''; \ exit 1; \ + fi; rm -f tgif-$(TGIFVERSION).tar/**/* tar cvf tgif-$(TGIFVERSION).tar /**/*.c /**/*.e /**/*.h \ *** tgif.pl.orig Mon Aug 27 11:31:21 1990 --- tgif.pl Mon Aug 27 11:31:22 1990 *************** *** 1,141 **** % ! % Consult a '.obj' file or a '.sym' file, then try to trace the following ! % code. % ! % @(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/tgif.pl,v 1.3 90/07/30 17:30:05 william Exp $ % ! tgif_state(FileVersion) :- ! % Note: This works for FileVersion>=6. ! state(_PageStyle,FileVersion,_OrigX,_OrigY,_Zoom,_GridSize,_Grid, ! _Color,_HoriAlign,_VertAlign,_LineWidth,_Spline,_LineStyle, ! _ObjFill,_PenPat,_TextJust,_Font,_TextStyle,_TextSize). ! ! tgif_text(FileVersion, Obj) :- ! FileVersion == 6, ! ( var(Obj) -> ! Obj = text(_Color,_X,_Y,_Font,_TextStyle,_TextSize,_NumLines, ! _TextJust,_TextRotate,_PenPat,StrList), ! call(Obj) ! ; Obj = text(_Color,_X,_Y,_Font,_TextStyle,_TextSize,_NumLines, ! _TextJust,_TextRotate,_PenPat,StrList) ), ! tgif_strs(FileVersion, StrList). ! tgif_text(FileVersion, Obj) :- ! FileVersion >= 7, ! ( var(Obj) -> ! Obj = text(_Color,_X,_Y,_Font,_TextStyle,_TextSize,_NumLines, ! _TextJust,_TextRotate,_PenPat,_BBoxW,_BBoxH,StrList), ! call(Obj) ! ; Obj = text(_Color,_X,_Y,_Font,_TextStyle,_TextSize,_NumLines, ! _TextJust,_TextRotate,_PenPat,_BBoxW,_BBoxH,StrList) ), ! tgif_strs(FileVersion, StrList). ! tgif_box(FileVersion, Obj) :- ! FileVersion >= 6, ! ( var(Obj) -> ! Obj = box(_Color,_X1,_Y1,_X2,_Y2,_ObjFill,_LineWidth,_PenPat), ! call(Obj) ! ; Obj = box(_Color,_X1,_Y1,_X2,_Y2,_ObjFill,_LineWidth,_PenPat) ! ). ! tgif_oval(FileVersion, Obj) :- ! FileVersion >= 6, ! ( var(Obj) -> ! Obj = oval(_Color,_LeftTopX,_LeftTopY,_RightBotX,_RightBotY, ! _ObjFill,_LineWidth,_PenPat), ! call(Obj) ! ; Obj = oval(_Color,_LeftTopX,_LeftTopY,_RightBotX,_RightBotY, ! _ObjFill,_LineWidth,_PenPat) ! ). ! tgif_poly(FileVersion, Obj) :- ! FileVersion >= 6, ! ( var(Obj) -> ! Obj = poly(_Color,_NumVs,_Vs,_LineStyle,_LineWidth,_PenPat,_Id, ! _Spline,_ObjFill,AttrList), ! call(Obj) ! ; Obj = poly(_Color,_NumVs,_Vs,_LineStyle,_LineWidth,_PenPat,_Id, ! _Spline,_ObjFill,AttrList) ! ), ! tgif_attrs(FileVersion, AttrList). ! tgif_polygon(FileVersion, Obj) :- ! FileVersion >= 6, ! ( var(Obj) -> ! Obj = polygon(_Color,_NumVs,_Vs,_ObjFill,_LineWidth,_PenPat, ! _Spline), ! call(Obj) ! ; Obj = polygon(_Color,_NumVs,_Vs,_ObjFill,_LineWidth,_PenPat, ! _Spline) ! ). ! tgif_group(FileVersion, Obj) :- ! FileVersion >= 6, ! ( var(Obj) -> ! Obj = group(ObjList,AttrList), ! call(Obj) ! ; Obj = group(ObjList,AttrList) ! ), ! tgif_objs(FileVersion, ObjList), ! tgif_attrs(FileVersion, AttrList). ! tgif_sym(FileVersion, Obj) :- ! FileVersion >= 6, ! ( var(Obj) -> ! Obj = sym(ObjList,AttrList), ! call(Obj) ! ; Obj = sym(ObjList,AttrList) ! ), ! tgif_objs(FileVersion, ObjList), ! tgif_attrs(FileVersion, AttrList). ! tgif_icon(FileVersion, Obj) :- ! FileVersion >= 6, ! ( var(Obj) -> ! Obj = icon(ObjList,_Name,_Id,AttrList), ! call(Obj) ! ; Obj = icon(ObjList,_Name,_Id,AttrList) ! ), ! tgif_objs(FileVersion, ObjList), ! tgif_attrs(FileVersion, AttrList). ! % ----------------------------- support routines --------------------------- % ! tgif_strs(_FileVersion, []) :- !. ! tgif_strs(FileVersion, [_Str|Strs]) :- ! FileVersion >= 6, ! !, tgif_strs(FileVersion, Strs). ! tgif_objs(_FileVersion, []) :- !. ! tgif_objs(FileVersion, [Obj|Objs]) :- ! FileVersion >= 6, !, functor(Obj,Functor,_Arity), ( Functor == text -> ! tgif_text(FileVersion, Obj) ; Functor == box -> ! tgif_box(FileVersion, Obj) ; Functor == oval -> ! tgif_oval(FileVersion, Obj) ; Functor == poly -> ! tgif_poly(FileVersion, Obj) ; Functor == polygon -> ! tgif_polygon(FileVersion, Obj) ; Functor == group -> ! tgif_group(FileVersion, Obj) ; Functor == sym -> ! tgif_sym(FileVersion, Obj) ; Functor == icon -> ! tgif_icon(FileVersion, Obj) ; true ), ! !, tgif_objs(FileVersion, Objs). ! tgif_attrs(_FileVersion, []) :- !. ! tgif_attrs(FileVersion, [Attr|Attrs]) :- ! FileVersion >= 6, ! !, ! Attr = attr(_Name,_Value,_ShowAll,_ShowNameOnly,_Inherited,_TextObj), ! !, tgif_attrs(FileVersion, Attrs). --- 1,256 ---- % ! % 1) Call tgif_clean/0 each time before step (2). ! % 2) Consult a '.obj' or a '.sym' file. ! % 3) Call tgif_state/2. This must be called before any other tgif goals ! % are called. ! % 4) Trace any other goals. % ! % @(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/tgif.pl,v 1.5 90/08/27 11:19:13 william Exp $ % ! tgif_state(FileVersion,Obj) :- ! ( var(Obj) -> OutputObj = true, ! current_predicate(state, ! state(_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_)) ! ; OutputObj = false ), ! Obj = state(_PageStyle,FileVersion,_OrigX,_OrigY,_Zoom, ! _GridSize,_Grid,_Color,_HoriAlign,_VertAlign,_LineWidth, ! _LineStyle,_ObjFill,_PenPat,_TextJust,_Font, ! _TextStyle,_TextSize), ! ( OutputObj == true -> call(Obj) ; true ), ! FileVersion =< 3, ! !, abolish(tgif_file_version/1), ! !, assert(tgif_file_version(FileVersion)). ! tgif_state(FileVersion,Obj) :- ! ( var(Obj) -> OutputObj = true, ! current_predicate(state, ! state(_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_)) ! ; OutputObj = false ), ! Obj = state(_PageStyle,FileVersion,_OrigX,_OrigY,_Zoom, ! _GridSize,_Grid,_Color,_HoriAlign,_VertAlign,_LineWidth, ! _Spline,_LineStyle,_ObjFill,_PenPat,_TextJust,_Font, ! _TextStyle,_TextSize), ! ( OutputObj == true -> call(Obj) ; true ), ! FileVersion =< 7, ! !, abolish(tgif_file_version/1), ! !, assert(tgif_file_version(FileVersion)). ! tgif_state(FileVersion,Obj) :- ! ( var(Obj) -> OutputObj = true, ! current_predicate(state, ! state(_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_)) ! ; OutputObj = false ! ), ! Obj = state(_PageStyle,FileVersion,_OrigX,_OrigY,_Zoom, ! _GridSize,_Grid,_Color,_HoriAlign,_VertAlign,_LineWidth, ! _Spline,_LineStyle,_ObjFill,_PenPat,_TextJust,_Font, ! _TextStyle,_TextSize,_TextDPI), ! ( OutputObj == true -> call(Obj) ; true ), ! FileVersion >= 8, ! !, abolish(tgif_file_version/1), ! !, assert(tgif_file_version(FileVersion)). ! % --------------------------------------------------------------------- % ! tgif_text(Obj) :- ! current_predicate(tgif_file_version,tgif_file_version(_)), ! tgif_file_version(FileVersion), ! FileVersion =< 2, !, ! ( var(Obj) -> OutputObj = true ; OutputObj = false ), ! Obj = text(_Color,_X,_Y,_Font,_TextStyle,_TextSize,_NumLines,_TextJust, ! StrList), ! ( OutputObj == true -> call(Obj) ; true ), ! tgif_strs(StrList). ! tgif_text(Obj) :- ! current_predicate(tgif_file_version,tgif_file_version(_)), ! tgif_file_version(FileVersion), ! FileVersion =< 6, !, ! ( var(Obj) -> OutputObj = true ; OutputObj = false ), ! Obj = text(_Color,_X,_Y,_Font,_TextStyle,_TextSize,_NumLines,_TextJust, ! _TextRotate,_PenPat,StrList), ! ( OutputObj == true -> call(Obj) ; true ), ! tgif_strs(StrList). ! tgif_text(Obj) :- ! current_predicate(tgif_file_version,tgif_file_version(_)), ! tgif_file_version(FileVersion), ! FileVersion =< 7, !, ! ( var(Obj) -> OutputObj = true ; OutputObj = false ), ! Obj = text(_Color,_X,_Y,_Font,_TextStyle,_TextSize,_NumLines,_TextJust, ! _TextRotate,_PenPat,_BBoxW,_BBoxH,StrList), ! ( OutputObj == true -> call(Obj) ; true ), ! tgif_strs(StrList). ! tgif_text(Obj) :- ! current_predicate(tgif_file_version,tgif_file_version(_)), ! tgif_file_version(FileVersion), ! FileVersion >= 8, !, ! ( var(Obj) -> OutputObj = true ; OutputObj = false ), ! Obj = text(_Color,_X,_Y,_Font,_TextStyle,_TextSize,_NumLines,_TextJust, ! _TextRotate,_PenPat,_BBoxW,_BBoxH,_Id,_TextDPI,StrList), ! ( OutputObj == true -> call(Obj) ; true ), ! tgif_strs(StrList). ! % --------------------------------------------------------------------- % ! tgif_box(Obj) :- ! current_predicate(tgif_file_version,tgif_file_version(_)), ! tgif_file_version(FileVersion), ! FileVersion =< 7, !, ! ( var(Obj) -> OutputObj = true ; OutputObj = false ), ! Obj = box(_Color,_X1,_Y1,_X2,_Y2,_ObjFill,_LineWidth,_PenPat), ! ( OutputObj == true -> call(Obj) ; true ). ! tgif_box(Obj) :- ! current_predicate(tgif_file_version,tgif_file_version(_)), ! tgif_file_version(FileVersion), ! FileVersion >= 8, !, ! ( var(Obj) -> OutputObj = true ; OutputObj = false ), ! Obj = box(_Color,_X1,_Y1,_X2,_Y2,_ObjFill,_LineWidth,_PenPat,_Id, ! AttrList), ! ( OutputObj == true -> call(Obj) ; true ), ! tgif_attrs(AttrList). ! % --------------------------------------------------------------------- % ! tgif_oval(Obj) :- ! current_predicate(tgif_file_version,tgif_file_version(_)), ! tgif_file_version(FileVersion), ! FileVersion =< 7, !, ! ( var(Obj) -> OutputObj = true ; OutputObj = false ), ! Obj = oval(_Color,_LeftTopX,_LeftTopY,_RightBotX,_RightBotY,_ObjFill, ! _LineWidth,_PenPat), ! ( OutputObj == true -> call(Obj) ; true ). ! tgif_oval(Obj) :- ! current_predicate(tgif_file_version,tgif_file_version(_)), ! tgif_file_version(FileVersion), ! FileVersion >= 8, !, ! ( var(Obj) -> OutputObj = true ; OutputObj = false ), ! Obj = oval(_Color,_LeftTopX,_LeftTopY,_RightBotX,_RightBotY,_ObjFill, ! _LineWidth,_PenPat,_Id,AttrList), ! ( OutputObj == true -> call(Obj) ; true ), ! tgif_attrs(AttrList). ! % --------------------------------------------------------------------- % ! tgif_poly(Obj) :- ! current_predicate(tgif_file_version,tgif_file_version(_)), ! tgif_file_version(FileVersion), ! FileVersion =< 3, !, ! ( var(Obj) -> OutputObj = true ; OutputObj = false ), ! Obj = poly(_Color,_NumVs,_Vs,_LineStyle,_LineWidth,_PenPat,_Id, ! AttrList), ! ( OutputObj == true -> call(Obj) ; true ), ! tgif_attrs(AttrList). ! tgif_poly(Obj) :- ! current_predicate(tgif_file_version,tgif_file_version(_)), ! tgif_file_version(FileVersion), ! FileVersion =< 4, !, ! ( var(Obj) -> OutputObj = true ; OutputObj = false ), ! Obj = poly(_Color,_NumVs,_Vs,_LineStyle,_LineWidth,_PenPat,_Id,_Spline, ! AttrList), ! ( OutputObj == true -> call(Obj) ; true ), ! tgif_attrs(AttrList). ! tgif_poly(Obj) :- ! current_predicate(tgif_file_version,tgif_file_version(_)), ! tgif_file_version(FileVersion), ! FileVersion >= 5, !, ! ( var(Obj) -> OutputObj = true ; OutputObj = false ), ! Obj = poly(_Color,_NumVs,_Vs,_LineStyle,_LineWidth,_PenPat,_Id,_Spline, ! _ObjFill,AttrList), ! ( OutputObj == true -> call(Obj) ; true ), ! tgif_attrs(AttrList). ! % --------------------------------------------------------------------- % ! tgif_polygon(Obj) :- ! current_predicate(tgif_file_version,tgif_file_version(_)), ! tgif_file_version(FileVersion), ! FileVersion =< 3, !, ! ( var(Obj) -> OutputObj = true ; OutputObj = false ), ! Obj = polygon(_Color,_NumVs,_Vs,_ObjFill,_LineWidth,_PenPat), ! ( OutputObj == true -> call(Obj) ; true ). ! tgif_polygon(Obj) :- ! current_predicate(tgif_file_version,tgif_file_version(_)), ! tgif_file_version(FileVersion), ! FileVersion =< 7, !, ! ( var(Obj) -> OutputObj = true ; OutputObj = false ), ! Obj = polygon(_Color,_NumVs,_Vs,_ObjFill,_LineWidth,_PenPat,_Spline), ! ( OutputObj == true -> call(Obj) ; true ). ! tgif_polygon(Obj) :- ! current_predicate(tgif_file_version,tgif_file_version(_)), ! tgif_file_version(FileVersion), ! FileVersion >= 8, !, ! ( var(Obj) -> OutputObj = true ; OutputObj = false ), ! Obj = polygon(_Color,_NumVs,_Vs,_ObjFill,_LineWidth,_PenPat,_Spline, ! _Id,AttrList), ! ( OutputObj == true -> call(Obj) ; true ), ! tgif_attrs(AttrList). ! ! % --------------------------------------------------------------------- % ! ! tgif_group(Obj) :- ! ( var(Obj) -> OutputObj = true ; OutputObj = false ), ! Obj = group(ObjList,AttrList), ! ( OutputObj == true -> call(Obj) ; true ), ! tgif_objs(ObjList), ! tgif_attrs(AttrList). ! ! % --------------------------------------------------------------------- % ! ! tgif_sym(Obj) :- ! ( var(Obj) -> OutputObj = true ; OutputObj = false ), ! Obj = sym(ObjList,AttrList), ! ( OutputObj == true -> call(Obj) ; true ), ! tgif_objs(ObjList), ! tgif_attrs(AttrList). ! ! % --------------------------------------------------------------------- % ! ! tgif_icon(Obj) :- ! ( var(Obj) -> OutputObj = true ; OutputObj = false ), ! Obj = icon(ObjList,_Name,_Id,AttrList), ! ( OutputObj == true -> call(Obj) ; true ), ! tgif_objs(ObjList), ! tgif_attrs(AttrList). ! ! % ======================== support routines =========================== % ! ! tgif_clean :- abolish(state/18), abolish(state/19), abolish(state/20). ! ! % --------------------------------------------------------------------- % ! ! tgif_strs([]) :- !. ! tgif_strs([_Str|Strs]) :- !, tgif_strs(Strs). ! ! % --------------------------------------------------------------------- % ! ! tgif_objs([]) :- !. ! tgif_objs([Obj|Objs]) :- !, functor(Obj,Functor,_Arity), ( Functor == text -> ! tgif_text(Obj) ; Functor == box -> ! tgif_box(Obj) ; Functor == oval -> ! tgif_oval(Obj) ; Functor == poly -> ! tgif_poly(Obj) ; Functor == polygon -> ! tgif_polygon(Obj) ; Functor == group -> ! tgif_group(Obj) ; Functor == sym -> ! tgif_sym(Obj) ; Functor == icon -> ! tgif_icon(Obj) ; true ), ! !, tgif_objs(Objs). ! % --------------------------------------------------------------------- % ! ! tgif_attrs([]) :- !. ! tgif_attrs([Attr|Attrs]) :- ! Attr = attr(_Name,_Value,_ShowAll,_ShowNameOnly,_Inherited,TextObj), ! tgif_text(TextObj), ! !, tgif_attrs(Attrs). ---------------------------------> cut here <--------------------------------- -- Bill Cheng // UCLA Computer Science Department // (213) 206-7135 3277 Boelter Hall // Los Angeles, California 90024 // USA william@CS.UCLA.EDU ...!{uunet|ucbvax}!cs.ucla.edu!william