mikew@wyse.wyse.com (Mike Wexler) (08/17/88)
Submitted-by: ken@cs.rochester.edu (Ken Yap) Posting-number: Volume 1, Issue 2 Archive-name: xfig/part01 #! /bin/sh # This is a shell archive. Remove anything before this line, then unpack # it by saving it into a file and typing "sh file". To overwrite existing # files, type "sh file -c". You can also feed this as standard input via # unshar, or by typing "sh <file", e.g.. If this archive is complete, you # will see the following message at the end: # "End of archive 1 (of 11)." # Contents: AUTHOR FORMAT1.3 Imakefile README README.X11 alloc.h # arrow.c blink.c box.c break.c char.c color.c const.h curve.c dir.c # f2p.1 f2ps.1 fig.h fig.icon file.c font.c font.h free.c func.h # graphics.c paintop.h puterr.c redisplay.c version.h xtra.h # Wrapped by mikew@wyse on Tue Aug 16 13:14:34 1988 PATH=/bin:/usr/bin:/usr/ucb ; export PATH if test -f AUTHOR -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"AUTHOR\" else echo shar: Extracting \"AUTHOR\" \(1271 characters\) sed "s/^X//" >AUTHOR <<'END_OF_AUTHOR' X(Message inbox:22) XReturn-Path: ken@cs.rochester.edu XReceived: from wyse by x2.wyse.com (5.58/Wyse client/5-13-88) X id AA11468; Fri, 12 Aug 88 21:07:11 PDT XReceived: from x2 by wyse.wyse.com (5.58/Wyse master/5-13-88) X id AA14129; Fri, 12 Aug 88 21:05:17 PDT XReceived: from wyse by x2.wyse.com (5.58/Wyse client/5-13-88) X id AA11462; Fri, 12 Aug 88 21:07:01 PDT XReceived: by wyse.wyse.com (5.58/Wyse master/5-13-88) X id AA14121; Fri, 12 Aug 88 21:05:08 PDT XReceived: from CS.ROCHESTER.EDU by uunet.UU.NET (5.59/1.14) X id AA29522; Fri, 12 Aug 88 23:36:35 EDT XReceived: by cayuga.cs.rochester.edu (5.52/k) id AA02849; Fri, 12 Aug 88 22:56:11 EDT XReceived: from loopback by cursa.cs.rochester.edu (3.2/j) id AA15579; Fri, 12 Aug 88 22:55:58 EDT XMessage-Id: <8808130255.AA15579@cursa.cs.rochester.edu> XTo: x-sources@x2.wyse.com XSubject: xfig 1.4.1 XX-Uucp: ..!rochester!ken Internet: ken@cs.rochester.edu XX-Snail: CS Dept., U of Roch., NY 14627. Voice: Ken! XX-Phone: (716) 275-1448 (office), (716) 244-3806 (home) XDate: Fri, 12 Aug 88 22:55:56 -0400 XFrom: Ken Yap <ken@cs.rochester.edu> X XHere are the sources for xfig, as 9 shar files. Xfig is a MacDraw style Xline drawing editor that can be used to generate pic, PostScript or TeX Xcode for inclusion in documents. X X Ken END_OF_AUTHOR if test 1271 -ne `wc -c <AUTHOR`; then echo shar: \"AUTHOR\" unpacked with wrong size! fi # end of overwriting check fi if test -f FORMAT1.3 -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"FORMAT1.3\" else echo shar: Extracting \"FORMAT1.3\" \(2274 characters\) sed "s/^X//" >FORMAT1.3 <<'END_OF_FORMAT1.3' XThe following is the format of fig output (fig 1.3). X XThe first line consists of four number: X screen resolution (pixels/inch), X screen origin (1 : upper rigth, 2 : upper left, 3 : lower left, X 4 : lower right), X canvas width (pixels), X canvas height (pixels) X XThe first integer of the rest of the lines represents the followings; X X ELLIPSE 1 X POLYLINE 2 X SPLINE 3 (quadratic spline) X TEXT 4 X ARC 5 X BEGIN_COMPOUND 6 X END_COMPOUND -BEGIN_COMPOUND X XThe detail of each object is: X XARC X type (3 : circle by radius, 4 : circle by diameter, 5 : circular arc), X line_style, X thickness (pixels), X dash_length (pixels), X direction (0 : clockwise, 1 : counterclokwise), X forward_arrow (0: off, 1: on), X backward_arrow (0: off, 1: on), X arrow_ht (pixels), arrow_wid (pixels), X center.x, center.y, X point[0].x, point[0].y, (the 1st point the user entered) X point[1].x, point[1].y, (the 2nd point or the last for type 3 or 4) X point[2].x, point[2].y (the last point if type is 5) X XBEGIN_COMPOUND X upperright_corner.x, upperright_corner.y, X lowerleft_corner.x, lowerleft_corner.y X XELLIPSE X type (1 : defined by radiuses, 2 : defined by diameters), X line_style, X thickness (pixels), X dash_length (pixels), X direction (is always 1), X center.x, center.y, X radius.x, radius.y, X start.x, start.y, (the 1st point the user entered) X end.x, end.y X XLINE X type (6 : polyline, 7 : box, 8 : polygon), X line_style, X thickness (pixels), X dash_length (pixels), X forward_arrow (0: off, 1: on), X backward_arrow (0: off, 1: on), X arrow_ht (pixels), arrow_wid (pixels), X x1, y1, X x2, y2, X . X . X xn, yn, (this will be the same as the 1st point for type 7 or 8) X 9999, 9999 X XSPLINE (quadratic spline) X type (10: open spline, 11: closed spline), X line_style, X thickness (pixels), X dash_length (pixels), X forward_arrow (0: off, 1: on), X backward_arrow (0: off, 1: on), X arrow_ht (pixels), arrow_wid (pixels), X x1, y1, X x2, y2, X . X . X xn, yn, (this will be the same as the 1st point for type 11) X 9999, 9999 X XTEXT X font, (not used) X size, (not used) X style, (not used) X height (pixels), length (pixels), X lowerleft_corner.x (pixels), lowerleft_corner.y (pixels), X string (end at newline, \n) X XThere are only three line styles defined X X SOLID_LINE 0 X DASH_LINE 1 X DOTTED_LINE 2 (not implement) END_OF_FORMAT1.3 if test 2274 -ne `wc -c <FORMAT1.3`; then echo shar: \"FORMAT1.3\" unpacked with wrong size! fi # end of overwriting check fi if test -f Imakefile -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"Imakefile\" else echo shar: Extracting \"Imakefile\" \(1392 characters\) sed "s/^X//" >Imakefile <<'END_OF_Imakefile' XDEFINES = -I/usr/new/include -DX11 XSYS_LIBRARIES = -lm XSYSAUX_LIBRARIES = -L/usr/new/lib -lXaw -lXt -lX X XSRCS= addpt.c arc.c arrow.c autoarrow.c\ X bitmap.c blink.c bound.c box.c break.c\ X canvas.c char.c color.c copy.c cursor.c curve.c\ X deletept.c dir.c drag.c draw.c ellipse.c\ X file.c flip.c font.c free.c\ X geom.c global.c glue.c graphics.c grid.c\ X intspline.c latex_line.c line.c list.c\ X main.c move.c movept.c msgsw.c\ X panel.c popup.c puterr.c\ X read.c read1_3.c redisplay.c remove.c rotate.c ruler.c\ X save.c scale.c search.c spline.c\ X text.c trans.c turn.c undo.c util.c xtra.c X XOBJS= addpt.o arc.o arrow.o autoarrow.o\ X bitmap.o blink.o bound.o box.o break.o\ X canvas.o char.o color.o copy.o cursor.o curve.o\ X deletept.o dir.o drag.o draw.o ellipse.o\ X file.o flip.o font.o free.o\ X geom.o global.o glue.o graphics.o grid.o\ X intspline.o latex_line.o line.o list.o\ X main.o move.o movept.o msgsw.o\ X panel.o popup.o puterr.o\ X read.o read1_3.o redisplay.o remove.o rotate.o ruler.o\ X save.o scale.o search.o spline.o\ X text.o trans.o turn.o undo.o util.o xtra.o X XF2PSRC = arrow.c f2p.c free.c read.c read1_3.c XF2POBJ = arrow.o f2p.o free.o read.o read1_3.o X XF2PSSRC = arrow.c bound.c f2ps.c free.c read.c read1_3.c XF2PSOBJ = arrow.o bound.o f2ps.o free.o read.o read1_3.o X XComplexProgramTarget(xfig) X XSingleProgramTarget(f2p,$(F2POBJ),,) X XSingleProgramTarget(f2ps,$(F2PSOBJ),,) END_OF_Imakefile if test 1392 -ne `wc -c <Imakefile`; then echo shar: \"Imakefile\" unpacked with wrong size! fi # end of overwriting check fi if test -f README -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"README\" else echo shar: Extracting \"README\" \(1893 characters\) sed "s/^X//" >README <<'END_OF_README' XFIG 1.4 Release 2 X XAdded features: X=============== X X1) Interpolated spline (open and close). X2) Dotted line style. X3) Blinking vertical bar cursor for entering character string in X canvas and message window. X4) Character strings editing feature both in entering text objects X and file names in message window (by relocating the blinking cursor X within the string). X5) F2ps (fig to postscript filter). Although dashed and dotted line X style are not rendered as such on the screen for objects other than X polylines, the objects on hard copy produced with f2ps will be X rendered with the line style under which the objects are created X in fig. X XChanges: X======== X X1) Output format (ref: FORMAT1.4). However fig 1.4 and its associated X filters (f2p and f2ps) can read fig 1.3 format but fig 1.4 will only X create output in the new format. X X2) Format of bitmap is now conform to the "iconedit" format (The first two X lines are comment lines indicating the width, height, etc. Each short X word (16 bits) is followed by a comma except the last one.). Here is X an example of the comment lines. X X /* Format_version=1, Width=33, Height=6, Depth=1, Valid_bits_per_item=16 X */ X X A row of bitmap is multiple of sixteen bits; however its actual width X (in "Width=..") may be not. X X The only exception to the format is that text objects which are not part X of any compound are appended to the end of the file. They provide a X way to locate point on the bitmap. X XCustomizable characteristics: X============================ X X1) The fonts used in fig are expected to reside in the X directory /usr/lib/fonts/fixedwidthfonts. If the fonts in X your system are not under the name directory, appropriate X changes should be made in file font.c. X X2) The size of fig can be changed by modifying two constants X in file "const.h", namely CANVAS_WIDTH and CANVAS_HEIGHT. END_OF_README if test 1893 -ne `wc -c <README`; then echo shar: \"README\" unpacked with wrong size! fi # end of overwriting check fi if test -f README.X11 -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"README.X11\" else echo shar: Extracting \"README.X11\" \(2800 characters\) sed "s/^X//" >README.X11 <<'END_OF_README.X11' XThis the famous fig program, ported to X11. I have ported version 1.4 Xwith patches for LaTeX line drawing by Frank Schmuck of Cornell. X XI only added code to it, which means this is a derivative work, so you Xhave to stick to the terms of redistribution of the SunView version. XThe copyright belongs to Supoj Sutanthavibul, but the source code for Xfig (the SunView only version) has been freely available to everyone Xfor a long time. In particular, it has been available for ftp from Xsally.utexas.edu and is also stored in the Sun-Spots archive. XTherefore, I presume that you may also freely redistribute xfig source Xcode and you should *at least* not remove the copyright notice and not Xtry to make money selling it. Naturally, everything is provided as is Xand the user bears all risks of using this software. Disclaimer: I am Xnot a lawyer so none of what I say may have any legal weight. X XI have chosen to retain compatibility with the SunView version, mainly Xfor sanity; so that I know I haven't changed the modus operandi of the Xprogram. You can compile for SunView simply by editing two lines in Xthe Makefile. You may have to change the paths a little. X XUpdating the ruler arrows slows down xfig noticeably. You might want to Xoptimize the code or make this feature an command line option. X XI know there are things that aren't quite right with the program, I Xdon't have time to fix them properly now. There are some quirks with Xthe behaviour of xfig. Lots of error returns that should be checked Xare not. X XI will gratefully receive bug reports and tune ups but I'm not Xinterested in taking up maintenance in the long run. (I have to finish Xa thesis.) In particular reports of little-endian machine versions and Xweird machines (not Sun or Vax) are interesting to me. X XIf you send me bug reports they will probably sit in my mailbox until I Xhave the time to install them locally. Then it may be some time before XI post a new version. So it will be best if you also posted your fixes Xto some public place. As for coordinating and merging fixes, well that Xwill have to happen by anarchy unless somebody volunteers to be the Xgrundge. X XPlease keep the history and version numbers up to date. X XThe fig2latex translator and friends are part of the transfig package Xfrom Cornell and at the time of writing, were available by ftp from Xsvax.cs.cornell.edu. X X Ken Yap (ken@cs.rochester.edu) X July 1988 X XHistory: X Xxfig 1.4.1: X X14 Jul 88 Ken Yap (University of Rochester) X Ported to X11. Alpha release. X X31 Jul 88 Ken Yap (University of Rochester) X Works practically like SunView version now. Beta release. X X8 Aug 88 Ken Yap (University of Rochester) X Dana Chee of Bellcore contributed lots of cleanups X and put right some features I didn't know how X to do properly. (Thanks, Dana.) Released to world. END_OF_README.X11 if test 2800 -ne `wc -c <README.X11`; then echo shar: \"README.X11\" unpacked with wrong size! fi # end of overwriting check fi if test -f alloc.h -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"alloc.h\" else echo shar: Extracting \"alloc.h\" \(835 characters\) sed "s/^X//" >alloc.h <<'END_OF_alloc.h' X/* X * FIG : Facility for Interactive Generation of figures X * X * Copyright (c) 1985 by Supoj Sutanthavibul (supoj@sally.UTEXAS.EDU) X * January 1985. X * 1st revision : Aug 1985. X * X * %W% %G% X*/ Xextern char *malloc(); Xextern char *calloc(); X X#define Line_malloc(z) z = (F_line*)malloc(LINOBJ_SIZE) X#define Spline_malloc(z) z = (F_spline*)malloc(SPLOBJ_SIZE) X#define Ellipse_malloc(z) z = (F_ellipse*)malloc(ELLOBJ_SIZE) X#define Arc_malloc(z) z = (F_arc*)malloc(ARCOBJ_SIZE) X#define Compound_malloc(z) z = (F_compound*)malloc(COMOBJ_SIZE) X#define Text_malloc(z) z = (F_text*)malloc(TEXOBJ_SIZE) X#define Point_malloc(z) z = (F_point*)malloc(POINT_SIZE) X#define Control_malloc(z) z = (F_control*)malloc(CONTROL_SIZE) X#define Arrow_malloc(z) z = (F_arrow*)malloc(ARROW_SIZE) X Xextern char Err_mem[]; Xextern char Err_incomp[]; END_OF_alloc.h if test 835 -ne `wc -c <alloc.h`; then echo shar: \"alloc.h\" unpacked with wrong size! fi # end of overwriting check fi if test -f arrow.c -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"arrow.c\" else echo shar: Extracting \"arrow.c\" \(1591 characters\) sed "s/^X//" >arrow.c <<'END_OF_arrow.c' X/* X * FIG : Facility for Interactive Generation of figures X * X * Copyright (c) 1985, 1988 by Supoj Sutanthavibul (supoj@sally.UTEXAS.EDU) X * January 1985. X * 1st revision : August 1985. X * 2nd revision : March 1988. X * X * %W% %G% X*/ X#include "fig.h" X#include "alloc.h" X#include "object.h" X Xstatic float forward_arrow_wid = 4; Xstatic float forward_arrow_ht = 8; Xstatic int forward_arrow_type = 0; Xstatic int forward_arrow_style = 0; Xstatic float forward_arrow_thickness = 1; X Xstatic float backward_arrow_wid = 4; Xstatic float backward_arrow_ht = 8; Xstatic int backward_arrow_type = 0; Xstatic int backward_arrow_style = 0; Xstatic float backward_arrow_thickness = 1; X XF_arrow * Xforward_arrow() X{ X F_arrow *a; X X if (NULL == (Arrow_malloc(a))) { X put_msg(Err_mem); X return(NULL); X } X a->type = forward_arrow_type; X a->style = forward_arrow_style; X a->thickness = forward_arrow_thickness; X a->wid = forward_arrow_wid; X a->ht = forward_arrow_ht; X return(a); X } X XF_arrow * Xbackward_arrow() X{ X F_arrow *a; X X if (NULL == (Arrow_malloc(a))) { X put_msg(Err_mem); X return(NULL); X } X a->type = backward_arrow_type; X a->style = backward_arrow_style; X a->thickness = backward_arrow_thickness; X a->wid = backward_arrow_wid; X a->ht = backward_arrow_ht; X return(a); X } X XF_arrow * Xmake_arrow(type, style, thickness, wid, ht) Xint type, style; Xfloat thickness, wid, ht; X{ X F_arrow *a; X X if (NULL == (Arrow_malloc(a))) { X put_msg(Err_mem); X return(NULL); X } X a->type = type; X a->style = style; X a->thickness = thickness; X a->wid = wid; X a->ht = ht; X return(a); X } END_OF_arrow.c if test 1591 -ne `wc -c <arrow.c`; then echo shar: \"arrow.c\" unpacked with wrong size! fi # end of overwriting check fi if test -f blink.c -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"blink.c\" else echo shar: Extracting \"blink.c\" \(1747 characters\) sed "s/^X//" >blink.c <<'END_OF_blink.c' X/* X * FIG : Facility for Interactive Generation of figures X * X * Copyright (c) 1988 by Supoj Sutanthavibul (supoj@sally.UTEXAS.EDU) X * Febuary 1988. X * X * %W% %G% X*/ X#include "fig.h" X Xstatic int cursor_on, cursor_is_moving; Xstatic int cursor_x, cursor_y; Xstatic int blink(); Xstatic int (*erase)(); Xstatic int (*draw)(); Xstatic struct itimerval blink_timer; X Xturn_on_blinking_cursor(draw_cursor, erase_cursor, x, y, sec, usec) Xint (*draw_cursor)(); Xint (*erase_cursor)(); Xint x, y; Xlong sec, usec; X{ X draw = draw_cursor; X erase = erase_cursor; X cursor_is_moving = 0; X cursor_x = x; X cursor_y = y; X blink_timer.it_interval.tv_usec = usec; X blink_timer.it_interval.tv_sec = sec; X blink_timer.it_value.tv_usec = usec; X blink_timer.it_value.tv_sec = sec; X draw(x, y); X cursor_on = 1; X signal(SIGALRM, blink); X setitimer(ITIMER_REAL, &blink_timer, (struct itimerval *)0); X /* X (void) notify_set_itimer_func(&me, blink, ITIMER_REAL, &blink_timer, 0); X */ X } X Xturn_off_blinking_cursor() X{ X if (cursor_on) erase(cursor_x, cursor_y); X blink_timer.it_interval.tv_usec = 0; X blink_timer.it_interval.tv_sec = 0; X blink_timer.it_value.tv_usec = 0; X blink_timer.it_value.tv_sec = 0; X setitimer(ITIMER_REAL, &blink_timer, (struct itimerval *)0); X /* X (void) notify_set_itimer_func(&me, blink, ITIMER_REAL, 0, 0); X */ X draw = erase = NULL; X } X Xstatic Xblink() X{ X if (cursor_is_moving) return(0); X if (cursor_on) { X erase(cursor_x, cursor_y); X cursor_on = 0; X } X else { X draw(cursor_x, cursor_y); X cursor_on = 1; X } X return(0); X } X Xmove_blinking_cursor(x, y) Xint x, y; X{ X cursor_is_moving = 1; X if (cursor_on) erase(cursor_x, cursor_y); X cursor_x = x; X cursor_y = y; X draw(cursor_x, cursor_y); X cursor_on = 1; X cursor_is_moving = 0; X } END_OF_blink.c if test 1747 -ne `wc -c <blink.c`; then echo shar: \"blink.c\" unpacked with wrong size! fi # end of overwriting check fi if test -f box.c -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"box.c\" else echo shar: Extracting \"box.c\" \(2748 characters\) sed "s/^X//" >box.c <<'END_OF_box.c' X/* X * FIG : Facility for Interactive Generation of figures X * X * Copyright (c) 1985 by Supoj Sutanthavibul (supoj@sally.UTEXAS.EDU) X * January 1985. X * 1st revision : Aug 1985. X * X * %W% %G% X*/ X#include "fig.h" X#include "resources.h" X#include "alloc.h" X#include "func.h" X#include "object.h" X#include "paintop.h" X Xextern int cur_line_style, line_thickness; Xextern float cur_styleval; Xextern int cur_color; Xextern int fix_x, fix_y, cur_x, cur_y; Xextern (*canvas_kbd_proc)(); Xextern (*canvas_locmove_proc)(); Xextern (*canvas_leftbut_proc)(); Xextern (*canvas_middlebut_proc)(); Xextern (*canvas_rightbut_proc)(); Xextern null_proc(); Xextern set_popupmenu(); X Xextern F_compound objects; X X/*************************** locally global procedures *********************/ X X elastic_box(); Xint create_boxobject(); X init_box_drawing(); X Xbox_drawing_selected() X{ X canvas_kbd_proc = null_proc; X canvas_locmove_proc = null_proc; X canvas_leftbut_proc = init_box_drawing; X canvas_middlebut_proc = null_proc; X canvas_rightbut_proc = set_popupmenu; X set_cursor(&arrow_cursor); X reset_action_on(); X } X Xinit_box_drawing(x, y) Xint x, y; X{ X cur_x = fix_x = x; X cur_y = fix_y = y; X canvas_locmove_proc = elastic_box; X canvas_leftbut_proc = canvas_rightbut_proc = null_proc; X canvas_middlebut_proc = create_boxobject; X draw_rectbox(fix_x, fix_y, cur_x, cur_y, INV_PAINT); X set_temp_cursor(&null_cursor); X set_action_on(); X } X Xdraw_rectbox(x1, y1, x2, y2, op) Xint x1, y1, x2, y2, op; X{ X pw_vector(canvas_pixwin, x1, y1, x1, y2, op, 1); X pw_vector(canvas_pixwin, x1, y2, x2, y2, op, 1); X pw_vector(canvas_pixwin, x2, y2, x2, y1, op, 1); X pw_vector(canvas_pixwin, x2, y1, x1, y1, op, 1); X } X Xelastic_box(x, y) Xint x, y; X{ X draw_rectbox(fix_x, fix_y, cur_x, cur_y, INV_PAINT); X cur_x = x; X cur_y = y; X draw_rectbox(fix_x, fix_y, cur_x, cur_y, INV_PAINT); X } X Xcreate_boxobject(x, y) Xint x, y; X{ X F_line *box; X F_point *point; X X draw_rectbox(fix_x, fix_y, cur_x, cur_y, INV_PAINT); X X X if ((Point_malloc(point)) == NULL) { X blink_msg(); X put_msg(Err_mem); X return; X } X point->x = fix_x; X point->y = fix_y; X point->next = NULL; X X Line_malloc(box); X box->type = T_BOX; X box->style = cur_line_style; X box->thickness = line_thickness; X box->color = cur_color; X box->pen = NULL; X box->area_fill = NULL; X box->style_val = cur_styleval; X box->for_arrow = NULL; X box->back_arrow = NULL; X box->points = point; X box->next = NULL; X append_point(x, fix_y, &point); X append_point(x, y, &point); X append_point(fix_x, y, &point); X append_point(fix_x, fix_y, &point); X draw_line(box, PAINT); X clean_up(); X set_action_object(F_CREATE, O_POLYLINE); X insert_line(&objects.lines, box); X set_latestline(box); X set_modifiedflag(); X box_drawing_selected(); X } END_OF_box.c if test 2748 -ne `wc -c <box.c`; then echo shar: \"box.c\" unpacked with wrong size! fi # end of overwriting check fi if test -f break.c -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"break.c\" else echo shar: Extracting \"break.c\" \(1457 characters\) sed "s/^X//" >break.c <<'END_OF_break.c' X/* X * FIG : Facility for Interactive Generation of figures X * X * Copyright (c) 1985 by Supoj Sutanthavibul (supoj@sally.UTEXAS.EDU) X * January 1985. X * 1st revision : Aug 1985. X * X * %W% %G% X*/ X#include "fig.h" X#include "resources.h" X#include "func.h" X#include "object.h" X#include "paintop.h" X X#define TOLERANCE 7 X X init_break(); X Xbreak_selected() X{ X extern (*canvas_kbd_proc)(); X extern (*canvas_locmove_proc)(); X extern (*canvas_leftbut_proc)(); X extern (*canvas_middlebut_proc)(); X extern (*canvas_rightbut_proc)(); X extern null_proc(); X extern set_popupmenu(); X X canvas_kbd_proc = null_proc; X canvas_locmove_proc = null_proc; X canvas_leftbut_proc = init_break; X canvas_middlebut_proc = null_proc; X canvas_rightbut_proc = set_popupmenu; X set_cursor(&pick15_cursor); X } X Xinit_break(x, y) Xint x, y; X{ X extern F_compound *compound_search(); X extern F_compound objects, saved_objects; X extern int compoundbox_shown; X F_compound *c; X X if ((c = compound_search(x, y, TOLERANCE, &x, &y)) == NULL) return; X clean_up(); X if (compoundbox_shown) draw_compoundbox(c, INV_PAINT); X delete_compound(&objects.compounds, c); X break_compound(c); X set_action(F_BREAK); X saved_objects.compounds = c; X break_selected(); X } X Xbreak_compound(c) XF_compound *c; X{ X extern F_compound objects, object_tails; X extern int pointmarker_shown; X X if (pointmarker_shown) toggle_compoundpointmarker(c); X tail(&objects, &object_tails); X append_objects(&objects, c, &object_tails); X } END_OF_break.c if test 1457 -ne `wc -c <break.c`; then echo shar: \"break.c\" unpacked with wrong size! fi # end of overwriting check fi if test -f char.c -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"char.c\" else echo shar: Extracting \"char.c\" \(2252 characters\) sed "s/^X//" >char.c <<'END_OF_char.c' X/* X * FIG : Facility for Interactive Generation of figures X * X * Copyright (c) 1988 by Supoj Sutanthavibul (supoj@sally.UTEXAS.EDU) X * Febuary 1988. X * X * %W% %G% X*/ X#include "fig.h" X#include "resources.h" X#include "font.h" X#include "paintop.h" X Xextern int cur_x, cur_y; X X#define BUF_SIZE 80 X#define CR 13 X#define CTRL_U 21 X#define SP 32 X#define DEL 127 X#define CTRL_H 8 X Xchar prefix[BUF_SIZE], suffix[BUF_SIZE]; Xint leng_prefix, leng_suffix; X Xstatic PIX_FONT font; Xstatic PIXWIN pw; Xstatic int char_ht, char_wid; Xstatic int char_received; Xstatic int base_x, base_y; X Xstatic (*cr_proc)(); X Xstatic Xdraw_cursor(x, y) Xint x, y; X{ X pw_vector(pw, x, y, x, y-char_ht, INV_PAINT, 1); X } X Xinitialize_char_handler(p, f, cr, bx, by) XPIXWIN p; XPIX_FONT f; Xint (*cr)(); Xint bx, by; X{ X pw = p; X font = f; X cr_proc = cr; X base_x = bx; X base_y = by; X X char_wid = char_width(f); X char_ht = char_height(f); X char_received = 0; X turn_on_blinking_cursor(draw_cursor, draw_cursor, X cur_x, cur_y, (long)0, (long)700000); X } X Xterminate_char_handler() X{ X turn_off_blinking_cursor(); X cr_proc = NULL; X return(char_received); X } X Xerase_char_string() X{ X pw_text(pw, base_x, base_y, INV_PAINT, font, prefix); X if (leng_suffix) pw_text(pw, cur_x, base_y, INV_PAINT, font, suffix); X } X Xdraw_char_string() X{ X pw_text(pw, base_x, base_y, INV_PAINT, font, prefix); X if (leng_suffix) pw_text(pw, cur_x, base_y, INV_PAINT, font, suffix); X move_blinking_cursor(cur_x, cur_y); X } X Xchar_handler(c) Xchar c; X{ X if (c == CR) { X cr_proc(); X } X else if (c == DEL || c == CTRL_H) { X if (leng_prefix > 0) { X erase_char_string(); X char_received = 1; X cur_x -= char_wid; X prefix[--leng_prefix] = '\0'; X draw_char_string(); X } X } X else if (c == CTRL_U) { X if (leng_prefix > 0) { X erase_char_string(); X char_received = 1; X cur_x = base_x; X leng_prefix = 0; X *prefix = '\0'; X draw_char_string(); X } X } X else if (c < SP) { X } X else if (leng_prefix+leng_suffix == BUF_SIZE) { X put_msg("Text buffer is full, character is ignored"); X } X else { X erase_char_string(); X char_received = 1; X cur_x += char_wid; X prefix[leng_prefix++] = c; X prefix[leng_prefix] = '\0'; X draw_char_string(); X } X } END_OF_char.c if test 2252 -ne `wc -c <char.c`; then echo shar: \"char.c\" unpacked with wrong size! fi # end of overwriting check fi if test -f color.c -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"color.c\" else echo shar: Extracting \"color.c\" \(365 characters\) sed "s/^X//" >color.c <<'END_OF_color.c' X/* X * FIG : Facility for Interactive Generation of figures X * X * Copyright (c) 1988 by Supoj Sutanthavibul (supoj@sally.UTEXAS.EDU) X * March 1988. X * X * %W% %G% X*/ X Xint background_color = 0; /* black */ Xint foreground_color = 1; /* white */ X Xinvert_color() X{ X int c; X X c = background_color; X background_color = foreground_color; X foreground_color = c; X } END_OF_color.c if test 365 -ne `wc -c <color.c`; then echo shar: \"color.c\" unpacked with wrong size! fi # end of overwriting check fi if test -f const.h -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"const.h\" else echo shar: Extracting \"const.h\" \(544 characters\) sed "s/^X//" >const.h <<'END_OF_const.h' X/* X * FIG : Facility for Interactive Generation of figures X * X * Copyright (c) 1985 by Supoj Sutanthavibul (supoj@sally.UTEXAS.EDU) X * November 1985. X * X * %W% %G% X*/ X#define PIX_PER_INCH 80 X X#define DEF_CANVAS_HEIGHT 800 /* (10 * PIX_PER_INCH) */ X#define DEF_CANVAS_WIDTH 600 /* ( 7.5 * PIX_PER_INCH) */ X#define RULER_WIDTH 24 X X#define MSG_HEIGHT 24 X X#define ICON_COLUMN_PORT 2 X#define ICON_COLUMN_LAND 3 X X#define SWITCH_ICON_WIDTH 32 /* width of a switch icon */ X#define SWITCH_ICON_HEIGHT 32 X#define SWITCH_ICON_SPACING 4 END_OF_const.h if test 544 -ne `wc -c <const.h`; then echo shar: \"const.h\" unpacked with wrong size! fi # end of overwriting check fi if test -f curve.c -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"curve.c\" else echo shar: Extracting \"curve.c\" \(2174 characters\) sed "s/^X//" >curve.c <<'END_OF_curve.c' X/* X * FIG : Facility for Interactive Generation of figures X * X * Copyright (c) 1985 by Supoj Sutanthavibul (supoj@sally.UTEXAS.EDU) X * January 1985. X * 1st revision : Aug 1985. X * X * %W% %G% X*/ X#include "fig.h" X#include "resources.h" X#include "paintop.h" X X#define round(a) ((int)((a) + .5)) X X/* This routine plot two dimensional curve defined by a second degree X polynomial of the form : X 2 2 X f(x, y) = ax + by + g = 0 X X (x0,y0) is the starting point as well as ending point of the curve. X The curve will translate with the offset xoff and yoff. X X This algorithm is derived from the eight point algorithm in : X "An Improved Algorithm for the generation of Nonparametric Curves" X by Bernard W. Jordan, William J. Lennon and Barry D. Holm, IEEE X Transaction on Computers Vol C-22, No. 12 December 1973. X*/ X Xcurve(xstart, ystart, xend, yend, direction, a, b, xoff, yoff, val) Xint xstart, ystart, xend, yend, a, b, xoff, yoff; Xint direction, val; X{ X int dfx, dfy, dfxx, dfyy; X int falpha, fx, fy, fxy, absfx, absfy, absfxy; X int margin, test_succeed, x, y, deltax, deltay, inc, dec; X X if (a == 0 || b == 0) return; X x = xstart; X y = ystart; X dfx = 2 * a * xstart; X dfy = 2 * b * ystart; X dfxx = 2 * a; X dfyy = 2 * b; X X falpha = 0; X if (direction) { X inc = 1; dec = -1; X } X else { X inc = -1; dec = 1; X } X if (xstart == xend && ystart == yend) { X test_succeed = margin = 1; X } X else { X test_succeed = margin = 3; X } X X do { X if (dfy < 0) deltax = inc; else deltax = dec; X if (dfx < 0) deltay = dec; else deltay = inc; X fx = falpha + dfx * deltax + a; X fy = falpha + dfy * deltay + b; X fxy = fx + fy - falpha; X absfx = abs(fx); absfy = abs(fy); absfxy = abs(fxy); X X if ((absfxy <= absfx) && (absfxy <= absfy)) X falpha = fxy; X else if (absfy <= absfx) { X deltax = 0; falpha = fy; X } X else { X deltay = 0; falpha = fx; X } X x = x + deltax; y = y + deltay; X pw_put(canvas_pixwin, xoff+x, yoff-y, val); X dfx = dfx + dfxx * deltax; X dfy = dfy + dfyy * deltay; X if (abs(x - xend) < margin && abs(y - yend) < margin) X test_succeed--; X } while (test_succeed); X } END_OF_curve.c if test 2174 -ne `wc -c <curve.c`; then echo shar: \"curve.c\" unpacked with wrong size! fi # end of overwriting check fi if test -f dir.c -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"dir.c\" else echo shar: Extracting \"dir.c\" \(848 characters\) sed "s/^X//" >dir.c <<'END_OF_dir.c' X/* X * FIG : Facility for Interactive Generation of figures X * X * Copyright (c) 1985 by Supoj Sutanthavibul (supoj@sally.UTEXAS.EDU) X * November 1985. X * 1st revision: Mar 1988. X * X * %W% %G% X*/ X#include "fig.h" X Xextern char *sys_errlist[]; Xextern int sys_nerr, errno; X Xextern char directory[]; X Xint Xchange_directory(path) Xchar *path; X{ X if (path == NULL) return(0); X put_msg("Changing . . ."); X if (chdir(path) == -1) { X put_err("Can not change to directory %s, : %s", X path, sys_errlist[errno]); X } X else { X print_directory(); X } X return(1); X } X Xprint_directory() X{ X extern char *getwd(); X X if (*directory == '\0') { X if (NULL == getwd(directory)) { X put_msg("%s", directory); /* err msg is in directory */ X *directory = '\0'; X return; X } X else X put_msg(directory); X } X else X put_msg(directory); X } END_OF_dir.c if test 848 -ne `wc -c <dir.c`; then echo shar: \"dir.c\" unpacked with wrong size! fi # end of overwriting check fi if test -f f2p.1 -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"f2p.1\" else echo shar: Extracting \"f2p.1\" \(969 characters\) sed "s/^X//" >f2p.1 <<'END_OF_f2p.1' X.TH F2P 1 "29 March 1988" X.SH NAME Xf2p \- translates fig output into pic language X.SH SYNOPSIS X.B f2p X[-s font_size] [ input_file [ output_file ] ] X.SH DESCRIPTION X.I F2p Xtranslates fig objects in the named X.I input_file Xinto pic language and put them in X.I output_file. XIf only one file name is presented, it is assumed to be the input file X(fig output file). The output file X.I (pic_file), Xif not presented, will be the stdout. XIf the X.I input_file Xis not presented, input will be assumed to come from the stdin. XThe output from f2p can be edited to change font sizes/types. X.PP XThe unit of X.I font_size Xis point. There are 72 points in an inch. XThe upper limit of font_size is 300 points (about 4 inches). XThe default size is 11 points. XThe position of text on the hard copy is depended on the specified Xfont size. X.SH "SEE ALSO" Xfig(1), Xpic(1). X.SH AUTHOR XSupoj Sutanthavibul (supoj@sally.UTEXAS.EDU), X.br XUniversity of Texas at Austin, X.br XJanuary 29, 1985. END_OF_f2p.1 if test 969 -ne `wc -c <f2p.1`; then echo shar: \"f2p.1\" unpacked with wrong size! fi # end of overwriting check fi if test -f f2ps.1 -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"f2ps.1\" else echo shar: Extracting \"f2ps.1\" \(1521 characters\) sed "s/^X//" >f2ps.1 <<'END_OF_f2ps.1' X.TH F2PS 1 "29 March 1988" X.SH NAME Xf2ps \- Fig to Postscript translator X.SH SYNOPSIS X.B f2ps X[ X.B -f Xfont ] [ X.B -s Xsize ] [ X.B -e Xscale ] [ X.B -N X][ X.B -c X] [ input_file [ output_file ] ] X.SH DESCRIPTION X.I F2ps Xtranslates fig output format (in X.I input_file Xinto the postscript language (in X.I output_file X). XThe default X.I input_file Xand X.I output_file Xare standard input and standard output. X.PP XThe X.I font Xshould be font that your printer knows about. XThe unit of X.I size X(font size) is point. There are 72 points in an inch. XThe upper limit for X.I size Xis 300 points (about 4 inches). X.I Scale Xwill also be applied to X.I size. XThe default value of X.I font, X.I size Xand X.I scale Xare Times-Roman, 11 points and 1 respectively. XThe X.B -c Xoption tells f2ps to center the figure on the page. XThe centering may not be accurate if there are texts in the X.I input_file Xthat extends too far to the right of other objects. XThe option X.B -N Xindicates that no page printing command (showpage) Xis to be appended after the figure. XThis ensures that when the output is used as an included illustration, Xit won't untimely skip the rest of the page. XHowever you can not print it by itself on the printer. X.PP XObjects (except text) which are created in \fIfig\fP while the Xdash-line mode was on will be produced with dashed line even Xthough they may be drawn with solid line in \fIfig\fP. X.SH "SEE ALSO" Xfig(1). X.SH AUTHOR XSupoj Sutanthavibul (supoj@sally.UTEXAS.EDU), X.br XUniversity of Texas at Austin, X.br XNovember 13, 1986. END_OF_f2ps.1 if test 1521 -ne `wc -c <f2ps.1`; then echo shar: \"f2ps.1\" unpacked with wrong size! fi # end of overwriting check fi if test -f fig.h -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"fig.h\" else echo shar: Extracting \"fig.h\" \(924 characters\) sed "s/^X//" >fig.h <<'END_OF_fig.h' X/* X * FIG : Facility for Interactive Generation of figures X * X * Copyright (c) 1985 by Supoj Sutanthavibul (supoj@sally.UTEXAS.EDU) X * January 1985. X * 1st revision : Aug 1985. X * X * %W% %G% X*/ X#ifndef X11 X X#include <sys/types.h> X#include <sys/file.h> X#include <sys/time.h> X X#else X X#include <X11/Xos.h> X X#endif X X#include <sys/stat.h> X#include <fcntl.h> X#include <pwd.h> X#include <signal.h> X X#include <stdio.h> X#include <ctype.h> X#include <errno.h> X#include <math.h> X X#ifndef M_PI X#define M_PI 3.14159265358979323846 X#define M_PI_2 1.57079632679489661923 X#endif X X#ifndef X11 X X#include <suntool/tool_hs.h> X#include <suntool/wmgr.h> X#include <suntool/menu.h> X X#else X X#include <X11/Xlib.h> X#include <X11/cursorfont.h> X#include <X11/Intrinsic.h> X#include <X11/StringDefs.h> X#include <X11/Shell.h> X#include <X11/Command.h> X#include <X11/Label.h> X#include <X11/Dialog.h> X#include <X11/Box.h> X#include <X11/Form.h> X X#endif X11 END_OF_fig.h if test 924 -ne `wc -c <fig.h`; then echo shar: \"fig.h\" unpacked with wrong size! fi # end of overwriting check fi if test -f fig.icon -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"fig.icon\" else echo shar: Extracting \"fig.icon\" \(2027 characters\) sed "s/^X//" >fig.icon <<'END_OF_fig.icon' X#define MY_ICON_WIDTH 64 X#define MY_ICON_HEIGHT 64 X Xstatic short icon_data [64*64/16] = { X X/* Format_version=1, Width=64, Height=64, Depth=1, Valid_bits_per_item=16 X */ X 0xFFFF,0xFFFF,0xFFFF,0xFFFF,0x8000,0x0000,0x0000,0x0001, X 0x8000,0x0000,0x0001,0x8001,0x800F,0xC8F0,0x0006,0xC001, X 0x8008,0x0900,0x0008,0x2001,0x8008,0x0900,0x0018,0x1001, X 0x800F,0x0938,0x0020,0x1001,0x8008,0x0908,0x0020,0x0801, X 0x8008,0x0908,0x00C0,0x0801,0x8008,0x0918,0x0080,0x0801, X 0x8008,0x08E8,0x0100,0x0801,0x8000,0x0000,0x0100,0x10C1, X 0x8000,0x0000,0x0200,0x1131,0x8600,0x0000,0x0200,0x120F, X 0x81E0,0x0000,0x0202,0x1C03,0x801E,0x0000,0x1C04,0x0001, X 0x8001,0xE03F,0xE204,0x0001,0x8700,0x1FC0,0x0208,0x0081, X 0x80F0,0x0000,0x7030,0x0B01,0x800F,0x0707,0xE100,0x6001, X 0x8000,0xFDFF,0x028F,0x0001,0x8000,0x091C,0x0560,0x0001, X 0x8000,0x1A10,0x0110,0x0001,0x8000,0x1210,0x1888,0x0001, X 0x8000,0x3210,0x2084,0x07C1,0x8000,0x4420,0xC082,0x0841, X 0x8000,0x8440,0x0080,0x0821,0x8000,0x8880,0x0081,0x8727, X 0x8001,0x0900,0x3800,0x8099,0x8001,0x0901,0xC480,0x4041, X 0x8002,0x0981,0x1C80,0x4041,0x8004,0x08FE,0x2080,0x2021, X 0x8008,0x0400,0x4100,0x2021,0x8010,0x0401,0x8100,0x0011, X 0x8010,0x0202,0x0100,0x1009,0x8020,0x0202,0x0200,0x0009, X 0x8040,0x0102,0x0430,0x0809,0x8080,0x0104,0x0848,0x0805, X 0x8080,0x0084,0x0088,0x0805,0x8104,0x008C,0x0090,0x0805, X 0x8108,0x0048,0x0090,0x0005,0x8200,0x0048,0x00A0,0x0405, X 0x8210,0x0048,0x0120,0x0005,0x8400,0x0048,0x0220,0x0405, X 0x8420,0x0028,0x0420,0x0405,0x8800,0x0024,0x1820,0x0005, X 0x8820,0x0023,0xE020,0x0005,0x8800,0x0020,0x0020,0x0009, X 0x9020,0x0010,0x0020,0x0009,0x9000,0x0010,0x0020,0x0019, X 0x9010,0x0010,0x0010,0x0011,0x8800,0x0010,0x0018,0x0011, X 0x8800,0x0010,0x0008,0x0021,0x8800,0x0020,0x0004,0x0061, X 0x8807,0x0020,0x0006,0x0081,0x8404,0x8040,0x0001,0x8101, X 0x8403,0x0080,0x0000,0x8301,0x8200,0x0100,0x0000,0x4601, X 0x8100,0x0300,0x0000,0x3801,0x8080,0x0E00,0x0000,0x0001, X 0x8070,0xF000,0x0000,0x0001,0x801F,0x8000,0x0000,0x0001, X 0x8000,0x0000,0x0000,0x0001,0xFFFF,0xFFFF,0xFFFF,0xFFFF X}; END_OF_fig.icon if test 2027 -ne `wc -c <fig.icon`; then echo shar: \"fig.icon\" unpacked with wrong size! fi # end of overwriting check fi if test -f file.c -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"file.c\" else echo shar: Extracting \"file.c\" \(2744 characters\) sed "s/^X//" >file.c <<'END_OF_file.c' X/* X * FIG : Facility for Interactive Generation of figures X * X * Copyright (c) 1988 by Supoj Sutanthavibul (supoj@sally.UTEXAS.EDU) X * March 1988. X * X * %W% %G% X*/ X#include "fig.h" X#include "resources.h" X#include "func.h" X#include "object.h" X X#define PROMPT 1 X#define NO_PROMPT 0 X Xextern int figure_modified; Xextern char current_file[]; Xextern char directory[]; Xextern int num_object; X Xedit_file(file) Xchar *file; X{ X extern F_compound objects, saved_objects; X int s; X F_compound c; X X if (*file == 0) { X put_msg("Empty name"); X return; X } X c.arcs = NULL; X c.compounds = NULL; X c.ellipses = NULL; X c.lines = NULL; X c.splines = NULL; X c.texts = NULL; X c.next = NULL; X set_temp_cursor(&wait_cursor); X s = read_fig(file, &c); X if (s == 0) { /* Successful read */ X clean_up(); X (void)strcpy(current_file, file); X saved_objects = objects; X objects = c; X redisplay_canvas(); X put_msg("Edit \"%s\" %d objects", file, num_object); X set_action(F_EDIT); X } X else if (s == ENOENT) { X clean_up(); X saved_objects = objects; X objects = c; X redisplay_canvas(); X put_msg("\"%s\" new file", file); X (void)strcpy(current_file, file); X set_action(F_EDIT); X } X else if (s > 0) X read_fail_message(file, s); X reset_cursor(); X } X Xread_file(file) Xchar *file; X{ X extern F_compound objects, saved_objects, object_tails; X int s; X F_compound c; X X if (*file == 0) { X put_msg("Empty name"); X return; X } X X c.arcs = NULL; X c.compounds = NULL; X c.ellipses = NULL; X c.lines = NULL; X c.splines = NULL; X c.texts = NULL; X c.next = NULL; X set_temp_cursor(&wait_cursor); X s = read_fig(file, &c); X if (s == 0) { /* Successful read */ X clean_up(); X saved_objects = c; X tail(&objects, &object_tails); X append_objects(&objects, &saved_objects, &object_tails); X pw_batch_on(canvas_pixwin); X redisplay_canvas(); X pw_batch_off(canvas_pixwin); X put_msg("File \"%s\" %d objects", file, num_object); X set_action_object(F_CREATE, O_ALL_OBJECT); X } X else if (s > 0) X read_fail_message(file, s); X reset_cursor(); X } X Xsave_and_exit(file) Xchar *file; X{ X if (0 == write_file(file, PROMPT)) quit(); X } X Xsave_current_file() X{ X return(write_file(current_file, NO_PROMPT)); X } X Xsave_file(file) Xchar *file; X{ X return(write_file(file, PROMPT)); X } X Xstatus() X{ X extern char *getwd(); X X if (*directory == NULL) { X if (NULL == getwd(directory)) { X put_msg("%s", directory); /* err msg is in directory */ X *directory = '\0'; X return; X } X } X X if (*current_file == '\0') X put_msg("No file; directory \"%s\"", directory); X else X put_msg("file \"%s\" %s; directory \"%s\"", current_file, X (figure_modified ? "[modified]" : ""), directory); X } END_OF_file.c if test 2744 -ne `wc -c <file.c`; then echo shar: \"file.c\" unpacked with wrong size! fi # end of overwriting check fi if test -f font.c -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"font.c\" else echo shar: Extracting \"font.c\" \(762 characters\) sed "s/^X//" >font.c <<'END_OF_font.c' X/* X * FIG : Facility for Interactive Generation of figures X * X * Copyright (c) 1985 by Supoj Sutanthavibul (supoj@sally.UTEXAS.EDU) X * January 1985. X * 1st revision : Aug 1985. X * X * %W% %G% X*/ X#include "fig.h" X#include "resources.h" X#include "font.h" X XPIX_FONT bold_font; XPIX_FONT roman_font; XPIX_FONT canvas_font; X X#ifndef X11 Xinit_font() X{ X bold_font = pf_open("/usr/lib/fonts/fixedwidthfonts/screen.b.14"); X roman_font = pf_open("/usr/lib/fonts/fixedwidthfonts/screen.r.14"); X if (bold_font == NULL) bold_font = pf_default(); X if (roman_font == NULL) roman_font = pf_default(); X canvas_font = roman_font; X } X#else Xinit_font() X{ X canvas_font = roman_font = XLoadQueryFont(tool_d, NORMAL_FONT); X bold_font = XLoadQueryFont(tool_d, BOLD_FONT); X} X#endif X11 END_OF_font.c if test 762 -ne `wc -c <font.c`; then echo shar: \"font.c\" unpacked with wrong size! fi # end of overwriting check fi if test -f font.h -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"font.h\" else echo shar: Extracting \"font.h\" \(798 characters\) sed "s/^X//" >font.h <<'END_OF_font.h' X/* X * FIG : Facility for Interactive Generation of figures X * X * Copyright (c) 1988 by Supoj Sutanthavibul (supoj@sally.UTEXAS.EDU) X * January 1988. X * X * %W% %G% X*/ X XEXTERN PIX_FONT canvas_font; XEXTERN PIX_FONT bold_font; XEXTERN PIX_FONT roman_font; X X#ifndef X11 X X#define char_height(font) ((font)->pf_defaultsize.y) X#define char_width(font) ((font)->pf_defaultsize.x) X#define char_advance(font,char) ((font)->pf_char[(char)].pc_adv.x) X X#else X X#define NORMAL_FONT "fixed" X#define BOLD_FONT "8x13bold" X X#define char_height(font) ((font)->max_bounds.ascent + (font)->max_bounds.descent) X#define char_width(font) ((font)->max_bounds.width) X#define char_advance(font,char) (\ X ((font)->per_char)?\ X ((font)->per_char[(char)].width):\ X ((font)->max_bounds.width)) X X#endif X11 END_OF_font.h if test 798 -ne `wc -c <font.h`; then echo shar: \"font.h\" unpacked with wrong size! fi # end of overwriting check fi if test -f free.c -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"free.c\" else echo shar: Extracting \"free.c\" \(2336 characters\) sed "s/^X//" >free.c <<'END_OF_free.c' X/* X * FIG : Facility for Interactive Generation of figures X * X * Copyright (c) 1988 by Supoj Sutanthavibul (supoj@sally.UTEXAS.EDU) X * Febuary 1988. X * X * %W% %G% X*/ X#include "fig.h" X#include "object.h" X Xfree_arc(list) XF_arc **list; X{ X F_arc *a, *arc; X X for (a = *list; a != NULL;) { X arc = a; X a = a->next; X if (arc->for_arrow) free((char*)arc->for_arrow); X if (arc->back_arrow) free((char*)arc->back_arrow); X free((char*)arc); X } X *list = NULL; X } X Xfree_compound(list) XF_compound **list; X{ X F_compound *c, *compound; X X for (c = *list; c != NULL;) { X compound = c; X c = c->next; X free_arc(&compound->arcs); X free_compound(&compound->compounds); X free_ellipse(&compound->ellipses); X free_line(&compound->lines); X free_spline(&compound->splines); X free_text(&compound->texts); X free((char*)compound); X } X *list = NULL; X } X Xfree_ellipse(list) XF_ellipse **list; X{ X F_ellipse *e, *ellipse; X X for (e = *list; e != NULL;) { X ellipse = e; X e = e->next; X free((char*)ellipse); X } X *list = NULL; X } X Xfree_line(list) XF_line **list; X{ X F_line *l, *line; X X for (l = *list; l != NULL;) { X line = l; X l = l->next; X free_linestorage(line); X } X *list = NULL; X } X Xfree_text(list) XF_text **list; X{ X F_text *t, *text; X X for (t = *list; t != NULL;) { X text = t; X t = t->next; X cfree(text->cstring); X free((char*)text); X } X *list = NULL; X } X Xfree_spline(list) XF_spline **list; X{ X F_spline *s, *spline; X X for (s = *list; s != NULL;) { X spline = s; X s = s->next; X free_splinestorage(spline); X } X *list = NULL; X } X Xfree_splinestorage(s) XF_spline *s; X{ X F_point *p, *q; X F_control *a, *b; X X for (p = s->points; p != NULL; p = q) { X q = p->next; X free((char*)p); X } X for (a = s->controls; a != NULL; a = b) { X b = a->next; X free((char*)a); X } X if (s->for_arrow) free((char*)s->for_arrow); X if (s->back_arrow) free((char*)s->back_arrow); X free((char*)s); X } X Xfree_linestorage(l) XF_line *l; X{ X F_point *p, *q; X X for (p = l->points; p != NULL; p = q) { X q = p->next; X free((char*)p); X } X if (l->for_arrow) free((char*)l->for_arrow); X if (l->back_arrow) free((char*)l->back_arrow); X free((char*)l); X } END_OF_free.c if test 2336 -ne `wc -c <free.c`; then echo shar: \"free.c\" unpacked with wrong size! fi # end of overwriting check fi if test -f func.h -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"func.h\" else echo shar: Extracting \"func.h\" \(2079 characters\) sed "s/^X//" >func.h <<'END_OF_func.h' X/* X * FIG : Facility for Interactive Generation of figures X * X * Copyright (c) 1985 by Supoj Sutanthavibul (supoj@sally.UTEXAS.EDU) X * November 1985. X * X * %W% %G% X*/ X X/****************** Functions ******************/ X#define F_NULL 0 X#define F_ELLIPSE_BY_RAD 1 X#define F_ELLIPSE_BY_DIA 2 X#define F_CIRCLE_BY_RAD 3 X#define F_CIRCLE_BY_DIA 4 X#define F_CIRCULAR_ARC 5 X#define F_POLYLINE 6 X#define F_BOX 7 X#define F_POLYGON 8 X#define F_TEXT 9 X#define F_SPLINE 10 X#define F_CLOSED_SPLINE 11 X#define F_COMPOUND 13 X#define F_INTSPLINE 14 X#define F_CLOSED_INTSPLINE 15 X X#define F_CREATE 30 X#define F_COPY 31 X#define F_MOVE 32 X#define F_REPEAT 33 X#define F_REMOVE 34 X#define F_MOVE_POINT 35 X#define F_DELETE_POINT 36 X#define F_ADD_POINT 37 X#define F_DELETE_ARROW_HEAD 38 X#define F_ADD_ARROW_HEAD 39 X#define F_FLIP_XAXIS 40 X#define F_FLIP_YAXIS 41 X#define F_ROTATE90 42 X#define F_ROTATE270 43 X#define F_ROTATE 45 X#define F_FLIP 46 X#define F_AUTOARROW 47 X#define F_TURN 48 X#define F_GLUE 51 X#define F_BREAK 52 X#define F_SCALE 53 X X#define F_SET_PEN_SIZE 70 /* set pen size */ X#define F_SET_LINE_STYLE 71 /* set line style */ X#define F_SET_DASH_LINE 72 X#define F_SET_DOTTED_LINE 73 X#define F_SET_SOLID_LINE 74 X X#define F_READ 101 X#define F_EDIT 103 X#define F_SAVE_IN 104 X#define F_SAVE 105 X#define F_UNDO 107 X#define F_REDISPLAY 109 X#define F_QUIT 111 X#define F_REMOVE_ALL 113 X#define F_SAVE_N_EXIT 115 X#define F_CHDIR 117 X#define F_PWDIR 118 X#define F_SAVE_BITMAP 121 X#define F_STATUS 123 X X/**************** Drawing aids *****************/ X#define F_GRID1 250 X#define F_GRID2 251 X#define F_RULER 252 X#define F_UNCONSTRAINT 260 /*fs*/ X#define F_MOUNTHATTAN 261 /*fs*/ X#define F_MANHATTAN 253 X#define F_MOUNTAIN 254 X#define F_LATEX_LINE 262 /*fs*/ X#define F_LATEX_ARROW 263 /*fs*/ X#define F_AUTOF_ARROW 255 X#define F_AUTOB_ARROW 256 X#define F_MAGNET 257 END_OF_func.h if test 2079 -ne `wc -c <func.h`; then echo shar: \"func.h\" unpacked with wrong size! fi # end of overwriting check fi if test -f graphics.c -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"graphics.c\" else echo shar: Extracting \"graphics.c\" \(2592 characters\) sed "s/^X//" >graphics.c <<'END_OF_graphics.c' X/* X * FIG : Facility for Interactive Generation of figures X * X * Copyright (c) 1985 by Supoj Sutanthavibul (supoj@sally.UTEXAS.EDU) X * January 1985. X * 1st revision : March 1988 X * X * %W% %G% X*/ X#include "fig.h" X#include "resources.h" X#include "paintop.h" X X/**************************************************************************** X X The following spline drawing routine is from X X "An Algorithm for High-Speed Curve Generation" X by George Merrill Chaikin, X Computer Graphics and Image Processing, 3, Academic Press, X 1974, 346-349. X X and X X "On Chaikin's Algorithm" by R. F. Riesenfeld, X Computer Graphics and Image Processing, 4, Academic Press, X 1975, 304-310. X X*****************************************************************************/ X X#define round(x) ((int) (x + .5)) X#define half(z1, z2) ((z1+z2)/2.0) X#define THRESHOLD 5 X X/* iterative version */ Xquadratic_spline(a1, b1, a2, b2, a3, b3, a4, b4, op) Xfloat a1, b1, a2, b2, a3, b3, a4, b4; Xint op; X{ X float x1, y1, x2, y2, x3, y3, x4, y4; X float xmid, ymid; X X clear_stack(); X push(a1, b1, a2, b2, a3, b3, a4, b4); X X while(pop(&x1, &y1, &x2, &y2, &x3, &y3, &x4, &y4)) { X xmid = half(x2, x3); X ymid = half(y2, y3); X if (fabs(x1 - xmid) < THRESHOLD && fabs(y1 - ymid) < THRESHOLD) { X pw_vector(canvas_pixwin, round(x1), round(y1), X round(xmid), round(ymid), op, 1); X } X else { X push(x1, y1, half(x1, x2), half(y1, y2), X half(x2, xmid), half(y2, ymid), xmid, ymid); X } X X if (fabs(xmid - x4) < THRESHOLD && fabs(ymid - y4) < THRESHOLD) { X pw_vector(canvas_pixwin, round(xmid), round(ymid), X round(x4), round(y4), op, 1); X } X else { X push(xmid, ymid, half(xmid, x3), half(ymid, y3), X half(x3, x4), half(y3, y4), x4, y4); X } X } X } X Xbezier_spline(a0, b0, a1, b1, a2, b2, a3, b3, op) Xfloat a0, b0, a1, b1, a2, b2, a3, b3; Xint op; X{ X float x0, y0, x1, y1, x2, y2, x3, y3; X float sx1, sy1, sx2, sy2, tx, ty, tx1, ty1, tx2, ty2, xmid, ymid; X X clear_stack(); X push(a0, b0, a1, b1, a2, b2, a3, b3); X X while(pop(&x0, &y0, &x1, &y1, &x2, &y2, &x3, &y3)) { X if (fabs(x0 - x3) < THRESHOLD && fabs(y0 - y3) < THRESHOLD) { X pw_vector(canvas_pixwin, round(x0), round(y0), X round(x3), round(y3), op, 1); X } X else { X tx = half(x1, x2); ty = half(y1, y2); X sx1 = half(x0, x1); sy1 = half(y0, y1); X sx2 = half(sx1, tx); sy2 = half(sy1, ty); X tx2 = half(x2, x3); ty2 = half(y2, y3); X tx1 = half(tx2, tx); ty1 = half(ty2, ty); X xmid = half(sx2, tx1); ymid = half(sy2, ty1); X X push(x0, y0, sx1, sy1, sx2, sy2, xmid, ymid); X push(xmid, ymid, tx1, ty1, tx2, ty2, x3, y3); X } X } X } END_OF_graphics.c if test 2592 -ne `wc -c <graphics.c`; then echo shar: \"graphics.c\" unpacked with wrong size! fi # end of overwriting check fi if test -f paintop.h -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"paintop.h\" else echo shar: Extracting \"paintop.h\" \(502 characters\) sed "s/^X//" >paintop.h <<'END_OF_paintop.h' X/* X * FIG : Facility for Interactive Generation of figures X * X * Copyright (c) 1985 by Supoj Sutanthavibul (supoj@sally.UTEXAS.EDU) X * November 1985. X * X * %W% %G% X*/ X X#ifndef X11 X X#define INV_PAINT (PIX_SRC ^ PIX_DST) X#define MERGE PIX_SRC|PIX_DST X#define PAINT PIX_SRC X#define ERASE PIX_NOT(PIX_SRC) X X#else X X#define INV_PAINT GXxor X#define MERGE GXor X#define PAINT GXcopy X#define ERASE GXcopyInverted X X#endif X11 X X#define DRAW 1 X#define UNDRAW 0 END_OF_paintop.h if test 502 -ne `wc -c <paintop.h`; then echo shar: \"paintop.h\" unpacked with wrong size! fi # end of overwriting check fi if test -f puterr.c -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"puterr.c\" else echo shar: Extracting \"puterr.c\" \(482 characters\) sed "s/^X//" >puterr.c <<'END_OF_puterr.c' X/* X * FIG : Facility for Interactive Generation of figures X * X * Copyright (c) 1985 by Supoj Sutanthavibul (supoj@sally.UTEXAS.EDU) X * November 1985. X * X * %W% %G% X*/ X#include "fig.h" X X/*VARARGS1*/ Xput_err(format, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) Xchar *format, *arg1, *arg2, *arg3, *arg4, *arg5, *arg6, *arg7, *arg8; X{ X fprintf(stderr, format, arg1, arg2, arg3, arg4, arg5, X arg6, arg7, arg8); X put_msg(format, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8); X} END_OF_puterr.c if test 482 -ne `wc -c <puterr.c`; then echo shar: \"puterr.c\" unpacked with wrong size! fi # end of overwriting check fi if test -f redisplay.c -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"redisplay.c\" else echo shar: Extracting \"redisplay.c\" \(1997 characters\) sed "s/^X//" >redisplay.c <<'END_OF_redisplay.c' X/* X * FIG : Facility for Interactive Generation of figures X * X * Copyright (c) 1988 by Supoj Sutanthavibul (supoj@sally.UTEXAS.EDU) X * Febuary 1988. X * X * %W% %G% X*/ X#include "fig.h" X#include "resources.h" X#include "object.h" X#include "paintop.h" X Xextern int pointmarker_shown; Xextern int compoundbox_shown; Xextern int foreground_color, background_color; X Xredisplay_objects(objects) XF_compound *objects; X{ X if (objects == NULL) return; X redisplay_textobject(objects->texts); X redisplay_lineobject(objects->lines); X redisplay_ellipseobject(objects->ellipses); X redisplay_arcobject(objects->arcs); X redisplay_splineobject(objects->splines); X redisplay_compoundobject(objects->compounds); X if (pointmarker_shown) toggle_pointmarker(); X if (compoundbox_shown) { X F_compound *c; X for (c = objects->compounds; c != NULL; c = c->next) X draw_compoundbox(c, INV_PAINT); X } X } X Xredisplay_arcobject(arcs) XF_arc *arcs; X{ X F_arc *arc; X X for (arc = arcs; arc != NULL; arc = arc->next) X draw_arc(arc, foreground_color); X } X Xredisplay_ellipseobject(ellipses) XF_ellipse *ellipses; X{ X F_ellipse *e; X X for (e = ellipses; e != NULL; e = e->next) X draw_ellipse(e, foreground_color); X } X Xredisplay_lineobject(lines) XF_line *lines; X{ X F_line *line; X X for (line = lines; line != NULL; line = line->next) X draw_line(line, PAINT); X } X Xredisplay_splineobject(splines) XF_spline *splines; X{ X F_spline *s; X X for (s = splines; s != NULL; s = s->next) X draw_spline(s, PAINT); X } X Xredisplay_textobject(texts) XF_text *texts; X{ X F_text *t; X X for (t = texts; t != NULL; t = t->next) X draw_text(t, PAINT); X } X Xredisplay_compoundobject(compounds) XF_compound *compounds; X{ X F_compound *c; X X for (c = compounds; c != NULL; c = c->next) { X draw_compound(c); X } X } X Xredisplay_canvas() X{ X extern F_compound objects; X X clear_canvas(); X set_temp_cursor(&wait_cursor); X pw_batch_on(canvas_pixwin); X redisplay_objects(&objects); X redisplay_grid(); X pw_batch_off(canvas_pixwin); X reset_cursor(); X } END_OF_redisplay.c if test 1997 -ne `wc -c <redisplay.c`; then echo shar: \"redisplay.c\" unpacked with wrong size! fi # end of overwriting check fi if test -f version.h -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"version.h\" else echo shar: Extracting \"version.h\" \(230 characters\) sed "s/^X//" >version.h <<'END_OF_version.h' X/* X * FIG : Facility for Interactive Generation of figures X * X * Copyright (c) 1988 by Supoj Sutanthavibul (supoj@sally.UTEXAS.EDU) X * March 1988. X * X * %W% %G% X*/ X X#define FIG_VERSION "1.4" X#define MINOR_VERSION ".1" END_OF_version.h if test 230 -ne `wc -c <version.h`; then echo shar: \"version.h\" unpacked with wrong size! fi # end of overwriting check fi if test -f xtra.h -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"xtra.h\" else echo shar: Extracting \"xtra.h\" \(656 characters\) sed "s/^X//" >xtra.h <<'END_OF_xtra.h' X/* X * FIG : Facility for Interactive Generation of figures X * X * Copyright (c) 1985 by Supoj Sutanthavibul (supoj@sally.UTEXAS.EDU) X * January 1985. X * 1st revision : Aug 1985. X * X * %W% %G% X*/ X#define tool_destroy(tool) XtDestroyWidget(tool) X Xpr_size pf_textwidth(); X X#define pw_text(w, x, y, op, font, string) \ X XDrawString(tool_d, (w), gccache[(op)], (x), (y), \ X (string), strlen(string)) X X#define pw_put(w, x, y, op) \ X XDrawPoint(tool_d, (w), gccache[(op) ? PAINT : ERASE], (x), (y)) X X#define pw_vector(w, x1, y1, x2, y2, op, width) \ X XDrawLine(tool_d, (w), gccache[(op)], (x1), (y1), (x2), (y2)) X X#define pw_batch_on(w) X X#define pw_batch_off(w) END_OF_xtra.h if test 656 -ne `wc -c <xtra.h`; then echo shar: \"xtra.h\" unpacked with wrong size! fi # end of overwriting check fi echo shar: End of archive 1 \(of 11\). cp /dev/null ark1isdone MISSING="" for I in 1 2 3 4 5 6 7 8 9 10 11 ; do if test ! -f ark${I}isdone ; then MISSING="${MISSING} ${I}" fi done if test "${MISSING}" = "" ; then echo You have unpacked all 11 archives. rm -f ark[1-9]isdone ark[1-9][0-9]isdone else echo You still need to unpack the following archives: echo " " ${MISSING} fi ## End of shell archive. exit 0 -- Mike Wexler(wyse!mikew) Phone: (408)433-1000 x1330