home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / x / volume5 / xfroot / patch2 < prev    next >
Encoding:
Text File  |  1989-11-21  |  4.1 KB  |  159 lines

  1. Path: uunet!island!argv
  2. From: argv@island.uu.net (Dan Heller)
  3. Newsgroups: comp.sources.x
  4. Subject: v05i029: xfroot, Patch2
  5. Message-ID: <1205@island.uu.net>
  6. Date: 22 Nov 89 00:55:22 GMT
  7. Organization: Island Graphics, Marin County, California
  8. Lines: 148
  9. Approved: island!argv@sun.com
  10.  
  11. Submitted-by: Ed Kubaitis <uunet!ux1.cso.uiuc.edu!ejk>
  12. Posting-number: Volume 5, Issue 29
  13. Archive-name: xfroot/patch2
  14. Patch-To: xfroot: Volume 5, Issue 3,7
  15.  
  16. This patch makes the following changes to xfroot:
  17.  
  18.     1. Eliminate process startup and XOpenDisplay cp time from points/second
  19.        calculation.
  20.  
  21.     2. Increase number of possible different automatically generated random 
  22.        fractals from 32K to 1M.
  23.  
  24. It was generated by diff against the xfroot.c with xfroot/patch1 applied, 
  25. though it does not depend on that patch. A complete xfroot.shar with both
  26. this patch and xfroot/patch1 is available via anonymous ftp from 
  27. uxc.cso.uiuc.edu in pub/xfroot/xfroot.shar or by email request to:
  28.  
  29. Ed Kubaitis (ejk@ux1.cso.uiuc.edu)
  30. ------------------------------------------
  31.  
  32. *** xfroot.c.patch1    Sun Oct  1 11:59:57 1989
  33. --- xfroot.c    Fri Nov 17 07:44:17 1989
  34. ***************
  35. *** 39,45
  36.   #define HZ  60      /* see REAMDME */
  37.   
  38.   #define Ranf() (double)((Ranfseed=(Ranfseed*1629+1)%1048576)/1048576.)
  39. ! #define Ranfset(l) (Ranfseed=((abs(l)*1629)+1)%1048576)
  40.   long    Ranfseed=4326;
  41.   
  42.   int     mxp=0, np=0;       /* max in-range points, in-range points */
  43.  
  44. --- 39,45 -----
  45.   #define HZ  60      /* see REAMDME */
  46.   
  47.   #define Ranf() (double)((Ranfseed=(Ranfseed*1629+1)%1048576)/1048576.)
  48. ! #define Ranfset(l) (Ranfseed=(((abs(l)%1048576)*1629)+1)%1048576)
  49.   long    Ranfseed=4326;
  50.   
  51.   int     mxp=0, np=0;       /* max in-range points, in-range points */
  52. ***************
  53. *** 53,59
  54.   
  55.   
  56.   main(argc, argv) int argc; char *argv[]; {
  57. !    struct tms t;
  58.   
  59.      preset(argc, argv);
  60.   
  61.  
  62. --- 53,60 -----
  63.   
  64.   
  65.   main(argc, argv) int argc; char *argv[]; {
  66. !    struct tms t0, t1;
  67. !    int ticks;
  68.   
  69.      preset(argc, argv);
  70.   
  71. ***************
  72. *** 57,62
  73.   
  74.      preset(argc, argv);
  75.   
  76.      hopalong(); 
  77.   
  78.      times(&t);
  79.  
  80. --- 58,64 -----
  81.   
  82.      preset(argc, argv);
  83.   
  84. +    times(&t0);
  85.      hopalong(); 
  86.      times(&t1);
  87.   
  88. ***************
  89. *** 58,63
  90.      preset(argc, argv);
  91.   
  92.      hopalong(); 
  93.   
  94.      times(&t);
  95.      printf("xfroot: %d points   %d(%d%%) in-range   %d points/cp_second\n",
  96.  
  97. --- 60,66 -----
  98.   
  99.      times(&t0);
  100.      hopalong(); 
  101. +    times(&t1);
  102.   
  103.      ticks = (t1.tms_utime + t1.tms_stime) - (t0.tms_utime + t0.tms_stime);
  104.      printf("xfroot: %d points   %d(%d%%) in-range   %d points/cp_second\n",
  105. ***************
  106. *** 59,65
  107.   
  108.      hopalong(); 
  109.   
  110. !    times(&t);
  111.      printf("xfroot: %d points   %d(%d%%) in-range   %d points/cp_second\n",
  112.         nP, np, (100*np)/nP, 
  113.             (int)((double)nP/((double)(t.tms_utime + t.tms_stime)/(double)HZ)));
  114.  
  115. --- 62,68 -----
  116.      hopalong(); 
  117.      times(&t1);
  118.   
  119. !    ticks = (t1.tms_utime + t1.tms_stime) - (t0.tms_utime + t0.tms_stime);
  120.      printf("xfroot: %d points   %d(%d%%) in-range   %d points/cp_second\n",
  121.         nP, np, (100*np)/nP, 
  122.             (int)((double)nP/((double)ticks/(double)HZ)));
  123. ***************
  124. *** 62,68
  125.      times(&t);
  126.      printf("xfroot: %d points   %d(%d%%) in-range   %d points/cp_second\n",
  127.         nP, np, (100*np)/nP, 
  128. !           (int)((double)nP/((double)(t.tms_utime + t.tms_stime)/(double)HZ)));
  129.   
  130.      setroot(W,H,bmap);
  131.      XCloseDisplay(dpy);
  132.  
  133. --- 65,71 -----
  134.      ticks = (t1.tms_utime + t1.tms_stime) - (t0.tms_utime + t0.tms_stime);
  135.      printf("xfroot: %d points   %d(%d%%) in-range   %d points/cp_second\n",
  136.         nP, np, (100*np)/nP, 
  137. !           (int)((double)nP/((double)ticks/(double)HZ)));
  138.   
  139.      setroot(W,H,bmap);
  140.      XCloseDisplay(dpy);
  141. ***************
  142. *** 144,150
  143.      if (!bmap) { fprintf(stderr, "xfroot: malloc failed.\n"); exit(1);}
  144.      bzero(bmap, bmn);
  145.   
  146. !    Ranfset(time(0)%getpid()); hopset(); 
  147.   
  148.      if (!mxp && !mxP) {
  149.         mxp = (int) (0.25 * (float)(W*H));
  150.  
  151. --- 147,153 -----
  152.      if (!bmap) { fprintf(stderr, "xfroot: malloc failed.\n"); exit(1);}
  153.      bzero(bmap, bmn);
  154.   
  155. !    Ranfset(time(0)); hopset(); 
  156.   
  157.      if (!mxp && !mxP) {
  158.         mxp = (int) (0.25 * (float)(W*H));
  159.