home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / misc / volume24 / gnuplot3 / part26 < prev    next >
Encoding:
Text File  |  1991-10-28  |  38.6 KB  |  1,367 lines

  1. Newsgroups: comp.sources.misc
  2. From: gershon%gr@cs.utah.edu (Elber Gershon)
  3. Subject:  v24i048:  gnuplot3 - interactive function plotting utility, Part26/26
  4. Message-ID: <1991Oct29.031148.4386@sparky.imd.sterling.com>
  5. X-Md4-Signature: 39aaf473530c7e95ec35c1b5854ea431
  6. Date: Tue, 29 Oct 1991 03:11:48 GMT
  7. Approved: kent@sparky.imd.sterling.com
  8.  
  9. Submitted-by: gershon%gr@cs.utah.edu (Elber Gershon)
  10. Posting-number: Volume 24, Issue 48
  11. Archive-name: gnuplot3/part26
  12. Environment: UNIX, MS-DOS, VMS
  13. Supersedes: gnuplot2: Volume 11, Issue 65-79
  14.  
  15. #!/bin/sh
  16. # this is Part.26 (part 26 of a multipart archive)
  17. # do not concatenate these parts, unpack them in order with /bin/sh
  18. # file gnuplot/graphics.c continued
  19. #
  20. if test ! -r _shar_seq_.tmp; then
  21.     echo 'Please unpack part 1 first!'
  22.     exit 1
  23. fi
  24. (read Scheck
  25.  if test "$Scheck" != 26; then
  26.     echo Please unpack part "$Scheck" next!
  27.     exit 1
  28.  else
  29.     exit 0
  30.  fi
  31. ) < _shar_seq_.tmp || exit 1
  32. if test ! -f _shar_wnt_.tmp; then
  33.     echo 'x - still skipping gnuplot/graphics.c'
  34. else
  35. echo 'x - continuing file gnuplot/graphics.c'
  36. sed 's/^X//' << 'SHAR_EOF' >> 'gnuplot/graphics.c' &&
  37. X    }
  38. X
  39. X
  40. /* DRAW CURVES */
  41. X    if (key == -1) {
  42. X        xl = xright  - (t->h_tic) - (t->h_char)*5;
  43. X        yl = ytop - (t->v_tic) - (t->v_char);
  44. X    }
  45. X    if (key == 1) {
  46. X        xl = map_x( LogScale(key_x, log_x, "key", "x") );
  47. X        yl = map_y( LogScale(key_y, log_y, "key", "y") );
  48. X    }
  49. X
  50. X    this_plot = plots;
  51. X    for (curve = 0; curve < pcount; this_plot = this_plot->next_cp, curve++) {
  52. X        (*t->linetype)(this_plot->line_type);
  53. X        if (key != 0) {
  54. X            if ((*t->justify_text)(RIGHT)) {
  55. X                (*t->put_text)(xl,
  56. X                    yl,this_plot->title);
  57. X            }
  58. X            else {
  59. X                if (inrange(xl-(t->h_char)*strlen(this_plot->title), 
  60. X                         xleft, xright))
  61. X                 (*t->put_text)(xl-(t->h_char)*strlen(this_plot->title),
  62. X                             yl,this_plot->title);
  63. X            }
  64. X        }
  65. X
  66. X        switch(this_plot->plot_style) {
  67. X            case IMPULSES: {
  68. X               if (key != 0) {
  69. X                  (*t->move)(xl+(t->h_char),yl);
  70. X                  (*t->vector)(xl+4*(t->h_char),yl);
  71. X               }
  72. X               plot_impulses(this_plot, yaxis_x, xaxis_y);
  73. X               break;
  74. X            }
  75. X            case LINES: {
  76. X               if (key != 0) {
  77. X                  (*t->move)(xl+(int)(t->h_char),yl);
  78. X                  (*t->vector)(xl+(int)(4*(t->h_char)),yl);
  79. X               }
  80. X               plot_lines(this_plot);
  81. X               break;
  82. X            }
  83. X            case POINTS: {
  84. X               if (key != 0) {
  85. X                  (*t->point)(xl+2*(t->h_char),yl,
  86. X                            this_plot->point_type);
  87. X               }
  88. X               plot_points(this_plot);
  89. X               break;
  90. X            }
  91. X            case LINESPOINTS: {
  92. X               /* put lines */
  93. X               if (key != 0) {
  94. X                  (*t->move)(xl+(t->h_char),yl);
  95. X                  (*t->vector)(xl+4*(t->h_char),yl);
  96. X               }
  97. X               plot_lines(this_plot);
  98. X
  99. X               /* put points */
  100. X               if (key != 0) {
  101. X                  (*t->point)(xl+2*(t->h_char),yl,
  102. X                            this_plot->point_type);
  103. X               }
  104. X               plot_points(this_plot);
  105. X               break;
  106. X            }
  107. X            case DOTS: {
  108. X               if (key != 0) {
  109. X                  (*t->point)(xl+2*(t->h_char),yl, -1);
  110. X               }
  111. X               plot_dots(this_plot);
  112. X               break;
  113. X            }
  114. X            case ERRORBARS: {
  115. X               if (key != 0) {
  116. X                  (*t->point)(xl+2*(t->h_char),yl,
  117. X                            this_plot->point_type);
  118. X               }
  119. X               plot_points(this_plot);
  120. X
  121. X               /* for functions, just like POINTS */
  122. X               if (this_plot->plot_type == DATA) {
  123. X                  if (key != 0) {
  124. X                     (*t->move)(xl+(t->h_char),yl);
  125. X                     (*t->vector)(xl+4*(t->h_char),yl);
  126. X                     (*t->move)(xl+(t->h_char),yl+ERRORBARTIC);
  127. X                     (*t->vector)(xl+(t->h_char),yl-ERRORBARTIC);
  128. X                     (*t->move)(xl+4*(t->h_char),yl+ERRORBARTIC);
  129. X                     (*t->vector)(xl+4*(t->h_char),yl-ERRORBARTIC);
  130. X                  }
  131. X                  plot_bars(this_plot);
  132. X               }
  133. X               break;
  134. X            }
  135. X        }
  136. X        yl = yl - (t->v_char);
  137. X    }
  138. X    (*t->text)();
  139. X    (void) fflush(outfile);
  140. }
  141. X
  142. /* plot_impulses:
  143. X * Plot the curves in IMPULSES style
  144. X */
  145. void
  146. plot_impulses(plot, yaxis_x, xaxis_y)
  147. X    struct curve_points *plot;
  148. X    int yaxis_x, xaxis_y;
  149. {
  150. X    int i;
  151. X    int x,y;
  152. X    struct termentry *t = &term_tbl[term];
  153. X
  154. X    for (i = 0; i < plot->p_count; i++) {
  155. X       switch (plot->points[i].type) {
  156. X          case INRANGE: {
  157. X             x = map_x(plot->points[i].x);
  158. X             y = map_y(plot->points[i].y);
  159. X             break;
  160. X          }
  161. X          case OUTRANGE: {
  162. X             if (!inrange(plot->points[i].x, x_min,x_max))
  163. X               continue;
  164. X             x = map_x(plot->points[i].x);
  165. X             if ((y_min < y_max 
  166. X                 && plot->points[i].y < y_min)
  167. X                || (y_max < y_min 
  168. X                    && plot->points[i].y > y_min))
  169. X               y = map_y(y_min);
  170. X             if ((y_min < y_max 
  171. X                 && plot->points[i].y > y_max)
  172. X                || (y_max<y_min 
  173. X                    && plot->points[i].y < y_max))
  174. X               y = map_y(y_max);
  175. X             break;
  176. X          }
  177. X          default:        /* just a safety */
  178. X          case UNDEFINED: {
  179. X             continue;
  180. X          }
  181. X       }
  182. X                    
  183. X       if (polar)
  184. X          (*t->move)(yaxis_x,xaxis_y);
  185. X       else
  186. X          (*t->move)(x,xaxis_y);
  187. X       (*t->vector)(x,y);
  188. X    }
  189. X
  190. }
  191. X
  192. /* plot_lines:
  193. X * Plot the curves in LINES style
  194. X */
  195. void
  196. plot_lines(plot)
  197. X    struct curve_points *plot;
  198. {
  199. X    int i;                /* point index */
  200. X    int x,y;                /* point in terminal coordinates */
  201. X    struct termentry *t = &term_tbl[term];
  202. X    enum coord_type prev = UNDEFINED; /* type of previous point */
  203. X    double ex, ey;            /* an edge point */
  204. X    double lx[2], ly[2];        /* two edge points */
  205. X
  206. X    for (i = 0; i < plot->p_count; i++) {
  207. X       switch (plot->points[i].type) {
  208. X          case INRANGE: {
  209. X             x = map_x(plot->points[i].x);
  210. X             y = map_y(plot->points[i].y);
  211. X
  212. X             if (prev == INRANGE) {
  213. X                (*t->vector)(x,y);
  214. X             } else if (prev == OUTRANGE) {
  215. X                /* from outrange to inrange */
  216. X                if (!clip_lines1) {
  217. X                    (*t->move)(x,y);
  218. X                } else {
  219. X                    edge_intersect(plot->points, i, &ex, &ey);
  220. X                    (*t->move)(map_x(ex), map_y(ey));
  221. X                    (*t->vector)(x,y);
  222. X                }
  223. X             } else {        /* prev == UNDEFINED */
  224. X                (*t->move)(x,y);
  225. X                (*t->vector)(x,y);
  226. X             }
  227. X                    
  228. X             break;
  229. X          }
  230. X          case OUTRANGE: {
  231. X             if (prev == INRANGE) {
  232. X                /* from inrange to outrange */
  233. X                if (clip_lines1) {
  234. X                    edge_intersect(plot->points, i, &ex, &ey);
  235. X                    (*t->vector)(map_x(ex), map_y(ey));
  236. X                }
  237. X             } else if (prev == OUTRANGE) {
  238. X                /* from outrange to outrange */
  239. X                if (clip_lines2) {
  240. X                    if (two_edge_intersect(plot->points, i, lx, ly)) {
  241. X                       (*t->move)(map_x(lx[0]), map_y(ly[0]));
  242. X                       (*t->vector)(map_x(lx[1]), map_y(ly[1]));
  243. X                    }
  244. X                }
  245. X             }
  246. X             break;
  247. X          }
  248. X          default:        /* just a safety */
  249. X          case UNDEFINED: {
  250. X             break;
  251. X          }
  252. X       }
  253. X       prev = plot->points[i].type;
  254. X    }
  255. }
  256. X
  257. /* plot_bars:
  258. X * Plot the curves in ERRORBARS style
  259. X *  we just plot the bars; the points are plotted in plot_points
  260. X */
  261. void
  262. plot_bars(plot)
  263. X    struct curve_points *plot;
  264. {
  265. X    int i;                /* point index */
  266. X    struct termentry *t = &term_tbl[term];
  267. X    double x;                /* position of the bar */
  268. X    double ylow, yhigh;        /* the ends of the bars */
  269. X    unsigned int xM, ylowM, yhighM; /* the mapped version of above */
  270. X    BOOLEAN low_inrange, high_inrange;
  271. X    int tic = ERRORBARTIC;
  272. X    
  273. X    for (i = 0; i < plot->p_count; i++) {
  274. X       /* undefined points don't count */
  275. X       if (plot->points[i].type == UNDEFINED)
  276. X        continue;
  277. X
  278. X       /* check to see if in xrange */
  279. X       x = plot->points[i].x;
  280. X       if (! inrange(x, x_min, x_max))
  281. X        continue;
  282. X       xM = map_x(x);
  283. X
  284. X       /* find low and high points of bar, and check yrange */
  285. X       yhigh = plot->points[i].yhigh;
  286. X       ylow = plot->points[i].ylow;
  287. X
  288. X       high_inrange = inrange(yhigh, y_min,y_max);
  289. X       low_inrange = inrange(ylow, y_min,y_max);
  290. X
  291. X       /* compute the plot position of yhigh */
  292. X       if (high_inrange)
  293. X        yhighM = map_y(yhigh);
  294. X       else if (samesign(yhigh-y_max, y_max-y_min))
  295. X        yhighM = map_y(y_max);
  296. X       else
  297. X        yhighM = map_y(y_min);
  298. X       
  299. X       /* compute the plot position of ylow */
  300. X       if (low_inrange)
  301. X        ylowM = map_y(ylow);
  302. X       else if (samesign(ylow-y_max, y_max-y_min))
  303. X        ylowM = map_y(y_max);
  304. X       else
  305. X        ylowM = map_y(y_min);
  306. X
  307. X       if (!high_inrange && !low_inrange && ylowM == yhighM)
  308. X        /* both out of range on the same side */
  309. X          continue;
  310. X
  311. X       /* by here everything has been mapped */
  312. X       (*t->move)(xM, ylowM);
  313. X       (*t->vector)(xM, yhighM); /* draw the main bar */
  314. X       (*t->move)(xM-tic, ylowM); /* draw the bottom tic */
  315. X       (*t->vector)(xM+tic, ylowM);
  316. X       (*t->move)(xM-tic, yhighM); /* draw the top tic */
  317. X       (*t->vector)(xM+tic, yhighM);
  318. X    }
  319. }
  320. X
  321. /* plot_points:
  322. X * Plot the curves in POINTS style
  323. X */
  324. void
  325. plot_points(plot)
  326. X    struct curve_points *plot;
  327. {
  328. X    int i;
  329. X    int x,y;
  330. X    struct termentry *t = &term_tbl[term];
  331. X
  332. X    for (i = 0; i < plot->p_count; i++) {
  333. X       if (plot->points[i].type == INRANGE) {
  334. X          x = map_x(plot->points[i].x);
  335. X          y = map_y(plot->points[i].y);
  336. X          /* do clipping if necessary */
  337. X          if (!clip_points ||
  338. X             (   x >= xleft + t->h_tic  && y >= ybot + t->v_tic 
  339. X              && x <= xright - t->h_tic && y <= ytop - t->v_tic))
  340. X            (*t->point)(x,y, plot->point_type);
  341. X       }
  342. X    }
  343. }
  344. X
  345. /* plot_dots:
  346. X * Plot the curves in DOTS style
  347. X */
  348. void
  349. plot_dots(plot)
  350. X    struct curve_points *plot;
  351. {
  352. X    int i;
  353. X    int x,y;
  354. X    struct termentry *t = &term_tbl[term];
  355. X
  356. X    for (i = 0; i < plot->p_count; i++) {
  357. X       if (plot->points[i].type == INRANGE) {
  358. X          x = map_x(plot->points[i].x);
  359. X          y = map_y(plot->points[i].y);
  360. X          /* point type -1 is a dot */
  361. X          (*t->point)(x,y, -1);
  362. X       }
  363. X    }
  364. }
  365. X
  366. /* single edge intersection algorithm */
  367. /* Given two points, one inside and one outside the plot, return
  368. X * the point where an edge of the plot intersects the line segment defined 
  369. X * by the two points.
  370. X */
  371. void
  372. edge_intersect(points, i, ex, ey)
  373. X    struct coordinate *points; /* the points array */
  374. X    int i;                /* line segment from point i-1 to point i */
  375. X    double *ex, *ey;        /* the point where it crosses an edge */
  376. {
  377. X    /* global x_min, x_max, y_min, x_max */
  378. X    double ax = points[i-1].x;
  379. X    double ay = points[i-1].y;
  380. X    double bx = points[i].x;
  381. X    double by = points[i].y;
  382. X    double x, y;            /* possible intersection point */
  383. X
  384. X    if (by == ay) {
  385. X       /* horizontal line */
  386. X       /* assume inrange(by, y_min, y_max) */
  387. X       *ey = by;        /* == ay */
  388. X
  389. X       if (inrange(x_max, ax, bx))
  390. X        *ex = x_max;
  391. X       else if (inrange(x_min, ax, bx))
  392. X        *ex = x_min;
  393. X       else {
  394. X        (*term_tbl[term].text)();
  395. X        (void) fflush(outfile);
  396. X        int_error("error in edge_intersect", NO_CARET);
  397. X       }
  398. X       return;
  399. X    } else if (bx == ax) {
  400. X       /* vertical line */
  401. X       /* assume inrange(bx, x_min, x_max) */
  402. X       *ex = bx;        /* == ax */
  403. X
  404. X       if (inrange(y_max, ay, by))
  405. X        *ey = y_max;
  406. X       else if (inrange(y_min, ay, by))
  407. X        *ey = y_min;
  408. X       else {
  409. X        (*term_tbl[term].text)();
  410. X        (void) fflush(outfile);
  411. X        int_error("error in edge_intersect", NO_CARET);
  412. X       }
  413. X       return;
  414. X    }
  415. X
  416. X    /* slanted line of some kind */
  417. X
  418. X    /* does it intersect y_min edge */
  419. X    if (inrange(y_min, ay, by) && y_min != ay && y_min != by) {
  420. X       x = ax + (y_min-ay) * ((bx-ax) / (by-ay));
  421. X       if (inrange(x, x_min, x_max)) {
  422. X          *ex = x;
  423. X          *ey = y_min;
  424. X          return;            /* yes */
  425. X       }
  426. X    }
  427. X    
  428. X    /* does it intersect y_max edge */
  429. X    if (inrange(y_max, ay, by) && y_max != ay && y_max != by) {
  430. X       x = ax + (y_max-ay) * ((bx-ax) / (by-ay));
  431. X       if (inrange(x, x_min, x_max)) {
  432. X          *ex = x;
  433. X          *ey = y_max;
  434. X          return;            /* yes */
  435. X       }
  436. X    }
  437. X
  438. X    /* does it intersect x_min edge */
  439. X    if (inrange(x_min, ax, bx) && x_min != ax && x_min != bx) {
  440. X       y = ay + (x_min-ax) * ((by-ay) / (bx-ax));
  441. X       if (inrange(y, y_min, y_max)) {
  442. X          *ex = x_min;
  443. X          *ey = y;
  444. X          return;
  445. X       }
  446. X    }
  447. X
  448. X    /* does it intersect x_max edge */
  449. X    if (inrange(x_max, ax, bx) && x_max != ax && x_max != bx) {
  450. X       y = ay + (x_max-ax) * ((by-ay) / (bx-ax));
  451. X       if (inrange(y, y_min, y_max)) {
  452. X          *ex = x_max;
  453. X          *ey = y;
  454. X          return;
  455. X       }
  456. X    }
  457. X
  458. X    /* It is possible for one or two of the [ab][xy] values to be -VERYLARGE.
  459. X    * If ax=bx=-VERYLARGE or ay=by=-VERYLARGE we have already returned 
  460. X    * FALSE above. Otherwise we fall through all the tests above. 
  461. X    * If two are -VERYLARGE, it is ax=ay=-VERYLARGE or bx=by=-VERYLARGE 
  462. X    * since either a or b must be INRANGE. 
  463. X    * Note that for ax=ay=-VERYLARGE or bx=by=-VERYLARGE we can do nothing.
  464. X    * Handle them carefully here. As yet we have no way for them to be 
  465. X    * +VERYLARGE.
  466. X    */
  467. X    if (ax == -VERYLARGE) {
  468. X       if (ay != -VERYLARGE) {
  469. X          *ex = min(x_min, x_max);
  470. X          *ey = by;
  471. X          return;
  472. X       }
  473. X    } else if (bx == -VERYLARGE) {
  474. X       if (by != -VERYLARGE) {
  475. X          *ex = min(x_min, x_max);
  476. X          *ey = ay;
  477. X          return;
  478. X       }
  479. X    } else if (ay == -VERYLARGE) {
  480. X       /* note we know ax != -VERYLARGE */
  481. X       *ex = bx;
  482. X       *ey = min(y_min, y_max);
  483. X       return;
  484. X    } else if (by == -VERYLARGE) {
  485. X       /* note we know bx != -VERYLARGE */
  486. X       *ex = ax;
  487. X       *ey = min(y_min, y_max);
  488. X       return;
  489. X    }
  490. X
  491. X    /* If we reach here, then either one point is (-VERYLARGE,-VERYLARGE), 
  492. X    * or the inrange point is on the edge, and
  493. X     * the line segment from the outrange point does not cross any 
  494. X    * other edges to get there. In either case, we return the inrange 
  495. X    * point as the 'edge' intersection point. This will basically draw
  496. X    * line.
  497. X    */
  498. X    if (points[i].type == INRANGE) {
  499. X       *ex = bx; 
  500. X       *ey = by;
  501. X    } else {
  502. X       *ex = ax; 
  503. X       *ey = ay;
  504. X    }
  505. X    return;
  506. }
  507. X
  508. /* double edge intersection algorithm */
  509. /* Given two points, both outside the plot, return
  510. X * the points where an edge of the plot intersects the line segment defined 
  511. X * by the two points. There may be zero, one, two, or an infinite number
  512. X * of intersection points. (One means an intersection at a corner, infinite
  513. X * means overlaying the edge itself). We return FALSE when there is nothing
  514. X * to draw (zero intersections), and TRUE when there is something to 
  515. X * draw (the one-point case is a degenerate of the two-point case and we do 
  516. X * not distinguish it - we draw it anyway).
  517. X */
  518. BOOLEAN                /* any intersection? */
  519. two_edge_intersect(points, i, lx, ly)
  520. X    struct coordinate *points; /* the points array */
  521. X    int i;                /* line segment from point i-1 to point i */
  522. X    double *lx, *ly;        /* lx[2], ly[2]: points where it crosses edges */
  523. {
  524. X    /* global x_min, x_max, y_min, x_max */
  525. X    double ax = points[i-1].x;
  526. X    double ay = points[i-1].y;
  527. X    double bx = points[i].x;
  528. X    double by = points[i].y;
  529. X    double x, y;            /* possible intersection point */
  530. X    BOOLEAN intersect = FALSE;
  531. X
  532. X    if (by == ay) {
  533. X       /* horizontal line */
  534. X       /* y coord must be in range, and line must span both x_min and x_max */
  535. X       /* note that spanning x_min implies spanning x_max */
  536. X       if (inrange(by, y_min, y_max) && inrange(x_min, ax, bx)) {
  537. X          *lx++ = x_min;
  538. X          *ly++ = by;
  539. X          *lx++ = x_max;
  540. X          *ly++ = by;
  541. X          return(TRUE);
  542. X       } else
  543. X        return(FALSE);
  544. X    } else if (bx == ax) {
  545. X       /* vertical line */
  546. X       /* x coord must be in range, and line must span both y_min and y_max */
  547. X       /* note that spanning y_min implies spanning y_max */
  548. X       if (inrange(bx, x_min, x_max) && inrange(y_min, ay, by)) {
  549. X          *lx++ = bx;
  550. X          *ly++ = y_min;
  551. X          *lx++ = bx;
  552. X          *ly++ = y_max;
  553. X          return(TRUE);
  554. X       } else
  555. X        return(FALSE);
  556. X    }
  557. X
  558. X    /* slanted line of some kind */
  559. X    /* there can be only zero or two intersections below */
  560. X
  561. X    /* does it intersect y_min edge */
  562. X    if (inrange(y_min, ay, by)) {
  563. X       x = ax + (y_min-ay) * ((bx-ax) / (by-ay));
  564. X       if (inrange(x, x_min, x_max)) {
  565. X          *lx++ = x;
  566. X          *ly++ = y_min;
  567. X          intersect = TRUE;
  568. X       }
  569. X    }
  570. X    
  571. X    /* does it intersect y_max edge */
  572. X    if (inrange(y_max, ay, by)) {
  573. X       x = ax + (y_max-ay) * ((bx-ax) / (by-ay));
  574. X       if (inrange(x, x_min, x_max)) {
  575. X          *lx++ = x;
  576. X          *ly++ = y_max;
  577. X          intersect = TRUE;
  578. X       }
  579. X    }
  580. X
  581. X    /* does it intersect x_min edge */
  582. X    if (inrange(x_min, ax, bx)) {
  583. X       y = ay + (x_min-ax) * ((by-ay) / (bx-ax));
  584. X       if (inrange(y, y_min, y_max)) {
  585. X          *lx++ = x_min;
  586. X          *ly++ = y;
  587. X          intersect = TRUE;
  588. X       }
  589. X    }
  590. X
  591. X    /* does it intersect x_max edge */
  592. X    if (inrange(x_max, ax, bx)) {
  593. X       y = ay + (x_max-ax) * ((by-ay) / (bx-ax));
  594. X       if (inrange(y, y_min, y_max)) {
  595. X          *lx++ = x_max;
  596. X          *ly++ = y;
  597. X          intersect = TRUE;
  598. X       }
  599. X    }
  600. X
  601. X    if (intersect)
  602. X     return(TRUE);
  603. X
  604. X    /* It is possible for one or more of the [ab][xy] values to be -VERYLARGE.
  605. X    * If ax=bx=-VERYLARGE or ay=by=-VERYLARGE we have already returned
  606. X    * FALSE above.
  607. X    * Note that for ax=ay=-VERYLARGE or bx=by=-VERYLARGE we can do nothing.
  608. X    * Otherwise we fall through all the tests above. 
  609. X    * Handle them carefully here. As yet we have no way for them to be +VERYLARGE.
  610. X    */
  611. X    if (ax == -VERYLARGE) {
  612. X       if (ay != -VERYLARGE
  613. X          && inrange(by, y_min, y_max) && inrange(x_max, ax, bx)) {
  614. X          *lx++ = x_min;
  615. X          *ly = by;
  616. X          *lx++ = x_max;
  617. X          *ly = by;
  618. X          intersect = TRUE;
  619. X       }
  620. X    } else if (bx == -VERYLARGE) {
  621. X       if (by != -VERYLARGE
  622. X          && inrange(ay, y_min, y_max) && inrange(x_max, ax, bx)) {
  623. X          *lx++ = x_min;
  624. X          *ly = ay;
  625. X          *lx++ = x_max;
  626. X          *ly = ay;
  627. X          intersect = TRUE;
  628. X       }
  629. X    } else if (ay == -VERYLARGE) {
  630. X       /* note we know ax != -VERYLARGE */
  631. X       if (inrange(bx, x_min, x_max) && inrange(y_max, ay, by)) {
  632. X          *lx++ = bx;
  633. X          *ly = y_min;
  634. X          *lx++ = bx;
  635. X          *ly = y_max;
  636. X          intersect = TRUE;
  637. X       }
  638. X    } else if (by == -VERYLARGE) {
  639. X       /* note we know bx != -VERYLARGE */
  640. X       if (inrange(ax, x_min, x_max) && inrange(y_max, ay, by)) {
  641. X          *lx++ = ax;
  642. X          *ly = y_min;
  643. X          *lx++ = ax;
  644. X          *ly = y_max;
  645. X          intersect = TRUE;
  646. X       }
  647. X    }
  648. X
  649. X    return(intersect);
  650. }
  651. X
  652. /* Polar transform of all curves */
  653. /* Original code by John Campbell (CAMPBELL@NAUVAX.bitnet) */
  654. polar_xform (plots, pcount)
  655. X    struct curve_points *plots;
  656. X    int pcount;            /* count of curves in plots array */
  657. {
  658. X     struct curve_points *this_plot;
  659. X     int curve;            /* loop var, for curves */
  660. X     register int i, p_cnt;    /* loop/limit var, for points */
  661. X     struct coordinate *pnts;    /* abbrev. for points array */
  662. X    double x, y;            /* new cartesian value */
  663. X    BOOLEAN anydefined = FALSE;
  664. X    double d2r;
  665. X
  666. X    if(angles_format == ANGLES_DEGREES){
  667. X        d2r = DEG2RAD;
  668. X    } else {
  669. X        d2r = 1.0;
  670. X    }
  671. X
  672. /*
  673. X    Cycle through all the plots converting polar to rectangular.
  674. X     If autoscaling, adjust max and mins. Ignore previous values.
  675. X    If not autoscaling, use the yrange for both x and y ranges.
  676. */
  677. X    if (autoscale_ly) {
  678. X        x_min = VERYLARGE;
  679. X        y_min = VERYLARGE;
  680. X        x_max = -VERYLARGE;
  681. X        y_max = -VERYLARGE;
  682. X        autoscale_lx = TRUE;
  683. X    } else {
  684. X        x_min = y_min;
  685. X        x_max = y_max;
  686. X    }
  687. X    
  688. X    this_plot = plots;
  689. X    for (curve = 0; curve < pcount; this_plot = this_plot->next_cp, curve++) {
  690. X        p_cnt = this_plot->p_count;
  691. X        pnts = &(this_plot->points[0]);
  692. X
  693. X    /*    Convert to cartesian all points in this curve. */
  694. X        for (i = 0; i < p_cnt; i++) {
  695. X            if (pnts[i].type != UNDEFINED) {
  696. X                 anydefined = TRUE;
  697. X                 /* modify points to reset origin and from degrees */
  698. X                 pnts[i].y -= rmin;
  699. X                 pnts[i].x *= d2r;
  700. X                 /* convert to cartesian coordinates */
  701. X                x = pnts[i].y*cos(pnts[i].x);
  702. X                y = pnts[i].y*sin(pnts[i].x);
  703. X                pnts[i].x = x;
  704. X                pnts[i].y = y;
  705. X                if (autoscale_ly) {
  706. X                    if (x_min > x) x_min = x;
  707. X                    if (x_max < x) x_max = x;
  708. X                    if (y_min > y) y_min = y;
  709. X                    if (y_max < y) y_max = y;
  710. X                    pnts[i].type = INRANGE;
  711. X                } else if(inrange(x, x_min, x_max) && inrange(y, y_min, y_max))
  712. X                  pnts[i].type = INRANGE;
  713. X                else
  714. X                  pnts[i].type = OUTRANGE;
  715. X            }
  716. X        }    
  717. X    }
  718. X
  719. X    if (autoscale_lx && anydefined && fabs(x_max - x_min) < zero) {
  720. X        /* This happens at least for the plot of 1/cos(x) (vertical line). */
  721. X        fprintf(stderr, "Warning: empty x range [%g:%g], ", x_min,x_max);
  722. X        if (x_min == 0.0) {
  723. X           x_min = -1; 
  724. X           x_max = 1;
  725. X        } else {
  726. X           x_min *= 0.9;
  727. X           x_max *= 1.1;
  728. X        }
  729. X        fprintf(stderr, "adjusting to [%g:%g]\n", x_min,x_max);
  730. X    }
  731. X    if (autoscale_ly && anydefined && fabs(y_max - y_min) < zero) {
  732. X        /* This happens at least for the plot of 1/sin(x) (horiz. line). */
  733. X        fprintf(stderr, "Warning: empty y range [%g:%g], ", y_min, y_max);
  734. X        if (y_min == 0.0) {
  735. X           y_min = -1;
  736. X           y_max = 1;
  737. X        } else {
  738. X           y_min *= 0.9;
  739. X           y_max *= 1.1;
  740. X        }
  741. X        fprintf(stderr, "adjusting to [%g:%g]\n", y_min, y_max);
  742. X    }
  743. }
  744. X
  745. /* DRAW_YTICS: draw a regular tic series, y axis */
  746. draw_ytics(start, incr, end)
  747. X        double start, incr, end; /* tic series definition */
  748. X        /* assume start < end, incr > 0 */
  749. {
  750. X    double ticplace;
  751. X    int ltic;            /* for mini log tics */
  752. X    double lticplace;    /* for mini log tics */
  753. X    double ticmin, ticmax;    /* for checking if tic is almost inrange */
  754. X
  755. X    if (end == VERYLARGE)            /* for user-def series */
  756. X        end = max(y_min,y_max);
  757. X
  758. X    /* limit to right side of plot */
  759. X    end = min(end, max(y_min,y_max));
  760. X
  761. X    /* to allow for rounding errors */
  762. X    ticmin = min(y_min,y_max) - SIGNIF*incr;
  763. X    ticmax = max(y_min,y_max) + SIGNIF*incr;
  764. X    end = end + SIGNIF*incr; 
  765. X
  766. X    for (ticplace = start; ticplace <= end; ticplace +=incr) {
  767. X        if ( inrange(ticplace,ticmin,ticmax) )
  768. X            ytick(ticplace, yformat, incr, 1.0);
  769. X        if (log_y && incr == 1.0) {
  770. X            /* add mini-ticks to log scale ticmarks */
  771. X            int lstart, linc;
  772. X            if ((end - start) >= 10)
  773. X            {
  774. X            lstart = 10; /* No little ticks */
  775. X            linc = 5;
  776. X            }
  777. X            else if((end - start) >= 5)
  778. X            {
  779. X            lstart = 4; /* 3 per decade */
  780. X            linc = 3;
  781. X            }
  782. X            else
  783. X            {
  784. X            lstart = 2; /* 9 per decade */
  785. X            linc = 1;
  786. X            }
  787. X            for (ltic = 2; ltic <= 9; ltic++) {
  788. X                lticplace = ticplace+log10((double)ltic);
  789. X                if ( inrange(lticplace,ticmin,ticmax) )
  790. X                    ytick(lticplace, "\0", incr, 0.5);
  791. X            }
  792. X        }
  793. X    }
  794. }
  795. X
  796. /* DRAW_XTICS: draw a regular tic series, x axis */
  797. draw_xtics(start, incr, end)
  798. X        double start, incr, end; /* tic series definition */
  799. X        /* assume start < end, incr > 0 */
  800. {
  801. X    double ticplace;
  802. X    int ltic;            /* for mini log tics */
  803. X    double lticplace;    /* for mini log tics */
  804. X    double ticmin, ticmax;    /* for checking if tic is almost inrange */
  805. X
  806. X    if (end == VERYLARGE)            /* for user-def series */
  807. X        end = max(x_min,x_max);
  808. X
  809. X    /* limit to right side of plot */
  810. X    end = min(end, max(x_min,x_max));
  811. X
  812. X    /* to allow for rounding errors */
  813. X    ticmin = min(x_min,x_max) - SIGNIF*incr;
  814. X    ticmax = max(x_min,x_max) + SIGNIF*incr;
  815. X    end = end + SIGNIF*incr; 
  816. X
  817. X    for (ticplace = start; ticplace <= end; ticplace +=incr) {
  818. X        if ( inrange(ticplace,ticmin,ticmax) )
  819. X            xtick(ticplace, xformat, incr, 1.0);
  820. X        if (log_x && incr == 1.0) {
  821. X            /* add mini-ticks to log scale ticmarks */
  822. X            int lstart, linc;
  823. X            if ((end - start) >= 10)
  824. X            {
  825. X            lstart = 10; /* No little ticks */
  826. X            linc = 5;
  827. X            }
  828. X            else if((end - start) >= 5)
  829. X            {
  830. X            lstart = 4; /* 3 per decade */
  831. X            linc = 3;
  832. X            }
  833. X            else
  834. X            {
  835. X            lstart = 2; /* 9 per decade */
  836. X            linc = 1;
  837. X            }
  838. X            for (ltic = lstart; ltic <= 9; ltic += linc) {
  839. X                lticplace = ticplace+log10((double)ltic);
  840. X                if ( inrange(lticplace,ticmin,ticmax) )
  841. X                    xtick(lticplace, "\0", incr, 0.5);
  842. X            }
  843. X        }
  844. X    }
  845. }
  846. X
  847. /* DRAW_SERIES_YTICS: draw a user tic series, y axis */
  848. draw_series_ytics(start, incr, end)
  849. X        double start, incr, end; /* tic series definition */
  850. X        /* assume start < end, incr > 0 */
  851. {
  852. X    double ticplace, place;
  853. X    double ticmin, ticmax;    /* for checking if tic is almost inrange */
  854. X    double spacing = log_y ? log10(incr) : incr;
  855. X
  856. X    if (end == VERYLARGE)
  857. X        end = max(CheckLog(log_y, y_min), CheckLog(log_y, y_max));
  858. X    else
  859. X      /* limit to right side of plot */
  860. X      end = min(end, max(CheckLog(log_y, y_min), CheckLog(log_y, y_max)));
  861. X
  862. X    /* to allow for rounding errors */
  863. X    ticmin = min(y_min,y_max) - SIGNIF*incr;
  864. X    ticmax = max(y_min,y_max) + SIGNIF*incr;
  865. X    end = end + SIGNIF*incr; 
  866. X
  867. X    for (ticplace = start; ticplace <= end; ticplace +=incr) {
  868. X        place = (log_y ? log10(ticplace) : ticplace);
  869. X        if ( inrange(place,ticmin,ticmax) )
  870. X         ytick(place, yformat, spacing, 1.0);
  871. X    }
  872. }
  873. X
  874. X
  875. /* DRAW_SERIES_XTICS: draw a user tic series, x axis */
  876. draw_series_xtics(start, incr, end)
  877. X        double start, incr, end; /* tic series definition */
  878. X        /* assume start < end, incr > 0 */
  879. {
  880. X    double ticplace, place;
  881. X    double ticmin, ticmax;    /* for checking if tic is almost inrange */
  882. X    double spacing = log_x ? log10(incr) : incr;
  883. X
  884. X    if (end == VERYLARGE)
  885. X        end = max(CheckLog(log_x, x_min), CheckLog(log_x, x_max));
  886. X    else
  887. X      /* limit to right side of plot */
  888. X      end = min(end, max(CheckLog(log_x, x_min), CheckLog(log_x, x_max)));
  889. X
  890. X    /* to allow for rounding errors */
  891. X    ticmin = min(x_min,x_max) - SIGNIF*incr;
  892. X    ticmax = max(x_min,x_max) + SIGNIF*incr;
  893. X    end = end + SIGNIF*incr; 
  894. X
  895. X    for (ticplace = start; ticplace <= end; ticplace +=incr) {
  896. X        place = (log_x ? log10(ticplace) : ticplace);
  897. X        if ( inrange(place,ticmin,ticmax) )
  898. X         xtick(place, xformat, spacing, 1.0);
  899. X    }
  900. }
  901. X
  902. /* DRAW_SET_YTICS: draw a user tic set, y axis */
  903. draw_set_ytics(list)
  904. X    struct ticmark *list;    /* list of tic marks */
  905. {
  906. X    double ticplace;
  907. X    double incr = (y_max - y_min) / 10;
  908. X    /* global x_min, x_max, xscale, y_min, y_max, yscale */
  909. X
  910. X    while (list != NULL) {
  911. X       ticplace = (log_y ? log10(list->position) : list->position);
  912. X       if ( inrange(ticplace, y_min, y_max)         /* in range */
  913. X          || NearlyEqual(ticplace, y_min, incr)    /* == y_min */
  914. X          || NearlyEqual(ticplace, y_max, incr))    /* == y_max */
  915. X        ytick(ticplace, list->label, incr, 1.0);
  916. X
  917. X       list = list->next;
  918. X    }
  919. }
  920. X
  921. /* DRAW_SET_XTICS: draw a user tic set, x axis */
  922. draw_set_xtics(list)
  923. X    struct ticmark *list;    /* list of tic marks */
  924. {
  925. X    double ticplace;
  926. X    double incr = (x_max - x_min) / 10;
  927. X    /* global x_min, x_max, xscale, y_min, y_max, yscale */
  928. X
  929. X    while (list != NULL) {
  930. X       ticplace = (log_x ? log10(list->position) : list->position);
  931. X       if ( inrange(ticplace, x_min, x_max)         /* in range */
  932. X          || NearlyEqual(ticplace, x_min, incr)    /* == x_min */
  933. X          || NearlyEqual(ticplace, x_max, incr))    /* == x_max */
  934. X        xtick(ticplace, list->label, incr, 1.0);
  935. X
  936. X       list = list->next;
  937. X    }
  938. }
  939. X
  940. /* draw and label a y-axis ticmark */
  941. ytick(place, text, spacing, ticscale)
  942. X        double place;                   /* where on axis to put it */
  943. X        char *text;                     /* optional text label */
  944. X        double spacing;         /* something to use with checkzero */
  945. X        double ticscale;         /* scale factor for tic mark (0..1] */
  946. {
  947. X    register struct termentry *t = &term_tbl[term];
  948. X    char ticlabel[101];
  949. X    int ticsize = (int)((t->h_tic) * ticscale);
  950. X
  951. X    place = CheckZero(place,spacing); /* to fix rounding error near zero */
  952. X    if (grid) {
  953. X           (*t->linetype)(-1);  /* axis line type */
  954. X           /* do not put a rectangular grid on a polar plot */
  955. X       if( !polar){
  956. X         (*t->move)(xleft, map_y(place));
  957. X         (*t->vector)(xright, map_y(place));
  958. X           }
  959. X       (*t->linetype)(-2); /* border linetype */
  960. X    }
  961. X    if (tic_in) {
  962. X      /* if polar plot, put the tics along the axes */
  963. X      if( polar){
  964. X           (*t->move)(map_x(ZERO),map_y(place));
  965. X           (*t->vector)(map_x(ZERO) + ticsize, map_y(place));
  966. X           (*t->move)(map_x(ZERO), map_y(place));
  967. X           (*t->vector)(map_x(ZERO) - ticsize, map_y(place));
  968. X     } else {
  969. X       (*t->move)(xleft, map_y(place));
  970. X           (*t->vector)(xleft + ticsize, map_y(place));
  971. X           (*t->move)(xright, map_y(place));
  972. X           (*t->vector)(xright - ticsize, map_y(place));
  973. X     }
  974. X    } else {
  975. X      if( polar){
  976. X           (*t->move)(map_x(ZERO), map_y(place));
  977. X           (*t->vector)(map_x(ZERO) - ticsize, map_y(place));
  978. X     }else{
  979. X           (*t->move)(xleft, map_y(place));
  980. X           (*t->vector)(xleft - ticsize, map_y(place));
  981. X     }
  982. X    }
  983. X
  984. X    /* label the ticmark */
  985. X    if (text == NULL) 
  986. X     text = yformat;
  987. X    
  988. X    if( polar){
  989. X      (void) sprintf(ticlabel, text, CheckLog(log_y,fabs( place)+rmin));
  990. X      if ((*t->justify_text)(RIGHT)) {
  991. X       (*t->put_text)(map_x(ZERO)-(t->h_char),
  992. X                   map_y(place), ticlabel);
  993. X     } else {
  994. X       (*t->put_text)(map_x(ZERO)-(t->h_char)*(strlen(ticlabel)+1),
  995. X                   map_y(place), ticlabel);
  996. X     }
  997. X    } else {
  998. X    
  999. X      (void) sprintf(ticlabel, text, CheckLog(log_y, place));
  1000. X      if ((*t->justify_text)(RIGHT)) {
  1001. X       (*t->put_text)(xleft-(t->h_char),
  1002. X                   map_y(place), ticlabel);
  1003. X     } else {
  1004. X       (*t->put_text)(xleft-(t->h_char)*(strlen(ticlabel)+1),
  1005. X                   map_y(place), ticlabel);
  1006. X     }
  1007. X    }
  1008. }
  1009. X
  1010. /* draw and label an x-axis ticmark */
  1011. xtick(place, text, spacing, ticscale)
  1012. X        double place;                   /* where on axis to put it */
  1013. X        char *text;                     /* optional text label */
  1014. X        double spacing;         /* something to use with checkzero */
  1015. X        double ticscale;         /* scale factor for tic mark (0..1] */
  1016. {
  1017. X    register struct termentry *t = &term_tbl[term];
  1018. X    char ticlabel[101];
  1019. X    int ticsize = (int)((t->v_tic) * ticscale);
  1020. X
  1021. X    place = CheckZero(place,spacing); /* to fix rounding error near zero */
  1022. X    if (grid) {
  1023. X           (*t->linetype)(-1);  /* axis line type */
  1024. X           if( !polar){
  1025. X         (*t->move)(map_x(place), ybot);
  1026. X         (*t->vector)(map_x(place), ytop);
  1027. X           }
  1028. X       (*t->linetype)(-2); /* border linetype */
  1029. X    }
  1030. X    if (tic_in) {
  1031. X      if( polar){
  1032. X           (*t->move)(map_x(place), map_y(ZERO));
  1033. X           (*t->vector)(map_x(place), map_y(ZERO) + ticsize);
  1034. X           (*t->move)(map_x(place), map_y(ZERO));
  1035. X           (*t->vector)(map_x(place), map_y(ZERO) - ticsize);
  1036. X     } else{
  1037. X           (*t->move)(map_x(place), ybot);
  1038. X           (*t->vector)(map_x(place), ybot + ticsize);
  1039. X           (*t->move)(map_x(place), ytop);
  1040. X           (*t->vector)(map_x(place), ytop - ticsize);
  1041. X     }
  1042. X    } else {
  1043. X      if( polar){
  1044. X           (*t->move)(map_x(place), map_y(ZERO));
  1045. X           (*t->vector)(map_x(place), map_y(ZERO) - ticsize);
  1046. X     }else{
  1047. X           (*t->move)(map_x(place), ybot);
  1048. X           (*t->vector)(map_x(place), ybot - ticsize);
  1049. X     }
  1050. X    }
  1051. X    
  1052. X    /* label the ticmark */
  1053. X    if (text == NULL)
  1054. X     text = xformat;
  1055. X
  1056. X    if(polar){
  1057. X      (void) sprintf(ticlabel, text, CheckLog(log_x, fabs(place)+rmin));
  1058. X      if ((*t->justify_text)(CENTRE)) {
  1059. X       (*t->put_text)(map_x(place),
  1060. X                   map_y(ZERO)-(t->v_char), ticlabel);
  1061. X     } else {
  1062. X       (*t->put_text)(map_x(place)-(t->h_char)*strlen(ticlabel)/2,
  1063. X                   map_y(ZERO)-(t->v_char), ticlabel);
  1064. X     }
  1065. X    }else{
  1066. X
  1067. X      (void) sprintf(ticlabel, text, CheckLog(log_x, place));
  1068. X      if ((*t->justify_text)(CENTRE)) {
  1069. X       (*t->put_text)(map_x(place),
  1070. X                   ybot-(t->v_char), ticlabel);
  1071. X     } else {
  1072. X       (*t->put_text)(map_x(place)-(t->h_char)*strlen(ticlabel)/2,
  1073. X                   ybot-(t->v_char), ticlabel);
  1074. X     }
  1075. X    }
  1076. }
  1077. SHAR_EOF
  1078. echo 'File gnuplot/graphics.c is complete' &&
  1079. chmod 0644 gnuplot/graphics.c ||
  1080. echo 'restore of gnuplot/graphics.c failed'
  1081. Wc_c="`wc -c < 'gnuplot/graphics.c'`"
  1082. test 42004 -eq "$Wc_c" ||
  1083.     echo 'gnuplot/graphics.c: original size 42004, current size' "$Wc_c"
  1084. rm -f _shar_wnt_.tmp
  1085. fi
  1086. # ============= gnuplot/makefile.ami ==============
  1087. if test -f 'gnuplot/makefile.ami' -a X"$1" != X"-c"; then
  1088.     echo 'x - skipping gnuplot/makefile.ami (File already exists)'
  1089.     rm -f _shar_wnt_.tmp
  1090. else
  1091. > _shar_wnt_.tmp
  1092. echo 'x - extracting gnuplot/makefile.ami (Text)'
  1093. sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/makefile.ami' &&
  1094. #
  1095. #   Makefile for the Amiga             Pat R. Empleo
  1096. #                                      Sept 1991
  1097. #      Manx Aztec C 5.2 beta version
  1098. #
  1099. #   Usage:
  1100. #
  1101. #      make -f makefile.ami
  1102. #
  1103. #
  1104. X
  1105. # where to install help file gnuplot.gih
  1106. HELPDEST=GNUPLOT:docs/gnuplot.gih
  1107. # Where to send email about bugs and comments (locally)
  1108. EMAIL="pixar\!bug-gnuplot@sun.com"
  1109. X
  1110. #
  1111. # Manx Aztec C v5.2 compiler options
  1112. #
  1113. # -DVFORK  We use this switch to invoke fexecv()
  1114. #
  1115. CC     = cc
  1116. CFLAGS = -DVFORK -DNOGAMMA -DMEMSET -DMEMCPY -DAMIGA_AC_5 -fa -sab -wosw -MR
  1117. X
  1118. #
  1119. # Manx Aztec C v5.2 linker options
  1120. #
  1121. LD   = ln
  1122. LIBS = -lma -lc
  1123. X
  1124. #
  1125. # Terminal (device) support --- see term.h
  1126. #
  1127. TERMFLAGS = -Iterm
  1128. X
  1129. #
  1130. # List of object files except term.o, version.o
  1131. #
  1132. OBJS = bitmap.o command.o contour.o eval.o graphics.o graph3d.o help.o \
  1133. X       internal.o misc.o parse.o plot.o scanner.o \
  1134. X       setshow.o standard.o util.o  
  1135. X
  1136. #
  1137. # List of sources
  1138. #
  1139. CSOURCE1 = command.c setshow.c 
  1140. CSOURCE2 = help.c graphics.c graph3d.c internal.c 
  1141. CSOURCE3 = misc.c eval.c parse.c plot.c readline.c scanner.c standard.c 
  1142. CSOURCE4 = bitmap.c term.c util.c version.c
  1143. CSOURCE5 = term/amiga.trm term/aed.trm term/cgi.trm term/dumb.trm term/dxf.trm \
  1144. X    term/dxy.trm term/eepic.trm term/epson.trm term/fig.trm \
  1145. X    term/hp26.trm term/hp2648.trm term/hpgl.trm term/hpljii.trm \
  1146. X    term/apollo.trm term/gpr.trm
  1147. CSOURCE6 = term/impcodes.h term/imagen.trm term/object.h \
  1148. X    term/iris4d.trm term/kyo.trm term/latex.trm term/pc.trm 
  1149. CSOURCE7 = term/post.trm term/qms.trm term/regis.trm term/sun.trm \
  1150. X    term/t410x.trm term/tek.trm term/unixpc.trm term/unixplot.trm \
  1151. X    term/v384.trm term/x11.trm term/bigfig.trm term/vws.trm gnuplot_x11.c
  1152. CSOURCE8 = contour.c
  1153. X
  1154. #
  1155. # Docs
  1156. #
  1157. DOCS1 = docs/Makefile docs/README docs/checkdoc.c docs/doc2gih.c \
  1158. X    docs/doc2hlp.c docs/doc2hlp.com docs/doc2ms.c docs/doc2tex.c \
  1159. X    docs/gnuplot.1 docs/lasergnu.1 docs/toc_entry.sty \
  1160. X    docs/titlepage.ms docs/titlepage.tex
  1161. DOCS2 = docs/gnuplot.doc
  1162. DOCS3 = docs/latextut/Makefile docs/latextut/eg1.plt \
  1163. X    docs/latextut/eg2.plt docs/latextut/eg3.dat docs/latextut/eg3.plt \
  1164. X    docs/latextut/eg4.plt docs/latextut/eg5.plt docs/latextut/eg6.plt \
  1165. X    docs/latextut/header.tex docs/latextut/tutorial.tex \
  1166. X    docs/latextut/linepoint.plt
  1167. X
  1168. #
  1169. # Targets
  1170. #
  1171. X
  1172. default: gnuplot doc
  1173. X
  1174. gnuplot: $(OBJS) term.o version.o
  1175. X    $(LD) $(OBJS) term.o version.o $(LIBS) -o gnuplot
  1176. X
  1177. doc:
  1178. X    cd docs
  1179. X    make -f makefile.ami gih
  1180. X
  1181. #
  1182. # Dependencies
  1183. #
  1184. plot.o: plot.c
  1185. X    $(CC) $(CFLAGS) plot.c
  1186. X
  1187. term.o: term.h term.c $(CSOURCE5) $(CSOURCE6) $(CSOURCE7)
  1188. X    $(CC) $(CFLAGS) $(TERMFLAGS) term.c
  1189. X
  1190. version.o:
  1191. X    $(CC) $(CFLAGS) -DCONTACT=$(EMAIL) version.c
  1192. X
  1193. $(OBJS): plot.h
  1194. X    $(CC) $(CFLAGS) $*.c
  1195. X
  1196. command.o:
  1197. X    $(CC) $(CFLAGS) -c command.c -DHELPFILE="$(HELPDEST)"
  1198. X
  1199. command.o help.o misc.o: help.h
  1200. X
  1201. command.o graphics.o graph3d.o misc.o plot.o setshow.o term.o: setshow.h
  1202. X
  1203. bitmap.o term.o: bitmap.h
  1204. X
  1205. #
  1206. # misc
  1207. #
  1208. clean:
  1209. X    delete #?.o
  1210. X
  1211. veryclean: spotless
  1212. X
  1213. spotless:
  1214. X    delete #?.o gnuplot
  1215. X
  1216. SHAR_EOF
  1217. chmod 0644 gnuplot/makefile.ami ||
  1218. echo 'restore of gnuplot/makefile.ami failed'
  1219. Wc_c="`wc -c < 'gnuplot/makefile.ami'`"
  1220. test 2916 -eq "$Wc_c" ||
  1221.     echo 'gnuplot/makefile.ami: original size 2916, current size' "$Wc_c"
  1222. rm -f _shar_wnt_.tmp
  1223. fi
  1224. # ============= gnuplot/term.h ==============
  1225. if test -f 'gnuplot/term.h' -a X"$1" != X"-c"; then
  1226.     echo 'x - skipping gnuplot/term.h (File already exists)'
  1227.     rm -f _shar_wnt_.tmp
  1228. else
  1229. > _shar_wnt_.tmp
  1230. echo 'x - extracting gnuplot/term.h (Text)'
  1231. sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/term.h' &&
  1232. /* GNUPLOT - term.h */
  1233. /*
  1234. X * Copyright (C) 1986, 1987, 1990, 1991   Thomas Williams, Colin Kelley
  1235. X *
  1236. X * Permission to use, copy, and distribute this software and its
  1237. X * documentation for any purpose with or without fee is hereby granted, 
  1238. X * provided that the above copyright notice appear in all copies and 
  1239. X * that both that copyright notice and this permission notice appear 
  1240. X * in supporting documentation.
  1241. X *
  1242. X * Permission to modify the software is granted, but not the right to
  1243. X * distribute the modified code.  Modifications are to be distributed 
  1244. X * as patches to released version.
  1245. X *  
  1246. X * This software is provided "as is" without express or implied warranty.
  1247. X * 
  1248. X *
  1249. X * AUTHORS
  1250. X * 
  1251. X *   Original Software:
  1252. X *     Thomas Williams,  Colin Kelley.
  1253. X * 
  1254. X *   Gnuplot 2.0 additions:
  1255. X *       Russell Lang, Dave Kotz, John Campbell.
  1256. X *
  1257. X *   Gnuplot 3.0 additions:
  1258. X *       Gershon Elber and many others.
  1259. X * 
  1260. X * Send your comments or suggestions to 
  1261. X *  pixar!info-gnuplot@sun.com.
  1262. X * This is a mailing list; to join it send a note to 
  1263. X *  pixar!info-gnuplot-request@sun.com.  
  1264. X * Send bug reports to
  1265. X *  pixar!bug-gnuplot@sun.com.
  1266. X */
  1267. X
  1268. /*
  1269. X * term.h: terminal support definitions
  1270. X *   Edit this file depending on the set of terminals you wish to support.
  1271. X * Comment out the terminal types that you don't want or don't have, and
  1272. X * uncomment those that you want included. Be aware that some terminal 
  1273. X * types (eg, SUN, UNIXPLOT) will require changes in the makefile 
  1274. X * LIBS definition. 
  1275. X */
  1276. X
  1277. /* These terminals are not relevant for MSDOS */
  1278. #ifndef MSDOS
  1279. X
  1280. #ifdef AMIGA_LC_5_1
  1281. #define AMIGASCREEN    /* Amiga custom screen */
  1282. X
  1283. #else /* AMIGA_LC_5_1 */
  1284. X
  1285. #ifdef AMIGA_AC_5
  1286. #define AMIGASCREEN    /* Amiga custom screen */
  1287. #endif
  1288. #define AED        /* AED 512 and AED 767 */
  1289. #define BITGRAPH    /* BBN BitGraph */
  1290. /* #define CGI        /* SCO CGI */
  1291. /* #define IRIS4D    /* IRIS4D series computer */
  1292. #define KERMIT        /* MS-Kermit Tektronix 4010 emulator */
  1293. #define FIG           /* Fig graphics language */
  1294. #define REGIS        /* ReGis graphics (vt125, vt220, vt240, Gigis...) */
  1295. #define SELANAR        /* Selanar */
  1296. /* #define SUN        /* Sun Microsystems Workstation */
  1297. #define T410X        /* Tektronix 4106, 4107, 4109 and 420x terminals */
  1298. #define TEK        /* Tektronix 4010, and probably others */
  1299. /* #define UNIXPC    /* unixpc (ATT 3b1 or ATT 7300) */
  1300. /* #define UNIXPLOT    /* unixplot */
  1301. #define VTTEK        /* VT-like tek40xx emulators */
  1302. /* #define X11        /* X11R4 window system */
  1303. X
  1304. #endif /* AMIGA_LC_5_1 */
  1305. X
  1306. #define DXY800A        /* Roland DXY800A plotter */
  1307. X
  1308. #define HP2648        /* HP2648, HP2647 */
  1309. #define HP26        /* HP2623A and maybe others */
  1310. #define HP75        /* HP7580, and probably other HPs */
  1311. #define IMAGEN      /* Imagen laser printers (300dpi) (requires -Iterm also) */
  1312. X
  1313. #define NEC        /* NEC CP6 pinwriter printer */
  1314. #define PRESCRIBE    /* Kyocera Laser printer */
  1315. #define QMS        /* QMS/QUIC laserprinter (Talaris 1200 and others) */
  1316. #define STARC        /* Star Color Printer */
  1317. #define TANDY60        /* Tandy DMP-130 series 60-dot per inch graphics */
  1318. #define V384        /* Vectrix 384 and tandy color printer */
  1319. X
  1320. #endif /* MSDOS */
  1321. X
  1322. /* These terminals can be used on any system */
  1323. #define DUMB
  1324. X
  1325. #define HPGL        /* HP7475, HP7220 plotters, and (hopefully) lots of others */
  1326. X
  1327. #define POSTSCRIPT    /* Postscript */
  1328. X
  1329. /* #define DXF        /* DXF format for use with AutoCad (Release 10.x) */
  1330. X
  1331. #define EEPIC        /* EEPIC-extended LaTeX driver, for EEPIC users */
  1332. #define EMTEX        /* LATEX picture environment with EMTEX specials */
  1333. #define EPS60        /* Epson-style 60-dot per inch printers */
  1334. #define EPSONP        /* Epson LX-800, Star NL-10, NX-1000 and lots of others */
  1335. #define HPLJII        /* HP LaserJet II */
  1336. #define LATEX        /* LATEX picture environment */
  1337. X
  1338. /* These are for MSDOS only */
  1339. #ifdef MSDOS
  1340. #ifdef __TURBOC__
  1341. #define ATT6300        /* AT&T 6300 graphics */
  1342. #else
  1343. #define ATT6300        /* AT&T 6300 graphics */
  1344. #define CORONA        /* Corona graphics 325 */
  1345. #define HERCULES    /* IBM PC/Clone with Hercules graphics board */
  1346. #endif /* __TURBOC__ */
  1347. #endif /* MSDOS */
  1348. X
  1349. SHAR_EOF
  1350. chmod 0644 gnuplot/term.h ||
  1351. echo 'restore of gnuplot/term.h failed'
  1352. Wc_c="`wc -c < 'gnuplot/term.h'`"
  1353. test 3953 -eq "$Wc_c" ||
  1354.     echo 'gnuplot/term.h: original size 3953, current size' "$Wc_c"
  1355. rm -f _shar_wnt_.tmp
  1356. fi
  1357. rm -f _shar_seq_.tmp
  1358. echo You have unpacked the last part
  1359. exit 0
  1360.  
  1361. exit 0 # Just in case...
  1362. -- 
  1363. Kent Landfield                   INTERNET: kent@sparky.IMD.Sterling.COM
  1364. Sterling Software, IMD           UUCP:     uunet!sparky!kent
  1365. Phone:    (402) 291-8300         FAX:      (402) 291-4362
  1366. Please send comp.sources.misc-related mail to kent@uunet.uu.net.
  1367.