Path: utzoo!utgpu!utstat!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!bloom-beacon!apple!vsi1!wyse!mikew From: mikew@wyse.wyse.com (Mike Wexler) Newsgroups: comp.sources.x Subject: v03i048: The Chaos Game, Patch1 Message-ID: <2128@wyse.wyse.com> Date: 10 Mar 89 19:54:54 GMT Organization: Wyse Technology, San Jose Lines: 376 Approved: mikew@wyse.com Submitted-by: Nathan K. Meyers Posting-number: Volume 3, Issue 48 Archive-name: chaos/patch1 These patches to chaos add a feature and clean up the program slightly. The README file now reflects the the behavior of the boilerplate makefile added by the moderator to my previous posting. Nathan Meyers nathanm@hp-pcd.hp.com ============================================================================ *** orig-README Tue Mar 7 09:24:49 1989 --- README Tue Mar 7 09:24:29 1989 *************** *** 8,14 To make on systems of SYSV descent (such as hp-ux): ! make SYSV --------------------- Nathan Meyers --- 8,14 ----- To make on systems of SYSV descent (such as hp-ux): ! make "CDEBUGFLAGS=-O -DSYSV" --------------------- Nathan Meyers *** orig-chaos.1 Tue Mar 7 09:24:50 1989 --- chaos.1 Tue Mar 7 09:24:29 1989 *************** *** 8,13 \fBchaos\fR [\|\fB-bd\fR border\|] [\|\fB-bg\fR background\|] [\|\fB-bw\fR borderwidth\|] [\|\fB-delay\fR msec\|] [\|\fB-display\fR displayname\|] [\|\fB-geometry\fR geometry\|] [\|\fB-mpoints\fR\|] [\|\fB-out\fR bitmapfile\|] --- 8,14 ----- \fBchaos\fR [\|\fB-bd\fR border\|] [\|\fB-bg\fR background\|] [\|\fB-bw\fR borderwidth\|] [\|\fB-delay\fR msec\|] [\|\fB-display\fR displayname\|] + [\|\fB-dist\fR distance\|] [\|\fB-geometry\fR geometry\|] [\|\fB-mpoints\fR\|] [\|\fB-out\fR bitmapfile\|] *************** *** 74,79 Specify display on which to run; defaults to contents of DISPLAY environment variable. .TP .B -geometry Specify window geometry; defaults to =300x300+0+0. .TP --- 75,86 ----- Specify display on which to run; defaults to contents of DISPLAY environment variable. .TP + .B -dist + Allows you to specify the distance moved for each point. Default value + is 0.5. When this option is used, point P\v'+.2v'\s-2n\v'-.2v'\s0 will + be located the specified fraction of the distance between + P\v'+.2v'\s-2n-1\v'-.2v'\s0 and the selected vertex. + .TP .B -geometry Specify window geometry; defaults to =300x300+0+0. .TP *************** *** 138,141 chaos -points 0,0,.3,1,.7,1,1,0 .SH AUTHORSHIP \fIChaos\fR was authored by Nathan Meyers of Hewlett-Packard ! (nathanm@hp-pcd). --- 145,150 ----- chaos -points 0,0,.3,1,.7,1,1,0 .SH AUTHORSHIP \fIChaos\fR was authored by Nathan Meyers of Hewlett-Packard ! (nathanm@hp-pcd). Thanks to Paul T. Keener of the University ! of Pennsylvania (keener@upenn5.hpe.upenn.edu) for the -dist ! option. *** orig-chaos.c Tue Mar 7 09:24:53 1989 --- chaos.c Tue Mar 7 09:24:29 1989 *************** *** 20,26 char *progname; ! static char *what = "@(#)chaos.c $Revision: 1.13 $"; struct dattract { double x,y; --- 20,26 ----- char *progname; ! static char *what = "@(#)chaos.c $Revision: 1.17 $"; struct dattract { double x,y; *************** *** 29,35 { 0.5, 0.846410161513 } }; struct dattract *fpoints = dpoints; - int npoints = 3; char *strchr(); main(argc,argv) int argc; --- 29,34 ----- { 0.5, 0.846410161513 } }; struct dattract *fpoints = dpoints; main(argc,argv) int argc; *************** *** 49,55 char *foreground = NULL, *background = NULL, *border = NULL; char *geomstring = NULL; XColor visual_def_return, exact_def_return; - XEvent event; int o_argc = argc; char **o_argv = argv; int i,j; --- 48,53 ----- char *foreground = NULL, *background = NULL, *border = NULL; char *geomstring = NULL; XColor visual_def_return, exact_def_return; int o_argc = argc; char **o_argv = argv; int i; *************** *** 52,58 XEvent event; int o_argc = argc; char **o_argv = argv; ! int i,j; char *basename; int width, height; int mapped=0; --- 50,56 ----- XColor visual_def_return, exact_def_return; int o_argc = argc; char **o_argv = argv; ! int i; char *basename; int width, height; int mapped=0; *************** *** 63,69 char *bitmapfilename = "chaos.xbm"; char *pointlist = NULL; int manpoints = 0; ! double time(); progname = argv[0]; --- 61,70 ----- char *bitmapfilename = "chaos.xbm"; char *pointlist = NULL; int manpoints = 0; ! int npoints = 3; ! double mulcon = 0.5; ! long time(), atol(); ! char *strrchr(); progname = argv[0]; *************** *** 71,77 else basename=progname; while (--argc>0) { ! char *option = (*++argv); if (!strcmp(option,"-delay")) { if (--argc==0) usage(); delayvalue = atol(*++argv); --- 72,78 ----- else basename=progname; while (--argc>0) { ! char *option = (*++argv), *strchr(); if (!strcmp(option,"-delay")) { if (--argc==0) usage(); delayvalue = atol(*++argv); *************** *** 106,111 bwidth = atoi(*++argv); if (bwidth<0) bwidth = 0; } else if (!strcmp(option,"-geometry")) { if (--argc==0) usage(); geomstring = (*++argv); --- 107,118 ----- bwidth = atoi(*++argv); if (bwidth<0) bwidth = 0; } + else if (!strcmp(option,"-dist")) { + double atof(); + if (--argc==0) usage(); + mulcon = atof(*++argv); + if (mulcon < 0.0) mulcon = -mulcon; + } else if (!strcmp(option,"-geometry")) { if (--argc==0) usage(); geomstring = (*++argv); *************** *** 132,138 char *calloc(), *strchr(); double strtod(); int commacount = 0; - int len; while (*temp != '\0') commacount += (*(temp++) == ',') ? 1 : 0; if (!(commacount & 0x1)) usage(); npoints = (commacount >> 1) + 1; --- 139,144 ----- char *calloc(), *strchr(); double strtod(); int commacount = 0; while (*temp != '\0') commacount += (*(temp++) == ',') ? 1 : 0; if (!(commacount & 0x1)) usage(); npoints = (commacount >> 1) + 1; *************** *** 337,343 int fd = ConnectionNumber(display); int readfds = 1<]", "[-delay ]", "[-display ]", "[-geometry ]", "[-mpoints]", "[-out ]", --- 440,446 ----- "[-bw ]", "[-delay ]", "[-display ]", + "[-dist ]", "[-geometry ]", "[-mpoints]", "[-out ]", *** orig-patchlevel.h Tue Mar 7 09:24:55 1989 --- patchlevel.h Tue Mar 7 09:24:30 1989 *************** *** 1 ! #define PATCHLEVEL 0 --- 1 ----- ! #define PATCHLEVEL 1 -- Mike Wexler(wyse!mikew) Phone: (408)433-1000 x1330 Moderator of comp.sources.x