[comp.windows.x] Patches to get tec program running with XView
Steven L. Baur
baur at venice.SEDD.TRW.COM
Fri Mar 2 13:51:19 AEST 1990
Original-posting-by: baur at venice.SEDD.TRW.COM (Steven L. Baur)
Original-subject: Patches to get tec program running with XView
Reposted-by: emv at math.lsa.umich.edu (Edward Vielmetti)
[This is a patch to from comp.windows.x.]
I converted the continental drift simulator recently posted to
comp.sources.misc to XView.
Apply this patch to sun.c, and then compile it with
cc -c -I/usr/include/X11 sun.c
Then link with -L/usr/lib/X11 -lxview -lX11.
--------------------Cut Here------------------------------------------------
*** ../tec/sun.c Thu Mar 1 13:15:20 1990
--- sun.c Thu Mar 1 13:43:16 1990
***************
*** 8,19 ****
/* This file contains code to run tec under Un*x and Sunview. The
random number code is the same as that contained in unix.c; the
graphics code was inspired by the example code from Sun contained
! in /usr/share/src/sun/suntool/examples/coloredit.c and in the
Sunview Programmer's Guide. I don't claim to understand it. The
code in draw() is similar to that in ami.c. */
! #include <suntool/sunview.h>
! #include <suntool/canvas.h>
#include <sys/types.h>
#include <sys/timeb.h>
#include "const.h"
--- 8,20 ----
/* This file contains code to run tec under Un*x and Sunview. The
random number code is the same as that contained in unix.c; the
graphics code was inspired by the example code from Sun contained
! in /usr/share/src/sun/xview/examples/coloredit.c and in the
Sunview Programmer's Guide. I don't claim to understand it. The
code in draw() is similar to that in ami.c. */
+ /* baur at venice.sedd.trw.com: Converted to XView */
! #include <xview/xview.h>
! #include <xview/canvas.h>
#include <sys/types.h>
#include <sys/timeb.h>
#include "const.h"
***************
*** 52,73 ****
struct timeb t;
Frame base_frame;
Canvas canvas;
! char cmsname[CMS_NAMESIZE];
/* Initialize random number generator */
ftime (&t); srandom ((int) ((t.time % 100000) + t.millitm));
/* Suntools-specific graphics setup */
! base_frame = window_create (NULL, FRAME, FRAME_LABEL, "suntec",
! WIN_WIDTH, MAXX * 6, WIN_HEIGHT, MAXY*6, 0);
! canvas = window_create (base_frame, CANVAS, WIN_WIDTH,
! MAXX * 6, WIN_HEIGHT, MAXY * 6, 0);
pw = (Pixwin *) canvas_pixwin (canvas);
sprintf (cmsname, "suntec%D", getpid());
pw_setcmsname (pw, cmsname);
! pw_putcolormap (pw, 0, 32, red, green, blue);
notify_interpose_destroy_func (base_frame, tecdestroy);
! window_set (base_frame, WIN_SHOW, TRUE, 0);
/* Run the program, checking with Sunview after each step */
init (*++argv);
--- 53,75 ----
struct timeb t;
Frame base_frame;
Canvas canvas;
! char cmsname[50];
/* Initialize random number generator */
ftime (&t); srandom ((int) ((t.time % 100000) + t.millitm));
/* Suntools-specific graphics setup */
! base_frame = xv_create (NULL, FRAME, XV_LABEL, "suntec",
! XV_WIDTH, MAXX * 6, XV_HEIGHT, MAXY*6,
! WIN_DYNAMIC_VISUAL, TRUE, 0);
! canvas = xv_create (base_frame, CANVAS, XV_WIDTH,
! MAXX * 6, XV_HEIGHT, MAXY * 6, 0);
pw = (Pixwin *) canvas_pixwin (canvas);
sprintf (cmsname, "suntec%D", getpid());
pw_setcmsname (pw, cmsname);
! /* XView CONVERSION - Need to set WIN_DYNAMIC_VISUAL on window, see Sect 4.3 */pw_putcolormap (pw, 0, 32, red, green, blue);
notify_interpose_destroy_func (base_frame, tecdestroy);
! xv_set (base_frame, WIN_SHOW, TRUE, 0);
/* Run the program, checking with Sunview after each step */
init (*++argv);
--
steve baur at venice.SEDD.TRW.COM
A computer which cannot run GNU emacs is not worth using.
More information about the Alt.sources.patches
mailing list