home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / misc / volume40 / gnuplot / part13 < prev    next >
Encoding:
Text File  |  1993-10-22  |  80.9 KB  |  2,528 lines

  1. Newsgroups: comp.sources.misc
  2. From: woo@playfair.stanford.edu ("Alexander Woo")
  3. Subject: v40i025:  gnuplot - interactive function plotting utility, Part13/33
  4. Message-ID: <1993Oct22.163418.23803@sparky.sterling.com>
  5. X-Md4-Signature: a74ba26ab2d1318ef1e21218d2aabb4c
  6. Sender: kent@sparky.sterling.com (Kent Landfield)
  7. Organization: Sterling Software
  8. Date: Fri, 22 Oct 1993 16:34:18 GMT
  9. Approved: kent@sparky.sterling.com
  10.  
  11. Submitted-by: woo@playfair.stanford.edu ("Alexander Woo")
  12. Posting-number: Volume 40, Issue 25
  13. Archive-name: gnuplot/part13
  14. Environment: UNIX, MS-DOS, VMS
  15. Supersedes: gnuplot3: Volume 24, Issue 23-48
  16.  
  17. #! /bin/sh
  18. # This is a shell archive.  Remove anything before this line, then feed it
  19. # into a shell via "sh file" or similar.  To overwrite existing files,
  20. # type "sh file -c".
  21. # Contents:  gnuplot/demo/random.dem gnuplot/graph3d.c.A
  22. #   gnuplot/makefile.unx
  23. # Wrapped by kent@sparky on Wed Oct 20 17:14:47 1993
  24. PATH=/bin:/usr/bin:/usr/ucb:/usr/local/bin:/usr/lbin ; export PATH
  25. echo If this archive is complete, you will see the following message:
  26. echo '          "shar: End of archive 13 (of 33)."'
  27. if test -f 'gnuplot/demo/random.dem' -a "${1}" != "-c" ; then 
  28.   echo shar: Will not clobber existing file \"'gnuplot/demo/random.dem'\"
  29. else
  30.   echo shar: Extracting \"'gnuplot/demo/random.dem'\" \(913 characters\)
  31.   sed "s/^X//" >'gnuplot/demo/random.dem' <<'END_OF_FILE'
  32. X#
  33. X# $Id: random.demo 3.38.2.32 1992/12/04 18:33:59 woo Exp $
  34. X#
  35. X# random.dem
  36. X#
  37. X# Lattice test for random numbers;
  38. X# If you can see any patterns in this plot, the random number generator
  39. X# is not very good.
  40. X#
  41. X# Permission granted to distribute freely for non-commercial purposes only
  42. X#
  43. X# Copyright (c) 1991, Jos van der Woude, jvdwoude@hut.nl
  44. Xsave set "defaults.ini"
  45. Xseed = 1317
  46. Xseed = rand(seed)
  47. Xset nokey
  48. Xset xrange [0: 1]
  49. Xset yrange [0: 1]
  50. Xset zrange [0: 1]
  51. Xset title "Lattice test for random numbers"
  52. Xset xlabel "rand(n) ->"
  53. Xset ylabel "rand(n + 1) ->"
  54. Xset zlabel "rand(n + 2) ->"
  55. Xset format x "%3.2f"
  56. Xset format y "%3.2f"
  57. Xset format z "%3.2f"
  58. Xset tics
  59. Xset sample 1000
  60. Xset function style dots
  61. Xset parametric
  62. Xplot rand(1), rand(1)
  63. Xpause -1 "Hit return to continue"
  64. Xpause 0 "3D plot ahead, one moment please ..."
  65. Xset sample 50
  66. Xsplot rand(1), rand(1), rand(1)
  67. Xpause -1 "Hit return to continue"
  68. Xload "defaults.ini"
  69. END_OF_FILE
  70.   if test 913 -ne `wc -c <'gnuplot/demo/random.dem'`; then
  71.     echo shar: \"'gnuplot/demo/random.dem'\" unpacked with wrong size!
  72.   fi
  73.   # end of 'gnuplot/demo/random.dem'
  74. fi
  75. if test -f 'gnuplot/graph3d.c.A' -a "${1}" != "-c" ; then 
  76.   echo shar: Will not clobber existing file \"'gnuplot/graph3d.c.A'\"
  77. else
  78.   echo shar: Extracting \"'gnuplot/graph3d.c.A'\" \(42442 characters\)
  79.   sed "s/^X//" >'gnuplot/graph3d.c.A' <<'END_OF_FILE'
  80. X#ifndef lint
  81. Xstatic char *RCSid = "$Id: graph3d.c%v 3.50.1.9 1993/08/05 05:38:59 woo Exp $";
  82. X#endif
  83. X
  84. X
  85. X/* GNUPLOT - graph3d.c */
  86. X/*
  87. X * Copyright (C) 1986 - 1993   Thomas Williams, Colin Kelley
  88. X *
  89. X * Permission to use, copy, and distribute this software and its
  90. X * documentation for any purpose with or without fee is hereby granted, 
  91. X * provided that the above copyright notice appear in all copies and 
  92. X * that both that copyright notice and this permission notice appear 
  93. X * in supporting documentation.
  94. X *
  95. X * Permission to modify the software is granted, but not the right to
  96. X * distribute the modified code.  Modifications are to be distributed 
  97. X * as patches to released version.
  98. X *
  99. X * This software is provided "as is" without express or implied warranty.
  100. X *
  101. X *
  102. X * AUTHORS
  103. X *
  104. X *   Original Software:
  105. X *       Gershon Elber and many others.
  106. X *
  107. X * 19 September 1992  Lawrence Crowl  (crowl@cs.orst.edu)
  108. X * Added user-specified bases for log scaling.
  109. X *
  110. X * There is a mailing list for gnuplot users. Note, however, that the
  111. X * newsgroup 
  112. X *    comp.graphics.gnuplot 
  113. X * is identical to the mailing list (they
  114. X * both carry the same set of messages). We prefer that you read the
  115. X * messages through that newsgroup, to subscribing to the mailing list.
  116. X * (If you can read that newsgroup, and are already on the mailing list,
  117. X * please send a message info-gnuplot-request@dartmouth.edu, asking to be
  118. X * removed from the mailing list.)
  119. X *
  120. X * The address for mailing to list members is
  121. X *       info-gnuplot@dartmouth.edu
  122. X * and for mailing administrative requests is 
  123. X *       info-gnuplot-request@dartmouth.edu
  124. X * The mailing list for bug reports is 
  125. X *       bug-gnuplot@dartmouth.edu
  126. X * The list of those interested in beta-test versions is
  127. X *       info-gnuplot-beta@dartmouth.edu
  128. X */
  129. X
  130. X#include <stdio.h>
  131. X#include <math.h>
  132. X#include <assert.h>
  133. X#if !defined(u3b2)
  134. X#include <time.h>
  135. X#endif
  136. X#if !defined(sequent) && !defined(apollo) && !defined(alliant)
  137. X#include <limits.h>
  138. X#endif
  139. X#include "plot.h"
  140. X#include "setshow.h"
  141. X
  142. X#if defined(DJGPP)||defined(sun386)
  143. X#define time_t unsigned long
  144. X#endif
  145. X
  146. X#if defined(apollo) || defined(sequent) || defined(u3b2) || defined(alliant) || defined(sun386)
  147. X#include <sys/types.h> /* typedef long time_t; */
  148. X#endif
  149. X
  150. Xint suppressMove = 0;  /* for preventing moveto while drawing contours */
  151. X#ifndef AMIGA_SC_6_1
  152. Xextern char *strcpy(),*strncpy(),*strcat(),*ctime(),*tdate;
  153. X#else /* AMIGA_SC_6_1 */
  154. Xextern char *tdate;
  155. X#endif /* AMIGA_SC_6_1 */
  156. X#ifdef AMIGA_AC_5
  157. Xextern time_t dated;
  158. X#else
  159. Xextern time_t dated; /* ,time(); */
  160. X#include <time.h>
  161. X#endif
  162. X
  163. X#ifdef __TURBOC__
  164. X#include <stdlib.h>        /* for qsort */
  165. X#endif
  166. X
  167. X/*
  168. X * hidden_line_type_above, hidden_line_type_below - controls type of lines
  169. X *   for above and below parts of the surface.
  170. X * hidden_no_update - if TRUE lines will be hidden line removed but they
  171. X *   are not assumed to be part of the surface (i.e. grid) and therefore
  172. X *   do not influence the hidings.
  173. X * hidden_active - TRUE if hidden lines are to be removed.
  174. X */
  175. Xstatic int hidden_active = FALSE;
  176. X
  177. X/* LITE defines a restricted memory version for MS-DOS */
  178. X
  179. X#ifndef LITE
  180. X
  181. Xstatic int hidden_line_type_above, hidden_line_type_below, hidden_no_update;
  182. X
  183. X/* We divvy up the figure into the component boxes that make it up, and then
  184. X   sort them by the z-value (which is really just an average value).  */
  185. Xstruct pnts{
  186. X  int x,y,z;
  187. X  int flag;
  188. X  long int style_used;    /* acw test */
  189. X  int nplot;
  190. X};
  191. Xstatic int * boxlist;
  192. Xstatic struct pnts * nodes;
  193. X/* These variables are used to keep track of the range of x values used in the
  194. Xline drawing routine.  */
  195. Xstatic long int xmin_hl,xmax_hl;
  196. X/* These arrays are used to keep track of the minimum and maximum y values used
  197. X   for each X value.  These are only used for drawing the individual boxes that
  198. X   make up the 3d figure.  After each box is drawn, the information is copied
  199. X   to the bitmap. */
  200. Xstatic short int *ymin_hl, *ymax_hl;
  201. X/*
  202. X * These numbers are chosen as dividers into the bitmap.
  203. X */
  204. Xstatic short int xfact, yfact;
  205. X#define XREDUCE(X) ((X)/xfact)
  206. X#define YREDUCE(Y) ((Y)/yfact)
  207. X/* Bitmap of the screen.  The array for each x value is malloc-ed as needed */
  208. Xstatic short int **pnt;
  209. X#define IFSET(X,Y) (pnt[X] == 0 ? 0 : (((pnt[X])[(Y)>>4] >> ((Y) & 0xf)) & 0x01))
  210. Xstatic plot3d_hidden();
  211. X
  212. X#endif /* LITE */
  213. X
  214. X
  215. Xstatic plot3d_impulses();
  216. Xstatic plot3d_lines();
  217. Xstatic plot3d_points();
  218. Xstatic plot3d_dots();
  219. Xstatic cntr3d_impulses();
  220. Xstatic cntr3d_lines();
  221. Xstatic cntr3d_points();
  222. Xstatic cntr3d_dots();
  223. Xstatic update_extrema_pts();
  224. Xstatic draw_parametric_grid();
  225. Xstatic draw_non_param_grid();
  226. Xstatic draw_bottom_grid();
  227. Xstatic draw_3dxtics();
  228. Xstatic draw_3dytics();
  229. Xstatic draw_3dztics();
  230. Xstatic draw_series_3dxtics();
  231. Xstatic draw_series_3dytics();
  232. Xstatic draw_series_3dztics();
  233. Xstatic draw_set_3dxtics();
  234. Xstatic draw_set_3dytics();
  235. Xstatic draw_set_3dztics();
  236. Xstatic xtick();
  237. Xstatic ytick();
  238. Xstatic ztick();
  239. Xstatic setlinestyle();
  240. X#ifdef __PUREC__
  241. X/* a little problem with the 16bit int size of PureC. this completely broke
  242. X   the hidded3d feature. doesn't really fix it, but I'm working at it.  (AL) */
  243. Xstatic int clip_point(int x, int y);
  244. Xstatic void clip_put_text(int x, int y, char *str);
  245. X#endif
  246. X
  247. X#ifndef max        /* Lattice C has max() in math.h, but shouldn't! */
  248. X#define max(a,b) ((a > b) ? a : b)
  249. X#endif
  250. X
  251. X#ifndef min
  252. X#define min(a,b) ((a < b) ? a : b)
  253. X#endif
  254. X
  255. X#define inrange(z,min,max) ((min<max) ? ((z>=min)&&(z<=max)) : ((z>=max)&&(z<=min)) )
  256. X
  257. X#define apx_eq(x,y) (fabs(x-y) < 0.001)
  258. X#ifndef abs
  259. X#define abs(x) ((x) >= 0 ? (x) : -(x))
  260. X#endif
  261. X#define sqr(x) ((x) * (x))
  262. X
  263. X/* Define the boundary of the plot
  264. X * These are computed at each call to do_plot, and are constant over
  265. X * the period of one do_plot. They actually only change when the term
  266. X * type changes and when the 'set size' factors change. 
  267. X */
  268. Xstatic int xleft, xright, ybot, ytop, xmiddle, ymiddle, xscaler, yscaler;
  269. X
  270. X/* Boundary and scale factors, in user coordinates */
  271. X/* x_min3d, x_max3d, y_min3d, y_max3d, z_min3d, z_max3d are local to this
  272. X * file and are not the same as variables of the same names in other files
  273. X */
  274. Xstatic double x_min3d, x_max3d, y_min3d, y_max3d, z_min3d, z_max3d;
  275. Xstatic double xscale3d, yscale3d, zscale3d;
  276. Xstatic double real_z_min3d, real_z_max3d;
  277. Xstatic double min_sy_ox,min_sy_oy; /* obj. coords. for xy tics placement. */
  278. Xstatic double min_sx_ox,min_sx_oy; /* obj. coords. for z tics placement. */
  279. X
  280. Xtypedef double transform_matrix[4][4];
  281. Xstatic transform_matrix trans_mat;
  282. X
  283. X/* (DFK) Watch for cancellation error near zero on axes labels */
  284. X#define SIGNIF (0.01)        /* less than one hundredth of a tic mark */
  285. X#define CheckZero(x,tic) (fabs(x) < ((tic) * SIGNIF) ? 0.0 : (x))
  286. X#define NearlyEqual(x,y,tic) (fabs((x)-(y)) < ((tic) * SIGNIF))
  287. X
  288. X/* And the functions to map from user to terminal coordinates */
  289. X#define map_x(x) (int)(x+0.5) /* maps floating point x to screen */ 
  290. X#define map_y(y) (int)(y+0.5)    /* same for y */
  291. X
  292. X/* And the functions to map from user 3D space into normalized -1..1 */
  293. X#define map_x3d(x) ((x-x_min3d)*xscale3d-1.0)
  294. X#define map_y3d(y) ((y-y_min3d)*yscale3d-1.0)
  295. X#define map_z3d(z) ((z-z_min3d)*zscale3d-1.0)
  296. X
  297. Xstatic mat_unit(mat)
  298. Xtransform_matrix mat;
  299. X{
  300. X    int i, j;
  301. X
  302. X    for (i = 0; i < 4; i++) for (j = 0; j < 4; j++)
  303. X    if (i == j)
  304. X        mat[i][j] = 1.0;
  305. X    else
  306. X        mat[i][j] = 0.0;
  307. X}
  308. X
  309. Xstatic mat_trans(tx, ty, tz, mat)
  310. Xdouble tx, ty, tz;
  311. Xtransform_matrix mat;
  312. X{
  313. X     mat_unit(mat);                                 /* Make it unit matrix. */
  314. X     mat[3][0] = tx;
  315. X     mat[3][1] = ty;
  316. X     mat[3][2] = tz;
  317. X}
  318. X
  319. Xstatic mat_scale(sx, sy, sz, mat)
  320. Xdouble sx, sy, sz;
  321. Xtransform_matrix mat;
  322. X{
  323. X     mat_unit(mat);                                 /* Make it unit matrix. */
  324. X     mat[0][0] = sx;
  325. X     mat[1][1] = sy;
  326. X     mat[2][2] = sz;
  327. X}
  328. X
  329. Xstatic mat_rot_x(teta, mat)
  330. Xdouble teta;
  331. Xtransform_matrix mat;
  332. X{
  333. X    double cos_teta, sin_teta;
  334. X
  335. X    teta *= Pi / 180.0;
  336. X    cos_teta = cos(teta);
  337. X    sin_teta = sin(teta);
  338. X
  339. X    mat_unit(mat);                                  /* Make it unit matrix. */
  340. X    mat[1][1] = cos_teta;
  341. X    mat[1][2] = -sin_teta;
  342. X    mat[2][1] = sin_teta;
  343. X    mat[2][2] = cos_teta;
  344. X}
  345. X
  346. Xstatic mat_rot_y(teta, mat)
  347. Xdouble teta;
  348. Xtransform_matrix mat;
  349. X{
  350. X    double cos_teta, sin_teta;
  351. X
  352. X    teta *= Pi / 180.0;
  353. X    cos_teta = cos(teta);
  354. X    sin_teta = sin(teta);
  355. X
  356. X    mat_unit(mat);                                  /* Make it unit matrix. */
  357. X    mat[0][0] = cos_teta;
  358. X    mat[0][2] = -sin_teta;
  359. X    mat[2][0] = sin_teta;
  360. X    mat[2][2] = cos_teta;
  361. X}
  362. X
  363. Xstatic mat_rot_z(teta, mat)
  364. Xdouble teta;
  365. Xtransform_matrix mat;
  366. X{
  367. X    double cos_teta, sin_teta;
  368. X
  369. X    teta *= Pi / 180.0;
  370. X    cos_teta = cos(teta);
  371. X    sin_teta = sin(teta);
  372. X
  373. X    mat_unit(mat);                                  /* Make it unit matrix. */
  374. X    mat[0][0] = cos_teta;
  375. X    mat[0][1] = -sin_teta;
  376. X    mat[1][0] = sin_teta;
  377. X    mat[1][1] = cos_teta;
  378. X}
  379. X
  380. X/* Multiply two transform_matrix. Result can be one of two operands. */
  381. Xvoid mat_mult(mat_res, mat1, mat2)
  382. Xtransform_matrix mat_res, mat1, mat2;
  383. X{
  384. X    int i, j, k;
  385. X    transform_matrix mat_res_temp;
  386. X
  387. X    for (i = 0; i < 4; i++) for (j = 0; j < 4; j++) {
  388. X        mat_res_temp[i][j] = 0;
  389. X        for (k = 0; k < 4; k++) mat_res_temp[i][j] += mat1[i][k] * mat2[k][j];
  390. X    }
  391. X    for (i = 0; i < 4; i++) for (j = 0; j < 4; j++)
  392. X    mat_res[i][j] = mat_res_temp[i][j];
  393. X}
  394. X
  395. X/* And the functions to map from user 3D space to terminal coordinates */
  396. Xstatic int map3d_xy(x, y, z, xt, yt)
  397. Xdouble x, y, z;
  398. Xint *xt, *yt;
  399. X{
  400. X    int i,j;
  401. X    double v[4], res[4],             /* Homogeneous coords. vectors. */
  402. X    w = trans_mat[3][3];
  403. X
  404. X    v[0] = map_x3d(x); /* Normalize object space to -1..1 */
  405. X    v[1] = map_y3d(y);
  406. X    v[2] = map_z3d(z);
  407. X    v[3] = 1.0;
  408. X
  409. X    for (i = 0; i < 2; i++) {                 /* Dont use the third axes (z). */
  410. X        res[i] = trans_mat[3][i];     /* Initiate it with the weight factor. */
  411. X        for (j = 0; j < 3; j++) res[i] += v[j] * trans_mat[j][i];
  412. X    }
  413. X
  414. X    for (i = 0; i < 3; i++) w += v[i] * trans_mat[i][3];
  415. X    if (w == 0) w = 1e-5;
  416. X
  417. X    *xt = ((int) (res[0] * xscaler / w)) + xmiddle;
  418. X    *yt = ((int) (res[1] * yscaler / w)) + ymiddle;
  419. X}
  420. X
  421. X/* And the functions to map from user 3D space to terminal z coordinate */
  422. Xstatic int map3d_z(x, y, z)
  423. Xdouble x, y, z;
  424. X{
  425. X    int i, zt;
  426. X    double v[4], res,                 /* Homogeneous coords. vectors. */
  427. X    w = trans_mat[3][3];
  428. X
  429. X    v[0] = map_x3d(x); /* Normalize object space to -1..1 */
  430. X    v[1] = map_y3d(y);
  431. X    v[2] = map_z3d(z);
  432. X    v[3] = 1.0;
  433. X
  434. X    res = trans_mat[3][2];               /* Initiate it with the weight factor. */
  435. X    for (i = 0; i < 3; i++) res += v[i] * trans_mat[i][2];
  436. X    if(w==0) w= 1e-5;
  437. X    for (i = 0; i < 3; i++) w += v[i] * trans_mat[i][3];
  438. X    zt = ((int) (res * 16384 / w));
  439. X    return  zt;
  440. X}
  441. X
  442. X/* Initialize the line style using the current device and set hidden styles  */
  443. X/* to it as well if hidden line removal is enabled.                 */
  444. Xstatic setlinestyle(style)
  445. Xint style;
  446. X{
  447. X    register struct termentry *t = &term_tbl[term];
  448. X
  449. X    (*t->linetype)(style);
  450. X
  451. X#ifndef LITE
  452. X    if (hidden3d) {
  453. X    hidden_line_type_above = style;
  454. X    hidden_line_type_below = style;
  455. X    }
  456. X#endif  /* LITE */
  457. X}
  458. X
  459. X#ifndef LITE
  460. X/* Initialize the necessary steps for hidden line removal. */
  461. Xstatic void init_hidden_line_removal()
  462. X{
  463. X  int i;
  464. X  /*  We want to keep the bitmap size less than 2048x2048, so we choose
  465. X   *  integer dividers for the x and y coordinates to keep the x and y
  466. X   *  ranges less than 2048.  In practice, the x and y sizes for the bitmap
  467. X   *  will be somewhere between 1024 and 2048, except in cases where the
  468. X   *  coordinates ranges for the device are already less than 1024.
  469. X   *  We do this mainly to control the size of the bitmap, but it also
  470. X   *  speeds up the computation.  We maintain separate dividers for
  471. X   *  x and y.
  472. X   */
  473. X  xfact = (xright-xleft)/1024;
  474. X  yfact = (ytop-ybot)/1024;
  475. X  if(xfact == 0) xfact=1;
  476. X  if(yfact == 0) yfact=1;
  477. X  if(pnt == 0){
  478. X    i = sizeof(short int*)*(XREDUCE(xright) - XREDUCE(xleft) + 1);
  479. X    pnt = (short int **) alloc((unsigned long)i, "hidden");
  480. X    bzero(pnt,i);
  481. X  };
  482. X  ymin_hl = (short int *) alloc((unsigned long)sizeof(short int)*
  483. X                (XREDUCE(xright) - XREDUCE(xleft) + 1), "hidden");
  484. X  ymax_hl = (short int *) alloc((unsigned long)sizeof(short int)*
  485. X                (XREDUCE(xright) - XREDUCE(xleft) + 1), "hidden");
  486. X}
  487. X
  488. X/* Reset the hidden line data to a fresh start.                     */
  489. Xstatic void reset_hidden_line_removal()
  490. X{
  491. X    int i;
  492. X    if(pnt){
  493. X      for(i=0;i<=XREDUCE(xright)-XREDUCE(xleft);i++) {
  494. X    if(pnt[i])
  495. X      { free(pnt[i]); pnt[i] = 0;};
  496. X      };
  497. X    };
  498. X}
  499. X
  500. X/* Terminates the hidden line removal process. Free any memory allocated by  */
  501. X/* init_hidden_line_removal above.                         */
  502. Xstatic void term_hidden_line_removal()
  503. X{
  504. X     if(pnt){
  505. X       int j;
  506. X       for(j=0;j<=XREDUCE(xright)-XREDUCE(xleft);j++) {
  507. X     if(pnt[j])
  508. X       { free(pnt[j]); pnt[j] = 0;};
  509. X       };
  510. X       free(pnt);
  511. X       pnt = 0;
  512. X     };
  513. X   free(ymin_hl);
  514. X   free(ymax_hl);
  515. X}
  516. X#endif /* not LITE */
  517. X
  518. X/* Test a single point to be within the xleft,xright,ybot,ytop bbox.
  519. X * Sets the returned integers 4 l.s.b. as follows:
  520. X * bit 0 if to the left of xleft.
  521. X * bit 1 if to the right of xright.
  522. X * bit 2 if above of ytop.
  523. X * bit 3 if below of ybot.
  524. X * 0 is returned if inside.
  525. X */
  526. Xstatic int clip_point(x, y)
  527. Xint x, y;
  528. X{
  529. X    int ret_val = 0;
  530. X
  531. X    if (x < xleft) ret_val |= 0x01;
  532. X    if (x > xright) ret_val |= 0x02;
  533. X    if (y < ybot) ret_val |= 0x04;
  534. X    if (y > ytop) ret_val |= 0x08;
  535. X
  536. X    return ret_val;
  537. X}
  538. X
  539. X
  540. X/* Clip the given line to drawing coords defined as xleft,xright,ybot,ytop.
  541. X *   This routine uses the cohen & sutherland bit mapping for fast clipping -
  542. X * see "Principles of Interactive Computer Graphics" Newman & Sproull page 65.
  543. X */
  544. Xstatic void draw_clip_line(x1, y1, x2, y2)
  545. Xint x1, y1, x2, y2;
  546. X{
  547. X    int x, y, dx, dy, x_intr[2], y_intr[2], count, pos1, pos2;
  548. X    register struct termentry *t = &term_tbl[term];
  549. X
  550. X    pos1 = clip_point(x1, y1);
  551. X    pos2 = clip_point(x2, y2);
  552. X    if (pos1 || pos2) {
  553. X    if (pos1 & pos2) return;          /* segment is totally out. */
  554. X
  555. X    /* Here part of the segment MAY be inside. test the intersection
  556. X     * of this segment with the 4 boundaries for hopefully 2 intersections
  557. X     * in. If non found segment is totaly out.
  558. X     */
  559. X    count = 0;
  560. X    dx = x2 - x1;
  561. X    dy = y2 - y1;
  562. X
  563. X    /* Find intersections with the x parallel bbox lines: */
  564. X    if (dy != 0) {
  565. X        x = (ybot - y2) * dx / dy + x2;        /* Test for ybot boundary. */
  566. X        if (x >= xleft && x <= xright) {
  567. X        x_intr[count] = x;
  568. X        y_intr[count++] = ybot;
  569. X        }
  570. X        x = (ytop - y2) * dx / dy + x2;        /* Test for ytop boundary. */
  571. X        if (x >= xleft && x <= xright) {
  572. X        x_intr[count] = x;
  573. X        y_intr[count++] = ytop;
  574. X        }
  575. X    }
  576. X
  577. X    /* Find intersections with the y parallel bbox lines: */
  578. X    if (dx != 0) {
  579. X        y = (xleft - x2) * dy / dx + y2;      /* Test for xleft boundary. */
  580. X        if (y >= ybot && y <= ytop) {
  581. X        x_intr[count] = xleft;
  582. X        y_intr[count++] = y;
  583. X        }
  584. X        y = (xright - x2) * dy / dx + y2;    /* Test for xright boundary. */
  585. X        if (y >= ybot && y <= ytop) {
  586. X        x_intr[count] = xright;
  587. X        y_intr[count++] = y;
  588. X        }
  589. X    }
  590. X
  591. X    if (count == 2) {
  592. X        int x_max, x_min, y_max, y_min;
  593. X
  594. X        x_min = min(x1, x2);
  595. X        x_max = max(x1, x2);
  596. X        y_min = min(y1, y2);
  597. X        y_max = max(y1, y2);
  598. X
  599. X        if (pos1 && pos2) {               /* Both were out - update both */
  600. X        x1 = x_intr[0];
  601. X        y1 = y_intr[0];
  602. X        x2 = x_intr[1];
  603. X        y2 = y_intr[1];
  604. X        }
  605. X        else if (pos1) {           /* Only x1/y1 was out - update only it */
  606. X        if (dx * (x2 - x_intr[0]) + dy * (y2 - y_intr[0]) > 0) {
  607. X            x1 = x_intr[0];
  608. X            y1 = y_intr[0];
  609. X        }
  610. X        else {
  611. X            x1 = x_intr[1];
  612. X            y1 = y_intr[1];
  613. X        }
  614. X        }
  615. X        else {                      /* Only x2/y2 was out - update only it */
  616. X        if (dx * (x_intr[0] - x1) + dy * (y_intr[0] - x1) > 0) {
  617. X            x2 = x_intr[0];
  618. X            y2 = y_intr[0];
  619. X        }
  620. X        else {
  621. X            x2 = x_intr[1];
  622. X            y2 = y_intr[1];
  623. X        }
  624. X        }
  625. X
  626. X        if (x1 < x_min || x1 > x_max ||
  627. X        x2 < x_min || x2 > x_max ||
  628. X        y1 < y_min || y1 > y_max ||
  629. X        y2 < y_min || y2 > y_max) return;
  630. X    }
  631. X    else
  632. X        return;
  633. X    }
  634. X
  635. X#ifndef LITE
  636. X    if(hidden3d && draw_surface)
  637. X      {
  638. X    char flag;
  639. X    register int xv, yv, errx, erry, err;
  640. X    register int xvr, yvr;
  641. X    int xve, yve;
  642. X    register int dy, nstep, dyr;
  643. X    int i;
  644. X    if (x1 > x2){
  645. X      xvr = x2;
  646. X      yvr = y2;
  647. X      xve = x1;
  648. X      yve = y1;
  649. X    } else {
  650. X      xvr = x1;
  651. X      yvr = y1;
  652. X      xve = x2;
  653. X      yve = y2;
  654. X    };
  655. X    errx = XREDUCE(xve) - XREDUCE(xvr);
  656. X    erry = YREDUCE(yve) - YREDUCE(yvr);
  657. X    dy = (erry > 0 ? 1 : -1);
  658. X    dyr = dy*yfact;
  659. X    switch (dy){
  660. X    case 1:
  661. X      nstep = errx + erry;
  662. X      errx = -errx;
  663. X      break;
  664. X    case -1:
  665. X      nstep = errx - erry;
  666. X      errx = -errx;
  667. X      erry = -erry;
  668. X      break;
  669. X    };
  670. X    err = errx + erry;
  671. X    errx <<= 1;
  672. X    erry <<= 1;
  673. X    xv = XREDUCE(xvr) - XREDUCE(xleft);
  674. X    yv = YREDUCE(yvr) - YREDUCE(ybot);
  675. X    (*t->move)(xvr,yvr);
  676. X    if( !IFSET(xv,yv) ) flag = 0;
  677. X    else flag = 1;
  678. X    if(!hidden_no_update){ /* Check first point */
  679. X      if (xv < xmin_hl) xmin_hl = xv;
  680. X      if (xv > xmax_hl) xmax_hl = xv;
  681. X      if (yv > ymax_hl[xv]) ymax_hl[xv] = yv;
  682. X      if (yv < ymin_hl[xv]) ymin_hl[xv] = yv;
  683. X    };
  684. X    for (i=0;i<nstep;i++){
  685. X      if (err < 0){
  686. X        xv ++;
  687. X        xvr += xfact;
  688. X        err += erry;
  689. X      } else {
  690. X        yv += dy;
  691. X        yvr += dyr;
  692. X        err += errx;
  693. X      };
  694. X      if( !IFSET(xv,yv)){
  695. X        if(flag != 0) {(*t->move)(xvr,yvr); flag = 0;};
  696. X      } else {
  697. X        if(flag == 0) {(*t->vector)(xvr,yvr); flag = 1;};
  698. X      };
  699. X      if(!hidden_no_update){
  700. X        if (xv < xmin_hl) xmin_hl = xv;
  701. X        if (xv > xmax_hl) xmax_hl = xv;
  702. X        if (yv > ymax_hl[xv]) ymax_hl[xv] = yv;
  703. X        if (yv < ymin_hl[xv]) ymin_hl[xv] = yv;
  704. X      };
  705. X    };
  706. X    if (flag == 0) (*t->vector)(xve, yve);
  707. X    return;
  708. X      };
  709. X#endif /* not LITE */
  710. X    if(!suppressMove) (*t->move)(x1,y1);
  711. X    (*t->vector)(x2,y2);
  712. X}
  713. X
  714. X/* Two routine to emulate move/vector sequence using line drawing routine. */
  715. Xstatic int move_pos_x, move_pos_y;
  716. X
  717. Xstatic void clip_move(x,y)
  718. Xint x,y;
  719. X{
  720. X    move_pos_x = x;
  721. X    move_pos_y = y;
  722. X}
  723. X
  724. Xstatic void clip_vector(x,y)
  725. Xint x,y;
  726. X{
  727. X    draw_clip_line(move_pos_x,move_pos_y, x, y);
  728. X    move_pos_x = x;
  729. X    move_pos_y = y;
  730. X}
  731. X
  732. X/* And text clipping routine. */
  733. Xstatic void clip_put_text(x, y, str)
  734. Xint x,y;
  735. Xchar *str;
  736. X{
  737. X    register struct termentry *t = &term_tbl[term];
  738. X
  739. X    if (clip_point(x, y)) return;
  740. X
  741. X    (*t->put_text)(x,y,str);
  742. X}
  743. X
  744. X/* (DFK) For some reason, the Sun386i compiler screws up with the CheckLog 
  745. X * macro, so I write it as a function on that machine.
  746. X */
  747. X#ifndef sun386
  748. X/* (DFK) Use 10^x if logscale is in effect, else x */
  749. X#define CheckLog(is_log, base_log, x) ((is_log) ? pow(base_log, (x)) : (x))
  750. X#else
  751. Xstatic double
  752. XCheckLog(is_log, base_log, x)
  753. X     TBOOLEAN is_log;
  754. X     double base_log;
  755. X     double x;
  756. X{
  757. X  if (is_log)
  758. X    return(pow(base_log, x));
  759. X  else
  760. X    return(x);
  761. X}
  762. X#endif /* sun386 */
  763. X
  764. Xstatic double
  765. XLogScale(coord, is_log, log_base_log, what, axis)
  766. X    double coord;            /* the value */
  767. X    TBOOLEAN is_log;            /* is this axis in logscale? */
  768. X    double log_base_log;        /* if so, the log of its base */
  769. X    char *what;            /* what is the coord for? */
  770. X    char *axis;            /* which axis is this for ("x" or "y")? */
  771. X{
  772. X    if (is_log) {
  773. X       if (coord <= 0.0) {
  774. X          char errbuf[100];        /* place to write error message */
  775. X        (void) sprintf(errbuf,"%s has %s coord of %g; must be above 0 for log scale!",
  776. X                what, axis, coord);
  777. X          (*term_tbl[term].text)();
  778. X          (void) fflush(outfile);
  779. X          int_error(errbuf, NO_CARET);
  780. X       } else
  781. X        return(log(coord)/log_base_log);
  782. X    }
  783. X    return(coord);
  784. X}
  785. X
  786. X/* borders of plotting area */
  787. X/* computed once on every call to do_plot */
  788. Xstatic boundary3d(scaling)
  789. X    TBOOLEAN scaling;        /* TRUE if terminal is doing the scaling */
  790. X{
  791. X    register struct termentry *t = &term_tbl[term];
  792. X    /* luecken@udel.edu modifications
  793. X       sizes the plot to take up more of available resolution */
  794. X    xleft = (t->h_char)*2 + (t->h_tic);
  795. X    xright = (scaling ? 1 : xsize) * (t->xmax) - (t->h_char)*2 - (t->h_tic);
  796. X    ybot = (t->v_char)*5/2 + 1;
  797. X    ytop = (scaling ? 1 : ysize) * (t->ymax) - (t->v_char)*5/2 - 1;
  798. X    xmiddle = (xright + xleft) / 2;
  799. X    ymiddle = (ytop + ybot) / 2;
  800. X    xscaler = (xright - xleft) * 4 / 7;
  801. X    yscaler = (ytop - ybot) * 4 / 7;
  802. X}
  803. X
  804. Xstatic double dbl_raise(x,y)
  805. Xdouble x;
  806. Xint y;
  807. X{
  808. Xregister int i;
  809. Xdouble val;
  810. X
  811. X    val = 1.0;
  812. X    for (i=0; i < abs(y); i++)
  813. X        val *= x;
  814. X    if (y < 0 ) return (1.0/val);
  815. X    return(val);
  816. X}
  817. X
  818. X
  819. Xstatic double make_3dtics(tmin,tmax,axis,logscale, base_log)
  820. Xdouble tmin,tmax;
  821. Xint axis;
  822. XTBOOLEAN logscale;
  823. Xdouble base_log;
  824. X{
  825. Xint x1,y1,x2,y2;
  826. Xregister double xr,xnorm,tics,tic,l10;
  827. X
  828. X    xr = fabs(tmin-tmax);
  829. X
  830. X    /* Compute length of axis in screen space coords. */
  831. X    switch (axis) {
  832. X        case 'x':
  833. X            map3d_xy(tmin,0.0,0.0,&x1,&y1);
  834. X            map3d_xy(tmax,0.0,0.0,&x2,&y2);
  835. X            break;
  836. X        case 'y':
  837. X            map3d_xy(0.0,tmin,0.0,&x1,&y1);
  838. X            map3d_xy(0.0,tmax,0.0,&x2,&y2);
  839. X            break;
  840. X        case 'z':
  841. X            map3d_xy(0.0,0.0,tmin,&x1,&y1);
  842. X            map3d_xy(0.0,0.0,tmax,&x2,&y2);
  843. X            break;
  844. X    }
  845. X
  846. X    if (((long) (x1-x2))*(x1-x2) + ((long) (y1-y2))*(y1-y2) <
  847. X        sqr(3L * term_tbl[term].h_char))
  848. X        return -1.0;                              /* No tics! */
  849. X
  850. X    l10 = log10(xr);
  851. X    if (logscale) {
  852. X        tic = dbl_raise(base_log,(l10 >= 0.0 ) ? (int)l10 : ((int)l10-1));
  853. X        if (tic < 1.0)
  854. X            tic = 1.0;
  855. X    } else {
  856. X        xnorm = pow(10.0,l10-(double)((l10 >= 0.0 ) ? (int)l10 : ((int)l10-1)));
  857. X        if (xnorm <= 5)
  858. X            tics = 0.5;
  859. X        else tics = 1.0;
  860. X        tic = tics * dbl_raise(10.0,(l10 >= 0.0 ) ? (int)l10 : ((int)l10-1));
  861. X    }
  862. X    return(tic);
  863. X}
  864. X
  865. Xdo_3dplot(plots, pcount, min_x, max_x, min_y, max_y, min_z, max_z)
  866. Xstruct surface_points *plots;
  867. Xint pcount;            /* count of plots in linked list */
  868. Xdouble min_x, max_x;
  869. Xdouble min_y, max_y;
  870. Xdouble min_z, max_z;
  871. X{
  872. Xregister struct termentry *t = &term_tbl[term];
  873. Xregister int surface;
  874. Xregister struct surface_points *this_plot;
  875. Xint xl, yl, linetypeOffset = 0;
  876. X            /* only a Pyramid would have this many registers! */
  877. Xdouble xtemp, ytemp, ztemp, temp;
  878. Xstruct text_label *this_label;
  879. Xstruct arrow_def *this_arrow;
  880. XTBOOLEAN scaling;
  881. Xtransform_matrix mat;
  882. X
  883. X/* Initiate transformation matrix using the global view variables. */
  884. X    mat_rot_z(surface_rot_z, trans_mat);
  885. X    mat_rot_x(surface_rot_x, mat);
  886. X    mat_mult(trans_mat, trans_mat, mat);
  887. X    mat_scale(surface_scale / 2.0, surface_scale / 2.0, surface_scale / 2.0, mat);
  888. X    mat_mult(trans_mat, trans_mat, mat);
  889. X
  890. X/* modify min_z/max_z so it will zscale properly. */
  891. X    ztemp = (max_z - min_z) / (2.0 * surface_zscale);
  892. X    temp = (max_z + min_z) / 2.0;
  893. X    min_z = temp - ztemp;
  894. X    max_z = temp + ztemp;
  895. X
  896. X/* store these in variables global to this file */
  897. X/* otherwise, we have to pass them around a lot */
  898. X    x_min3d = min_x;
  899. X    x_max3d = max_x;
  900. X    y_min3d = min_y;
  901. X    y_max3d = max_y;
  902. X    z_min3d = min_z;
  903. X    z_max3d = max_z;
  904. X
  905. X    /* The extrema need to be set even when a surface is not being
  906. X     * drawn.   Without this, gnuplot used to assume that the X and
  907. X     * Y axis started at zero.   -RKC
  908. X     */
  909. X
  910. X    /* find (bottom) left corner of grid */
  911. X    min_sx_ox = min_x;
  912. X    min_sx_oy = min_y;
  913. X    /* find bottom (right) corner of grid */
  914. X    min_sy_ox = max_x;
  915. X    min_sy_oy = min_y;
  916. X
  917. X
  918. X    if (polar)
  919. X    int_error("Cannot splot in polar coordinate system.", NO_CARET);
  920. X
  921. X    if (z_min3d == VERYLARGE || z_max3d == -VERYLARGE ||
  922. X    x_min3d == VERYLARGE || x_max3d == -VERYLARGE ||
  923. X    y_min3d == VERYLARGE || y_max3d == -VERYLARGE)
  924. X        int_error("all points undefined!", NO_CARET);
  925. X
  926. X    /* If we are to draw the bottom grid make sure zmin is updated properly. */
  927. X    if (xtics || ytics || grid)
  928. X    z_min3d -= (max_z - min_z) * ticslevel;
  929. X
  930. X/*  This used be x_max3d == x_min3d, but that caused an infinite loop once. */
  931. X    if (fabs(x_max3d - x_min3d) < zero)
  932. X    int_error("x_min3d should not equal x_max3d!",NO_CARET);
  933. X    if (fabs(y_max3d - y_min3d) < zero)
  934. X    int_error("y_min3d should not equal y_max3d!",NO_CARET);
  935. X    if (fabs(z_max3d - z_min3d) < zero)
  936. X    int_error("z_min3d should not equal z_max3d!",NO_CARET);
  937. X
  938. X#ifndef LITE
  939. X    if (hidden3d) {
  940. X    struct surface_points *plot;
  941. X  
  942. X        /* Verify data is hidden line removable - grid based. */
  943. X          for (plot = plots; plot != NULL; plot = plot->next_sp) {
  944. X         if (plot->plot_type == DATA3D && !plot->has_grid_topology){
  945. X          fprintf(stderr,"Notice: Cannot remove hidden lines from non grid data\n");
  946. X              return(0);
  947. X            }
  948. X    
  949. X        }
  950. X    }
  951. X#endif /* not LITE */
  952. X
  953. X/* INITIALIZE TERMINAL */
  954. X    if (!term_init) {
  955. X    (*t->init)();
  956. X    term_init = TRUE;
  957. X    }
  958. X    screen_ok = FALSE;
  959. X    scaling = (*t->scale)(xsize, ysize);
  960. X    (*t->graphics)();
  961. X
  962. X    /* now compute boundary for plot (xleft, xright, ytop, ybot) */
  963. X    boundary3d(scaling);
  964. X
  965. X/* SCALE FACTORS */
  966. X    zscale3d = 2.0/(z_max3d - z_min3d);
  967. X    yscale3d = 2.0/(y_max3d - y_min3d);
  968. X    xscale3d = 2.0/(x_max3d - x_min3d);
  969. X
  970. X    (*t->linetype)(-2); /* border linetype */
  971. X
  972. X/* PLACE TITLE */
  973. X    if (*title != 0) {
  974. X        int x, y;
  975. X
  976. X        x = title_xoffset * t->h_char;
  977. X        y = title_yoffset * t->v_char;
  978. X
  979. X        if ((*t->justify_text)(CENTRE)) 
  980. X            (*t->put_text)(x+(xleft+xright)/2, 
  981. X                       y+ytop+(t->v_char), title);
  982. X        else
  983. X            (*t->put_text)(x+(xleft+xright)/2 - strlen(title)*(t->h_char)/2,
  984. X                       y+ytop+(t->v_char), title);
  985. X    }
  986. X
  987. X/* PLACE TIMEDATE */
  988. X    if (timedate) {
  989. X        int x, y;
  990. X
  991. X        x = time_xoffset * t->h_char;
  992. X        y = time_yoffset * t->v_char;
  993. X        dated = time( (time_t *) 0);
  994. X        tdate = ctime( &dated);
  995. X        tdate[24]='\0';
  996. X        if ((*t->text_angle)(1)) {
  997. X            if ((*t->justify_text)(CENTRE)) {
  998. X                (*t->put_text)(x+(t->v_char),
  999. X                         y+ybot+4*(t->v_char), tdate);
  1000. X            }
  1001. X            else {
  1002. X                (*t->put_text)(x+(t->v_char),
  1003. X                         y+ybot+4*(t->v_char)-(t->h_char)*strlen(ylabel)/2, 
  1004. X                         tdate);
  1005. X            }
  1006. X        }
  1007. X        else {
  1008. X            (void)(*t->justify_text)(LEFT);
  1009. X            (*t->put_text)(x,
  1010. X                         y+ybot-1*(t->v_char), tdate);
  1011. X        }
  1012. X        (void)(*t->text_angle)(0);
  1013. X    }
  1014. X
  1015. X/* PLACE LABELS */
  1016. X    for (this_label = first_label; this_label!=NULL;
  1017. X            this_label=this_label->next ) {
  1018. X        int x,y;
  1019. X
  1020. X        xtemp = LogScale(this_label->x, is_log_x, log_base_log_x, "label", "x");
  1021. X        ytemp = LogScale(this_label->y, is_log_y, log_base_log_y, "label", "y");
  1022. X        ztemp = LogScale(this_label->z, is_log_z, log_base_log_z, "label", "z");
  1023. X            map3d_xy(xtemp,ytemp,ztemp, &x, &y);
  1024. X
  1025. X        if ((*t->justify_text)(this_label->pos)) {
  1026. X            (*t->put_text)(x,y,this_label->text);
  1027. X        }
  1028. X        else {
  1029. X            switch(this_label->pos) {
  1030. X                case  LEFT:
  1031. X                    (*t->put_text)(x,y,this_label->text);
  1032. X                    break;
  1033. X                case CENTRE:
  1034. X                    (*t->put_text)(x -
  1035. X                        (t->h_char)*strlen(this_label->text)/2,
  1036. X                        y, this_label->text);
  1037. X                    break;
  1038. X                case RIGHT:
  1039. X                    (*t->put_text)(x -
  1040. X                        (t->h_char)*strlen(this_label->text),
  1041. X                        y, this_label->text);
  1042. X                    break;
  1043. X            }
  1044. X         }
  1045. X     }
  1046. X
  1047. X/* PLACE ARROWS */
  1048. X    (*t->linetype)(0);    /* arrow line type */
  1049. X    for (this_arrow = first_arrow; this_arrow!=NULL;
  1050. X        this_arrow = this_arrow->next ) {
  1051. X    int sx,sy,ex,ey;
  1052. X
  1053. X    xtemp = LogScale(this_arrow->sx, is_log_x, log_base_log_x, "arrow", "x");
  1054. X    ytemp = LogScale(this_arrow->sy, is_log_y, log_base_log_y, "arrow", "y");
  1055. X    ztemp = LogScale(this_arrow->sz, is_log_z, log_base_log_z, "arrow", "z");
  1056. X    map3d_xy(xtemp,ytemp,ztemp, &sx, &sy);
  1057. X
  1058. X    xtemp = LogScale(this_arrow->ex, is_log_x, log_base_log_x, "arrow", "x");
  1059. X    ytemp = LogScale(this_arrow->ey, is_log_y, log_base_log_y, "arrow", "y");
  1060. X    ztemp = LogScale(this_arrow->ez, is_log_z, log_base_log_z, "arrow", "z");
  1061. X    map3d_xy(xtemp,ytemp,ztemp, &ex, &ey);
  1062. X
  1063. X    (*t->arrow)(sx, sy, ex, ey, this_arrow->head);
  1064. X    }
  1065. X
  1066. X#ifndef LITE
  1067. X    if (hidden3d && draw_surface) {
  1068. X    init_hidden_line_removal();
  1069. X    reset_hidden_line_removal();
  1070. X    hidden_active = TRUE;
  1071. X    }
  1072. X#endif /* not LITE */
  1073. X
  1074. X/* DRAW SURFACES AND CONTOURS */
  1075. X    real_z_min3d = min_z;
  1076. X    real_z_max3d = max_z;
  1077. X    if (key == -1) {
  1078. X        xl = xright  - (t->h_tic) - (t->h_char)*5;
  1079. X        yl = ytop - (t->v_tic) - (t->v_char);
  1080. X    }
  1081. X    if (key == 1) {
  1082. X        xtemp = LogScale(key_x, is_log_x, log_base_log_x, "key", "x");
  1083. X        ytemp = LogScale(key_y, is_log_y, log_base_log_y, "key", "y");
  1084. X        ztemp = LogScale(key_z, is_log_z, log_base_log_z, "key", "z");
  1085. X        map3d_xy(xtemp,ytemp,ztemp, &xl, &yl);
  1086. X    }
  1087. X
  1088. X#ifndef LITE
  1089. X    if (hidden3d && draw_surface) plot3d_hidden(plots,pcount);
  1090. X#endif /* not LITE */
  1091. X    this_plot = plots;
  1092. X    for (surface = 0;
  1093. X         surface < pcount;
  1094. X         this_plot = this_plot->next_sp, surface++) {
  1095. X#ifndef LITE
  1096. X        if ( hidden3d )
  1097. X            hidden_no_update = FALSE;
  1098. X#endif /* not LITE */
  1099. X
  1100. X        if (draw_surface) {
  1101. X            (*t->linetype)(this_plot->line_type);
  1102. X#ifndef LITE
  1103. X            if (hidden3d) {
  1104. X            hidden_line_type_above = this_plot->line_type;
  1105. X            hidden_line_type_below = this_plot->line_type + 1;
  1106. X            }
  1107. X#endif /* not LITE */            
  1108. X            if (key != 0 && this_plot->title) {
  1109. X            if ((*t->justify_text)(RIGHT)) {
  1110. X                clip_put_text(xl,
  1111. X                      yl,this_plot->title);
  1112. X            }
  1113. X            else {
  1114. X                if (inrange(xl-(t->h_char)*strlen(this_plot->title), 
  1115. X                    xleft, xright))
  1116. X                clip_put_text(xl-(t->h_char)*strlen(this_plot->title),
  1117. X                          yl,this_plot->title);
  1118. X            }
  1119. X            }
  1120. X            
  1121. X            switch(this_plot->plot_style) {
  1122. X                case BOXES: /* can't do boxes in 3d yet so use impulses */
  1123. X                case IMPULSES: {
  1124. X                if (key != 0 && this_plot->title) {
  1125. X                clip_move(xl+(t->h_char),yl);
  1126. X                clip_vector(xl+4*(t->h_char),yl);
  1127. X                }
  1128. X                if (!(hidden3d && draw_surface))
  1129. X                  plot3d_impulses(this_plot);
  1130. X                break;
  1131. X            }
  1132. X            case LINES: {
  1133. X                if (key != 0 && this_plot->title) {
  1134. X                clip_move(xl+(int)(t->h_char),yl);
  1135. X                clip_vector(xl+(int)(4*(t->h_char)),yl);
  1136. X                }
  1137. X                if (!(hidden3d && draw_surface))
  1138. X                  plot3d_lines(this_plot);
  1139. X                break;
  1140. X            }
  1141. X            case ERRORBARS:    /* ignored; treat like points */
  1142. X            case POINTSTYLE: {
  1143. X                if (key != 0 && this_plot->title 
  1144. X                && !clip_point(xl+2*(t->h_char),yl)) {
  1145. X                (*t->point)(xl+2*(t->h_char),yl,
  1146. X                        this_plot->point_type);
  1147. X                }
  1148. X                if (!(hidden3d && draw_surface))
  1149. X                  plot3d_points(this_plot);
  1150. X                break;
  1151. X            }
  1152. X            case LINESPOINTS: {
  1153. X                /* put lines */
  1154. X                if (key != 0 && this_plot->title) {
  1155. X                clip_move(xl+(t->h_char),yl);
  1156. X                clip_vector(xl+4*(t->h_char),yl);
  1157. X                }
  1158. X                 if (!(hidden3d && draw_surface))
  1159. X                   plot3d_lines(this_plot);
  1160. X            
  1161. X                /* put points */
  1162. X                if (key != 0 && this_plot->title 
  1163. X                && !clip_point(xl+2*(t->h_char),yl)) {
  1164. X                (*t->point)(xl+2*(t->h_char),yl,
  1165. X                        this_plot->point_type);
  1166. X                }
  1167. X                if (!(hidden3d && draw_surface))
  1168. X                  plot3d_points(this_plot);
  1169. X                break;
  1170. X            }
  1171. X            case DOTS: {
  1172. X                if (key != 0 && this_plot->title
  1173. X                && !clip_point(xl+2*(t->h_char),yl)) {
  1174. X                (*t->point)(xl+2*(t->h_char),yl, -1);
  1175. X                }
  1176. X                if (!(hidden3d && draw_surface))
  1177. X                  plot3d_dots(this_plot);
  1178. X                break;
  1179. X            }
  1180. X            }
  1181. X            if (key != 0 && this_plot->title)
  1182. X                yl = yl - (t->v_char);
  1183. X        }
  1184. X
  1185. X#ifndef LITE
  1186. X        if ( hidden3d ) {
  1187. X            hidden_no_update = TRUE;
  1188. X            hidden_line_type_above = this_plot->line_type + (hidden3d ? 2 : 1);
  1189. X            hidden_line_type_below = this_plot->line_type + (hidden3d ? 2 : 1);
  1190. X        }
  1191. X#endif /* not LITE */
  1192. X
  1193. X        if (draw_contour && this_plot->contours != NULL) {
  1194. X            struct gnuplot_contours *cntrs = this_plot->contours;
  1195. X
  1196. X            (*t->linetype)(this_plot->line_type + (hidden3d ? 2 : 1));
  1197. X
  1198. X            if (key != 0 && this_plot->title 
  1199. X                      && !(draw_surface && label_contours) ) {
  1200. X                if ((*t->justify_text)(RIGHT)) {
  1201. X                    clip_put_text(xl,
  1202. X                        yl,this_plot->title);
  1203. X                }
  1204. X                else {
  1205. X                    if (inrange(xl-(t->h_char)*strlen(this_plot->title), 
  1206. X                             xleft, xright))
  1207. X                     clip_put_text(xl-(t->h_char)*strlen(this_plot->title),
  1208. X                                 yl,this_plot->title);
  1209. X                }
  1210. X                switch(this_plot->plot_style) {
  1211. X                    case IMPULSES:
  1212. X                        clip_move(xl+(t->h_char),yl);
  1213. X                        clip_vector(xl+4*(t->h_char),yl);
  1214. X                        break;
  1215. X                    case LINES:
  1216. X                        clip_move(xl+(int)(t->h_char),yl);
  1217. X                        clip_vector(xl+(int)(4*(t->h_char)),yl);
  1218. X                        break;
  1219. X                    case ERRORBARS: /* ignored; treat like points */
  1220. X                    case POINTSTYLE:
  1221. X                        if (!clip_point(xl+2*(t->h_char),yl)) {
  1222. X                             (*t->point)(xl+2*(t->h_char),yl,
  1223. X                                    this_plot->point_type);
  1224. X                        }
  1225. X                        break;
  1226. X                    case LINESPOINTS:
  1227. X                        clip_move(xl+(int)(t->h_char),yl);
  1228. X                        clip_vector(xl+(int)(4*(t->h_char)),yl);
  1229. X                        break;
  1230. X                    case DOTS:
  1231. X                        if (!clip_point(xl+2*(t->h_char),yl)) {
  1232. X                             (*t->point)(xl+2*(t->h_char),yl, -1);
  1233. X                        }
  1234. X                        break;
  1235. X                }
  1236. X                yl = yl - (t->v_char);
  1237. X            }
  1238. X            yl = yl + (t->v_char);
  1239. X
  1240. X             linetypeOffset = this_plot->line_type + (hidden3d ? 2 : 1);
  1241. X            while (cntrs) {
  1242. X                 if(label_contours && cntrs->isNewLevel) {
  1243. X                     (*t->linetype)(linetypeOffset++);
  1244. X#ifndef LITE
  1245. X                     if(hidden3d) hidden_line_type_below = hidden_line_type_above = linetypeOffset-1;
  1246. X#endif /* not LITE */
  1247. X                     yl -= (t->v_char);
  1248. X                     if ((*t->justify_text)(RIGHT)) {
  1249. X                        clip_put_text(xl,
  1250. X                            yl,cntrs->label);
  1251. X                    }
  1252. X                    else {
  1253. X                        if (inrange(xl-(t->h_char)*strlen(cntrs->label),
  1254. X                                 xleft, xright))
  1255. X                         clip_put_text(xl-(t->h_char)*strlen(cntrs->label),
  1256. X                                     yl,cntrs->label);
  1257. X                    }
  1258. X                    switch(this_plot->plot_style) {
  1259. X                        case IMPULSES:
  1260. X                            clip_move(xl+(t->h_char),yl);
  1261. X                            clip_vector(xl+4*(t->h_char),yl);
  1262. X                            break;
  1263. X                        case LINES:
  1264. X                            clip_move(xl+(int)(t->h_char),yl);
  1265. X                            clip_vector(xl+(int)(4*(t->h_char)),yl);
  1266. X                            break;
  1267. X                        case ERRORBARS: /* ignored; treat like points */
  1268. X                        case POINTSTYLE:
  1269. X                            if (!clip_point(xl+2*(t->h_char),yl)) {
  1270. X                                 (*t->point)(xl+2*(t->h_char),yl,
  1271. X                                        this_plot->point_type);
  1272. X                            }
  1273. X                            break;
  1274. X                        case LINESPOINTS:
  1275. X                            clip_move(xl+(int)(t->h_char),yl);
  1276. X                            clip_vector(xl+(int)(4*(t->h_char)),yl);
  1277. X                            break;
  1278. X                        case DOTS:
  1279. X                            if (!clip_point(xl+2*(t->h_char),yl)) {
  1280. X                                 (*t->point)(xl+2*(t->h_char),yl, -1);
  1281. X                            }
  1282. X                            break;
  1283. X                    }
  1284. X                 }
  1285. X                switch(this_plot->plot_style) {
  1286. X                    case IMPULSES:
  1287. X                           cntr3d_impulses(cntrs, this_plot);
  1288. X                        break;
  1289. X                    case LINES:
  1290. X                        cntr3d_lines(cntrs);
  1291. X                        break;
  1292. X                    case ERRORBARS: /* ignored; treat like points */
  1293. X                    case POINTSTYLE:
  1294. X                        cntr3d_points(cntrs, this_plot);
  1295. X                        break;
  1296. X                    case LINESPOINTS:
  1297. X                        cntr3d_lines(cntrs);
  1298. X                        cntr3d_points(cntrs, this_plot);
  1299. X                        break;
  1300. X                    case DOTS:
  1301. X                        cntr3d_dots(cntrs);
  1302. X                        break;
  1303. X                }
  1304. X                cntrs = cntrs->next;
  1305. X            }
  1306. X            if (key != 0 && this_plot->title)
  1307. X              yl = yl - (t->v_char);
  1308. X        }
  1309. X
  1310. X        if (surface == 0)
  1311. X            draw_bottom_grid(this_plot,real_z_min3d,real_z_max3d);
  1312. X    }
  1313. X    (*t->text)();
  1314. X    (void) fflush(outfile);
  1315. X
  1316. X#ifndef LITE
  1317. X    if (hidden3d) {
  1318. X        term_hidden_line_removal();
  1319. X        hidden_active = FALSE;
  1320. X    }
  1321. X#endif /* not LITE */
  1322. X}
  1323. X
  1324. X/* plot3d_impulses:
  1325. X * Plot the surfaces in IMPULSES style
  1326. X */
  1327. Xstatic plot3d_impulses(plot)
  1328. X    struct surface_points *plot;
  1329. X{
  1330. X    int i;                /* point index */
  1331. X    int x,y,x0,y0;            /* point in terminal coordinates */
  1332. X    struct iso_curve *icrvs = plot->iso_crvs;
  1333. X
  1334. X    while ( icrvs ) {
  1335. X    struct coordinate GPHUGE *points = icrvs->points;
  1336. X
  1337. X    for (i = 0; i < icrvs->p_count; i++) {
  1338. X        if (real_z_max3d<points[i].z)
  1339. X        real_z_max3d=points[i].z;
  1340. X        if (real_z_min3d>points[i].z)
  1341. X        real_z_min3d=points[i].z;
  1342. X
  1343. X        map3d_xy(points[i].x, points[i].y, points[i].z, &x, &y);
  1344. X        map3d_xy(points[i].x, points[i].y, z_min3d, &x0, &y0);
  1345. X
  1346. X        clip_move(x0,y0);
  1347. X        clip_vector(x,y);
  1348. X    }
  1349. X
  1350. X    icrvs = icrvs->next;
  1351. X    }
  1352. X}
  1353. X
  1354. X/* plot3d_lines:
  1355. X * Plot the surfaces in LINES style
  1356. X */
  1357. X/* We want to always draw the lines in the same direction, otherwise when
  1358. X   we draw an adjacent box we might get the line drawn a little differently
  1359. X   and we get splotches.  */
  1360. X
  1361. X#ifndef LITE
  1362. X
  1363. Xstatic int zsort( r1, r2)
  1364. Xint * r1;
  1365. Xint * r2;
  1366. X{
  1367. X  int z1, z2;
  1368. X  z1 = nodes[*r1].z;
  1369. X  z2 = nodes[*r2].z;
  1370. X  if (z1 < z2) return 1;
  1371. X  if (z1 == z2) return 0;
  1372. X  return -1;
  1373. X}
  1374. X#define TESTBOX(X,Y)                    \
  1375. X  if(X<xmin_box) xmin_box = X;                \
  1376. X  if(X>xmax_box) xmax_box = X;                \
  1377. X  if(Y<ymin_box) ymin_box = Y;                \
  1378. X  if(Y>ymax_box) ymax_box = Y;
  1379. X/* Usefull macro to help us figure out which side of the surface we are on */
  1380. X#define XPRD(I,J,K)                     \
  1381. X  ((nodes[I].x-nodes[J].x)*(nodes[J].y-nodes[K].y) -    \
  1382. X  (nodes[I].y-nodes[J].y)*(nodes[J].x-nodes[K].x))
  1383. X#define MAYBE_LINEPOINT(J)                        \
  1384. X    if((nodes[J].flag & 0x20) != 0) {                \
  1385. X      x = nodes[J].x;                        \
  1386. X      y = nodes[J].y;                        \
  1387. X      nodes[J].flag -= 0x20;                    \
  1388. X      if (!clip_point(x,y) &&                     \
  1389. X      !IFSET(XREDUCE(x)-XREDUCE(xleft),YREDUCE(y)-YREDUCE(ybot))) \
  1390. X    (*t->point)(x,y, plot_info[nplot].point_type);        \
  1391. X    };
  1392. X
  1393. Xstruct surface_plots{
  1394. X  int above_color;
  1395. X  int below_color;
  1396. X  int row_offset;
  1397. X  int point_type;
  1398. X};
  1399. X/* All of the plots coming into this routine are assumed to have grid
  1400. X   topology.  */
  1401. X
  1402. Xstatic plot3d_hidden(plots, pcount)
  1403. X     struct surface_points *plots;
  1404. X     int pcount;
  1405. X{
  1406. X  struct surface_points *this_plot;
  1407. X  long int i, j;
  1408. X  int nplot;
  1409. X  long int x,y,z ,nseg, ncrv, ncrv1;        /* point in terminal coordinates */
  1410. X#ifdef AMIGA_SC_6_1
  1411. X  unsigned short int * cpnt;
  1412. X#else /* !AMIGA_SC_6_1 */
  1413. X  short int * cpnt;
  1414. X#endif /* !AMIGA_SC_6_1 */
  1415. X  short int  mask1, mask2;
  1416. X  long int indx1, indx2, k, m;
  1417. X  short int xmin_box, xmax_box, ymin_box, ymax_box;
  1418. X  struct surface_plots * plot_info;
  1419. X  int row_offset, nnode;
  1420. X  short int y_malloc;  /* Amount of space we need for one vertical row of
  1421. X                          bitmap, and byte offset of first used element */
  1422. X  struct termentry *t = &term_tbl[term];
  1423. X  struct iso_curve *icrvs;
  1424. X  int current_style = 0x7fff;  /* Current line style */
  1425. X  int surface;
  1426. X  nnode = 0;
  1427. X  nseg = 0;
  1428. X  nplot = 0;
  1429. X  this_plot = plots;
  1430. X
  1431. X  for (surface = 0;
  1432. X       surface < pcount;
  1433. X       this_plot = this_plot->next_sp, surface++) {
  1434. X    nplot++;
  1435. X    icrvs = plots->iso_crvs;
  1436. X    icrvs = plots->iso_crvs;
  1437. X    if(this_plot->plot_type == FUNC3D) {
  1438. X        for(icrvs = this_plot->iso_crvs,ncrv=0;icrvs;icrvs=icrvs->next,ncrv++) { };
  1439. X /*      if(this_plot->has_grid_topology) ncrv >>= 1; */
  1440. X    };
  1441. X    if(this_plot->plot_type == DATA3D)
  1442. X       ncrv = this_plot->num_iso_read;
  1443. X    nnode += ncrv * (this_plot->iso_crvs->p_count);
  1444. X/*    for(icrvs = this_plot->iso_crvs,ncrv=0;icrvs;icrvs=icrvs->next,ncrv++) { };
  1445. X    nnode += ncrv * (this_plot->iso_crvs->p_count); */
  1446. X    switch(this_plot->plot_style) {
  1447. X    case ERRORBARS:
  1448. X    case DOTS:
  1449. X    case POINTSTYLE:
  1450. X    case LINESPOINTS:
  1451. X      nseg += (ncrv) * (this_plot->iso_crvs->p_count);
  1452. X      break;
  1453. X    case LINES:
  1454. X      nseg += (ncrv-1) * (this_plot->iso_crvs->p_count-1);
  1455. X      break;
  1456. X    case IMPULSES:
  1457. X      /* There will be two nodes for each segment */
  1458. X      nnode += ncrv * (this_plot->iso_crvs->p_count);
  1459. X      nseg += (ncrv) * (this_plot->iso_crvs->p_count);
  1460. X      break;
  1461. X    }
  1462. X  };
  1463. X  boxlist = (int *) alloc((unsigned long)sizeof(int)*nseg, "hidden");
  1464. X  nodes = (struct pnts *) alloc((unsigned long)sizeof(struct pnts)*nnode, "hidden");
  1465. X  plot_info = (struct surface_plots *) alloc((unsigned long)sizeof(struct surface_plots)*nplot,"hidden");
  1466. X  nnode = 0;
  1467. X  nseg = 0;
  1468. X  nplot = 0;
  1469. X  this_plot = plots;
  1470. X  hidden_no_update = FALSE;
  1471. X
  1472. X  if ( hidden3d && draw_surface)
  1473. X    for (surface = 0;
  1474. X     surface < pcount;
  1475. X     this_plot = this_plot->next_sp, surface++) {
  1476. X      (*t->linetype)(this_plot->line_type);
  1477. X      hidden_line_type_above = this_plot->line_type;
  1478. X        hidden_line_type_below = this_plot->line_type + 1;
  1479. X    if(this_plot->plot_type == FUNC3D) {
  1480. X      for(icrvs = this_plot->iso_crvs,ncrv=0;icrvs;icrvs=icrvs->next,ncrv++) { };
  1481. X/*      if(this_plot->has_grid_topology) ncrv >>= 1; */
  1482. X    };
  1483. X    if(this_plot->plot_type == DATA3D)
  1484. X      ncrv = this_plot->num_iso_read;
  1485. X      icrvs = this_plot->iso_crvs;
  1486. X      ncrv1 = ncrv;
  1487. X      ncrv = 0;
  1488. X      while ( icrvs) {
  1489. X    struct coordinate GPHUGE *points = icrvs->points;
  1490. X    for (i = 0; i < icrvs->p_count; i++) {
  1491. X      map3d_xy(points[i].x, points[i].y, points[i].z,&nodes[nnode].x,&nodes[nnode].y);
  1492. X      nodes[nnode].z = map3d_z(points[i].x, points[i].y, points[i].z);
  1493. X      nodes[nnode].flag = (i==0 ? 1 : 0) + (ncrv == 0 ? 2 : 0) +
  1494. X        (i == icrvs->p_count-1 ? 4 : 0) + (ncrv == ncrv1-1 ? 8 : 0);
  1495. X      nodes[nnode].nplot = nplot;
  1496. X      nodes[nnode].style_used = -1000; /* indicates no style */
  1497. X      switch(this_plot->plot_style) {
  1498. X      case LINESPOINTS:
  1499. X        if(i < icrvs->p_count-1 && ncrv < ncrv1-1)
  1500. X          nodes[nnode].flag |= 0x30;
  1501. X        else
  1502. X          nodes[nnode].flag |= 0x20;
  1503. X        boxlist[nseg++] = nnode++;
  1504. X        break;
  1505. X      case LINES:
  1506. X        if(i < icrvs->p_count-1 && ncrv < ncrv1-1)
  1507. X          {
  1508. X        nodes[nnode].flag |= 0x10;
  1509. X        boxlist[nseg++] = nnode++;
  1510. X          }
  1511. X        else
  1512. X          nnode++;
  1513. X        break;
  1514. X      case ERRORBARS:
  1515. X      case POINTSTYLE:
  1516. X      case DOTS:
  1517. X        nodes[nnode].flag |= 0x40;
  1518. X        boxlist[nseg++] = nnode++;
  1519. X        break;
  1520. X      case IMPULSES:
  1521. X        nodes[nnode].flag |= 0x80;
  1522. X        boxlist[nseg++] = nnode++;
  1523. X        map3d_xy(points[i].x, points[i].y, z_min3d, &nodes[nnode].x,&nodes[nnode].y);
  1524. X        nodes[nnode].z = map3d_z(points[i].x, points[i].y, z_min3d);
  1525. X        nnode++;
  1526. X        break;
  1527. X        break;
  1528. X      }
  1529. X    }
  1530. X    icrvs = icrvs->next;
  1531. X    ncrv++;
  1532. X    if(ncrv == ncrv1) break;
  1533. X      }
  1534. X      /* Next we go through all of the boxes, and substitute the average z value
  1535. X     for the box for the z value of the corner node */
  1536. X      plot_info[nplot].above_color = this_plot->line_type;
  1537. X      plot_info[nplot].below_color = this_plot->line_type+1;
  1538. X      plot_info[nplot].point_type =
  1539. X    ((this_plot->plot_style == DOTS) ? -1 : this_plot->point_type);
  1540. X      plot_info[nplot++].row_offset = this_plot->iso_crvs->p_count;
  1541. X    }
  1542. X      for(i=0; i<nseg; i++){
  1543. X    j = boxlist[i];
  1544. X    if ((nodes[j].flag & 0x80) != 0) {
  1545. X      nodes[j].z = (nodes[j].z < nodes[j+1].z ? nodes[j].z : nodes[j+1].z);
  1546. X      continue;
  1547. X    };
  1548. X    if ((nodes[j].flag & 0x10) == 0) continue;
  1549. X    row_offset = plot_info[nodes[j].nplot].row_offset;
  1550. X    z = nodes[j].z;
  1551. X    if (z < nodes[j+1].z) z = nodes[j+1].z;
  1552. X    if (z < nodes[j+row_offset].z) z = nodes[j+row_offset].z;
  1553. X    if (z < nodes[j+row_offset+1].z) z = nodes[j+row_offset+1].z;
  1554. X      };
  1555. X  qsort (boxlist, nseg, sizeof(int), zsort);
  1556. X  y_malloc = (2+ (YREDUCE(ytop)>>4) - (YREDUCE(ybot)>>4))*sizeof(short int);
  1557. X  for(i=0;i<=(XREDUCE(xright)-XREDUCE(xleft));i++) {
  1558. X    ymin_hl[i] = 0x7fff; 
  1559. X    ymax_hl[i] = 0;
  1560. X  };
  1561. X  for(i=0;i<nseg;i++) {
  1562. X    j = boxlist[i];
  1563. X    nplot = nodes[j].nplot;
  1564. X    row_offset = plot_info[nplot].row_offset;
  1565. X    if((nodes[j].flag & 0x40) != 0) {
  1566. X      x = nodes[j].x;
  1567. X      y = nodes[j].y;
  1568. X      if (!clip_point(x,y) &&
  1569. X      !IFSET(XREDUCE(x)-XREDUCE(xleft),YREDUCE(y)-YREDUCE(ybot)))
  1570. X    (*t->point)(x,y, plot_info[nplot].point_type);
  1571. X    };
  1572. X    if((nodes[j].flag & 0x80) != 0) { /* impulses */
  1573. X      clip_move(nodes[j].x,nodes[j].y);
  1574. X      clip_vector(nodes[j+1].x,nodes[j+1].y);
  1575. X    };
  1576. X    if((nodes[j].flag & 0x10) != 0) {
  1577. X/* It is possible, and often profitable, to take a quick look and see
  1578. X   if the current box is entirely obscured.  If this is the case we will
  1579. X   not even bother testing this box any further.  */
  1580. END_OF_FILE
  1581.   if test 42442 -ne `wc -c <'gnuplot/graph3d.c.A'`; then
  1582.     echo shar: \"'gnuplot/graph3d.c.A'\" unpacked with wrong size!
  1583.   elif test -f 'gnuplot/graph3d.c.B' ; then
  1584.     echo shar: Combining  \"'gnuplot/graph3d.c'\" \(82372 characters\)
  1585.     cat 'gnuplot/graph3d.c.A' 'gnuplot/graph3d.c.B' > 'gnuplot/graph3d.c'
  1586.     if test 82372 -ne `wc -c <'gnuplot/graph3d.c'`; then
  1587.       echo shar: \"'gnuplot/graph3d.c'\" combined with wrong size!
  1588.     else 
  1589.       rm gnuplot/graph3d.c.A gnuplot/graph3d.c.B
  1590.     fi 
  1591.   fi
  1592.   # end of 'gnuplot/graph3d.c.A'
  1593. fi
  1594. if test -f 'gnuplot/makefile.unx' -a "${1}" != "-c" ; then 
  1595.   echo shar: Will not clobber existing file \"'gnuplot/makefile.unx'\"
  1596. else
  1597.   echo shar: Extracting \"'gnuplot/makefile.unx'\" \(33720 characters\)
  1598.   sed "s/^X//" >'gnuplot/makefile.unx' <<'END_OF_FILE'
  1599. X#
  1600. X# $Id: makefile.unx%v 3.50.1.16 1993/08/27 05:04:42 woo Exp $
  1601. X#
  1602. X#
  1603. X############################################################
  1604. X#
  1605. X# GNUPLOT 3.0 Makefile (Unix X11 support) for
  1606. X#  Apollo/Sun/Dec5000/IBM-RS6000/HP9000/SGI/3B1/386IX/Cray
  1607. X#
  1608. X# Original version by:
  1609. X#   oliveria@caen.engin.umich.edu (ROQUE DONIZETE DE OLIVEIRA)
  1610. X#   Wed, 3 Jul 91 14:31:37 -0400
  1611. X#
  1612. X#>>> Customizing: You must customize part of this makefile for your site.
  1613. X#>>> Then type 'make' for further instructions.
  1614. X#>>> Customization instructions look like these lines do (#>>>).
  1615. X#
  1616. X
  1617. X.NOEXPORT:
  1618. X
  1619. XTARGET = All# What to make by default
  1620. X
  1621. X############################################################
  1622. X#>>> Decide where the binaries and manuals will go.
  1623. X# directory where to install executables on 'make install'
  1624. XDEST=/usr/local/bin
  1625. X# directory for installing man page on 'make man_install'.
  1626. XMANDEST=/usr/local/man/manl
  1627. X# where to install help file gnuplot.gih
  1628. XHELPDEST=/usr/local/lib
  1629. X#HELPDEST=docs/gnuplot.gih
  1630. X# Where to send email about bugs and comments (locally)
  1631. XEMAIL=bug-gnuplot@dartmouth.edu
  1632. X
  1633. X############################################################
  1634. X#>>> Some machines may need MAKE to be defined explicitly
  1635. XMAKE   = make
  1636. X#>>> Choose your C compiler and basic compiler flags.
  1637. X# the C compiler
  1638. XCC     = cc
  1639. X# -O if you trust your compiler's optimizer
  1640. XCOPTS  =
  1641. X# default loading command
  1642. XLD     = $(CC) $(CFLAGS)
  1643. XNPROC  = 2
  1644. X#
  1645. X############################################################
  1646. X#>>> Choose some optional features.
  1647. X#>>> At this point there are only two optional features:
  1648. X# READLINE:
  1649. X#   If READLINE is defined, then command-line editing is supported.
  1650. X#   Otherwise, your normal terminal editing is all you get.
  1651. X#   Some machines will not support this, and they will turn this
  1652. X#   option off (for example, apollos running SR10.2 or SR10.3 and
  1653. X#   loaded with BSD4.3 instead of SYS5). Note: problems with
  1654. X#   gnuplot prompts have been noted when this feature is selected
  1655. X#   on IBM RS/6000 AIX, and compile errors are encountered on
  1656. X#   Sequent Dynix 3 and Convex OS 9.0.
  1657. X# NOCWDRC:
  1658. X#   If NOCWDRC is defined, then any .gnuplot in the current directory
  1659. X#   is not read on startup. This is a security consideration
  1660. X#   especially for root users ( we recommend you define -DNOCWDRC ).
  1661. XOPTIONS = -DREADLINE -DNOCWDRC
  1662. X
  1663. X#>>> Optionally install the lasergnu script.
  1664. X# Lasergnu is a handy shell script for creating a plot from the
  1665. X# command line and sending it directly to the printer. It currently
  1666. X# supports PostScript and imagen printers, and probably would need
  1667. X# tailoring to your site.
  1668. X# Use lasergnu_install to install lasergnu.
  1669. X# Use lasergnu_noinstall to not install lasergnu (default).
  1670. XLASERGNU = lasergnu_install
  1671. X
  1672. X############################################################
  1673. X# X11 support
  1674. X#
  1675. X
  1676. X#>>> List your X11 libraries
  1677. XX11LIBS = -lX11
  1678. X
  1679. X#>>> List where the X11 include directory is found (if other than /usr/include)
  1680. XX11INCLUDES =
  1681. X
  1682. X#>>> List additional CFLAGS for X11 compilation
  1683. X# -DOLD_SELECT if you have an old 4.2 BSD OS (e.g. Sun OS 3.5) and
  1684. X#   encounter compile error for missing include file <sys/select.h>
  1685. X# -DBSD_TYPES if your system defines FD_* macros for select in
  1686. X#   <sys/bsdtypes.h>
  1687. X# -ISC22 to circumvent missing plots past the first on ISC 2.2
  1688. XX11FLAGS =
  1689. X
  1690. X#>>> You shouldn't have to change these, since they are controlled by
  1691. X#>>> Machine dependent definitions below.
  1692. X#       Compile option for plot.c and TERMFLAGS, to include X11 support
  1693. XPLOTXFLAG = -DX11
  1694. X#       make gnuplot_x11 by default
  1695. XGNUPLOT_X11 = gnuplot_x11
  1696. X#       install gnuplot_x11 by default
  1697. XX11INSTALL = x11_install
  1698. X
  1699. X############################################################
  1700. X#>>> Okay, you've changed enough. Now type 'make'.
  1701. X
  1702. X############################################################
  1703. X# This is used to pass many of the above definitions to make
  1704. X# subprocesses. Don't change this.
  1705. XMY_FLAGS  = CC="$(CC)" COPTS="$(COPTS)" DEST="$(DEST)" \
  1706. X        MANDEST="$(MANDEST)" HELPDEST="$(HELPDEST)" \
  1707. X        EMAIL="$(EMAIL)" LASERGNU="$(LASERGNU)"
  1708. X
  1709. X############################################################
  1710. X# Explanations of CFLAGS definitions.
  1711. X#  These should not need to be changed by you.
  1712. X# They are set correctly for each machine below. If your machine
  1713. X# doesn't fit the one of the patterns, override on the make command
  1714. X# line or make a new target for it and a new _FLAGS definition.
  1715. X#  -DNOVFORK if you're unix and you have don't have vfork()
  1716. X#  -DMEMSET if you need to use memset() instead of bzero()
  1717. X#  -DMEMCPY if your bcopy() is called memcpy()
  1718. X#  -DNOCOPY if you don't have a memcpy() by any name
  1719. X#  -DGAMMA=foo if your gamma function is called foo(). Apollos have
  1720. X#    lgamma(3m). The default is -DGAMMA=gamma.
  1721. X#  -DGETCWD if your unix uses getcwd() instead of getcd()
  1722. X#    this is needed by HP-UX and Cray Unicos systems.
  1723. X#  -DULTRIX_KLUDGE if you run X windows on Ultrix and experience the
  1724. X#    "every other plot" problem.
  1725. X#  -DCRIPPLED_SELECT if "select errors" are encountered with X. This
  1726. X#    option is needed on SVR3 platforms with incomplete support for
  1727. X#    the BSD select() system call
  1728. X#  -DXPG3_LOCALE if your system uses the 'setlocale' function to
  1729. X#    support foreign charactersets (currently only ISO8859-1).
  1730. X#  -Dunix is required to explicitly define "unix" for SCO and IBM
  1731. X#          RS/6000 running AIX 3.2
  1732. X#  -fswitch if you are compiling on a Sun3 (or even -f68881)
  1733. X#    (but -fswitch is buggy on some systems, so watch out)
  1734. X
  1735. X# Defaults in case the user types 'make All' directly
  1736. X# Should match X11_FLAGS's CFLAGS definition
  1737. XCFLAGS = $(COPTS) $(OPTIONS)
  1738. X
  1739. X############################################################
  1740. X# Terminal (device) support
  1741. X#
  1742. X# All devices available to a given machine are compiled in by default.
  1743. X# This documents the flags available in TERMFLAGS, although TERMFLAGS
  1744. X# is usually controlled by the machine-dependent definitions below.
  1745. X# See other terminal defines in term.h.
  1746. X# Define ULTRIX_KLUDGE if you have the every-other plot problem in Ultrix X11.
  1747. X#
  1748. X# -DAPOLLO      Apollo Graphics Primitive Resource (window resize after replot)
  1749. X# -DGPR         Apollo Graphics Primitive Resource (fixed-size window)
  1750. X# -DCGI         SCO CGI
  1751. X# -DIRIS4D      IRIS4D series computer
  1752. X# -DSUN         Sun Microsystems Workstation
  1753. X# -DUNIXPC      unixpc (ATT 3b1 or ATT 7300)
  1754. X# -DUNIXPLOT    unixplot
  1755. X# -DGNUGRAPH    use GNU graphics version of UNIX plot library
  1756. X#               This can only be used in combination with -DUNIXPLOT
  1757. X# -DX11         X11 Window System (This is $(PLOTXFLAG))
  1758. XTERMFLAGS = -Iterm $(PLOTXFLAG)
  1759. X
  1760. X############################################################
  1761. X# Library explanations.
  1762. X#  You shouldn't need to adjust this; again, it is handled by the
  1763. X# machine-dependent definitions below.
  1764. X#
  1765. X#  -lplot if you have -DUNIXPLOT in TERMFLAGS
  1766. X#  -lsuntool -lsunwindow -lpixrect  if you have -DSUN in TERMFLAGS
  1767. X#  -lgl_s if -DIRIS4D in TERMFLAGS
  1768. X#  -lccgi if -DCGI in TERMFLAGS
  1769. X#  -lmgr -lpixrect if -DMGR in TERMFLAGS. (conflicts with SunView)
  1770. XLIBS = -lm # -lplot is no longer shipped on SUNs
  1771. X
  1772. X####################################################################
  1773. X# List of object files except version.o
  1774. XOBJS = bitmap.o command.o contour.o eval.o graphics.o graph3d.o help.o \
  1775. X       internal.o misc.o parse.o plot.o readline.o scanner.o \
  1776. X       setshow.o specfun.o standard.o term.o util.o gnubin.o binary.o
  1777. X
  1778. XNEXTOBJS = epsviewe.o
  1779. X############################################################
  1780. X# Machine-dependent settings.
  1781. X#
  1782. XX11_FLAGS = \
  1783. X           CFLAGS="$(COPTS) $(OPTIONS)" \
  1784. X           LIBS="$(LIBS)" X11FLAGS="$(X11FLAGS)" X11INCLUDES="$(X11INCLUDES)" \
  1785. X           X11LIBS="$(X11LIBS)" \
  1786. X           PLOTXFLAG="$(PLOTXFLAG)" GNUPLOT_X11=$(GNUPLOT_X11) \
  1787. X           X11INSTALL="$(X11INSTALL)" \
  1788. X           TERMFLAGS="$(TERMFLAGS)"
  1789. X
  1790. XDEC_OSF_FLAGS = \
  1791. X           CFLAGS="$(COPTS) $(OPTIONS) -I/usr/sys/include -I/usr/sys/BINARY -DANSI -DNOVFORK -DGAMMA=lgamma -D_XOPEN_SOURCE " \
  1792. X           LIBS="$(LIBS) -ldnet_stub" \
  1793. X           X11FLAGS="$(X11FLAGS) -DMOTIF -D_NO_PROTO -D_OSF_SOURCE" \
  1794. X           X11INCLUDES="$(X11INCLUDES) -I/usr/include/Xm" \
  1795. X           X11LIBS="$(X11LIBS) -ldnet_stub" \
  1796. X           PLOTXFLAG="$(PLOTXFLAG)" GNUPLOT_X11=$(GNUPLOT_X11) \
  1797. X           X11INSTALL="$(X11INSTALL)" \
  1798. X           TERMFLAGS="$(TERMFLAGS) "
  1799. X
  1800. XDEC_FLAGS = \
  1801. X           CFLAGS="$(COPTS) $(OPTIONS) " \
  1802. X           LIBS="-lplot $(LIBS)" X11FLAGS="$(X11FLAGS)" X11INCLUDES="$(X11INCLUDES)" \
  1803. X           X11LIBS="$(X11LIBS)" \
  1804. X           PLOTXFLAG="$(PLOTXFLAG)" GNUPLOT_X11=$(GNUPLOT_X11) \
  1805. X           X11INSTALL="$(X11INSTALL)" \
  1806. X           TERMFLAGS="$(TERMFLAGS) -DULTRIX_KLUDGE"
  1807. X
  1808. XAPOLLO_FLAGS = \
  1809. X           CFLAGS="$(COPTS) $(OPTIONS) -DGAMMA=lgamma" \
  1810. X           LIBS="$(LIBS)" X11FLAGS="$(X11FLAGS)" \
  1811. X           X11INCLUDES="$(X11INCLUDES)" \
  1812. X           X11LIBS="-L/usr/lib/X11 -lX11" \
  1813. X           PLOTXFLAG="$(PLOTXFLAG)" GNUPLOT_X11=$(GNUPLOT_X11) \
  1814. X           X11INSTALL="$(X11INSTALL)" \
  1815. X           TERMFLAGS="$(TERMFLAGS) -DAPOLLO -DGPR"
  1816. X
  1817. XHP_FLAGS = \
  1818. X           CFLAGS="$(COPTS) $(OPTIONS) -DMEMSET -DMEMCPY -DGETCWD" \
  1819. X           LIBS="-lm" X11FLAGS="$(X11FLAGS)" \
  1820. X           X11INCLUDES="/usr/include/X11R4" \
  1821. X           X11LIBS="-L/usr/lib/X11R4 -lX11" \
  1822. X           PLOTXFLAG="$(PLOTXFLAG)" GNUPLOT_X11=$(GNUPLOT_X11) \
  1823. X           X11INSTALL="$(X11INSTALL)" \
  1824. X           TERMFLAGS="-Iterm -DX11"
  1825. X
  1826. XSOLARIS_X11_FLAGS = \
  1827. X           CFLAGS="$(COPTS) $(OPTIONS) -DMEMSET -DMEMCPY -DGETCWD -DSOLARIS" \
  1828. X           X11FLAGS="$(X11FLAGS)" X11INCLUDES="$(X11INCLUDES)" \
  1829. X           X11LIBS="$(X11LIBS)" \
  1830. X           PLOTXFLAG="$(PLOTXFLAG)" GNUPLOT_X11=$(GNUPLOT_X11) \
  1831. X           X11INSTALL="$(X11INSTALL)" \
  1832. X           TERMFLAGS="$(TERMFLAGS) -DSOLARIS"
  1833. X
  1834. XSUN_FLAGS = \
  1835. X           CFLAGS="$(COPTS) $(OPTIONS) -DSUN" \
  1836. X           LIBS="-lsuntool -lsunwindow -lpixrect $(LIBS)" \
  1837. X           X11FLAGS=" " X11INCLUDES=" " \
  1838. X           X11LIBS=" " \
  1839. X           PLOTXFLAG=" " GNUPLOT_X11=" " X11INSTALL=x11_noinstall \
  1840. X           TERMFLAGS="-Iterm"
  1841. X
  1842. XSUN_X11_FLAGS = \
  1843. X           CFLAGS="$(COPTS) $(OPTIONS) " \
  1844. X           LIBS="-L/usr/openwin/lib $(LIBS)" \
  1845. X           X11FLAGS="$(X11FLAGS)" \
  1846. X           X11INCLUDES="-I/usr/openwin/include $(X11INCLUDES)" \
  1847. X           X11LIBS="$(X11LIBS)" \
  1848. X           PLOTXFLAG="$(PLOTXFLAG)" GNUPLOT_X11=$(GNUPLOT_X11) \
  1849. X           X11INSTALL="$(X11INSTALL)" \
  1850. X           TERMFLAGS="$(TERMFLAGS)"
  1851. X
  1852. XSUN_X11_MGR_FLAGS = \
  1853. X           CFLAGS="$(COPTS) $(OPTIONS)" \
  1854. X           LIBS="-lmgr -lpixrect -L/usr/mgr/lib $(LIBS)" \
  1855. X           X11FLAGS="$(X11FLAGS)" X11INCLUDES="$(X11INCLUDES)" \
  1856. X           X11LIBS="$(X11LIBS)" \
  1857. X           PLOTXFLAG="$(PLOTXFLAG)" GNUPLOT_X11=$(GNUPLOT_X11) \
  1858. X           X11INSTALL="$(X11INSTALL)" \
  1859. X           TERMFLAGS="-I/usr/mgr/include -Iterm -DMGR $(TERMFLAGS)"
  1860. X
  1861. XSGI_FLAGS = \
  1862. X           CFLAGS="$(COPTS) $(OPTIONS) -DGETCWD -DNOVFORK" \
  1863. X           LIBS="-lgl_s -lm" X11FLAGS=" " X11INCLUDES=" " \
  1864. X           X11LIBS=" " \
  1865. X           PLOTXFLAG=" " GNUPLOT_X11=" " X11INSTALL=x11_noinstall \
  1866. X           TERMFLAGS="-Iterm -DIRIS4D -DANSI"
  1867. X
  1868. XSGIX11_FLAGS = \
  1869. X           CFLAGS="$(COPTS) $(OPTIONS) -DGETCWD -DNOVFORK" \
  1870. X           LIBS="-lgl_s -lm -lc_s" X11FLAGS="$(X11FLAGS)" \
  1871. X           X11INCLUDES="$(X11INCLUDES)" \
  1872. X           X11LIBS="-L/usr/lib/X11 -lX11" \
  1873. X           PLOTXFLAG="$(PLOTXFLAG)" GNUPLOT_X11=$(GNUPLOT_X11) \
  1874. X           X11INSTALL="$(X11INSTALL)" \
  1875. X           TERMFLAGS="-Iterm -DX11 -DIRIS4D -DANSI"
  1876. X
  1877. XCGI_FLAGS = \
  1878. X           CFLAGS="$(COPTS) $(OPTIONS) -Dunix" \
  1879. X           LIBS="-lccgi $(LIBS)" X11FLAGS=" " X11INCLUDES=" " \
  1880. X           X11LIBS=" " PLOTXFLAG=" " GNUPLOT_X11=" " X11INSTALL=x11_noinstall \
  1881. X           TERMFLAGS="-Iterm -DUNIXPLOT -DCGI"
  1882. X
  1883. X3B1_FLAGS = \
  1884. X           CFLAGS="$(COPTS) $(OPTIONS) -DGETCWD -DMEMSET -DMEMCPY -DNOVFORK" \
  1885. X           LIBS="$(LIBS)" X11FLAGS=" " X11INCLUDES=" " \
  1886. X           X11LIBS=" " \
  1887. X           PLOTXFLAG=" " GNUPLOT_X11=" " X11INSTALL=x11_noinstall \
  1888. X           LD="ld /lib/crt0s.o /lib/shlib.ifile" \
  1889. X           TERMFLAGS="-Iterm -DUNIXPC"
  1890. X
  1891. X3B2_FLAGS = \
  1892. X           CFLAGS="$(COPTS) $(OPTIONS) -DGETCWD -DMEMSET -DMEMCPY -DNOVFORK" \
  1893. X           X11FLAGS=" " X11INCLUDES=" " \
  1894. X           X11LIBS=" " \
  1895. X           PLOTXFLAG=" " GNUPLOT_X11=" " X11INSTALL=x11_noinstall \
  1896. X           TERMFLAGS="-Iterm -DUNIXPLOT" LIBS="$(LIBS) -lplot"
  1897. X
  1898. X386IX_FLAGS = \
  1899. X           CFLAGS="$(COPTS) $(OPTIONS) -DGETCWD -DMEMSET -DMEMCPY -DNOVFORK -DTCSETSW -DTCGETS" \
  1900. X           LIBS="$(LIBS) -lcposix" X11FLAGS=" " X11INCLUDES=" " \
  1901. X           X11LIBS=" " PLOTXFLAG=" " GNUPLOT_X11=" " \
  1902. X           X11INSTALL=x11_noinstall \
  1903. X           TERMFLAGS="-Iterm -DUNIXPLOT"
  1904. X
  1905. X386IX_X11_FLAGS = \
  1906. X           CFLAGS="$(COPTS) $(OPTIONS) -DGETCWD -DMEMSET -DMEMCPY -DNOVFORK -DTCSETSW -DTCGETS" \
  1907. X           LIBS="$(LIBS) -lcposix" X11FLAGS="$(X11FLAGS)" X11INCLUDES="$(X11INCLUDES)" \
  1908. X           X11LIBS="$(X11LIBS)" PLOTXFLAG="$(PLOTXFLAG)" GNUPLOT_X11="$(GNUPLOT_X11)" \
  1909. X           X11INSTALL= "$(X11INSTALL)" \
  1910. X           TERMFLAGS="-Iterm -DUNIXPLOT -DX11"
  1911. X
  1912. XISC22_X11_FLAGS = \
  1913. X           CFLAGS="$(COPTS) $(OPTIONS) -DGETCWD -DMEMSET -DMEMCPY -DNOVFORK -DISC22" \
  1914. X           LIBS="$(LIBS) -lplot -lcposix" X11FLAGS="$(X11FLAGS)" X11INCLUDES="$(X11INCLUDES)" \
  1915. X           X11LIBS="$(X11LIBS) -linet -lpt -lcposix" PLOTXFLAG="$(PLOTXFLAG)" GNUPLOT_X11="$(GNUPLOT_X11)" \
  1916. X           X11INSTALL= "$(X11INSTALL)" \
  1917. X           TERMFLAGS="-Iterm -DUNIXPLOT -DX11"
  1918. X
  1919. XAIX_FLAGS = \
  1920. X           CFLAGS="$(COPTS) $(OPTIONS) -DGAMMA=gamma -DXPG3_LOCALE -Dunix" \
  1921. X           LIBS="$(LIBS) -lbsd" X11FLAGS="$(X11FLAGS)" \
  1922. X           X11INCLUDES="$(X11INCLUDES)" \
  1923. X           X11LIBS="$(X11LIBS)" \
  1924. X           PLOTXFLAG="$(PLOTXFLAG)" GNUPLOT_X11=$(GNUPLOT_X11) \
  1925. X           X11INSTALL="$(X11INSTALL)" \
  1926. X           TERMFLAGS="$(TERMFLAGS) -qmaxmem=9000" \
  1927. X           COMFLAGS="-qmaxmem=3000" SSFLAGS="-qmaxmem=3000"
  1928. X
  1929. XAIXO_FLAGS = \
  1930. X           CFLAGS="$(COPTS) $(OPTIONS) -DGAMMA=gamma -DXPG3_LOCALE -Dunix" \
  1931. X           LIBS="$(LIBS) -lbsd" X11FLAGS="$(X11FLAGS)" \
  1932. X           X11INCLUDES="$(X11INCLUDES)" \
  1933. X           X11LIBS="$(X11LIBS)" \
  1934. X           PLOTXFLAG="$(PLOTXFLAG)" GNUPLOT_X11=$(GNUPLOT_X11) \
  1935. X           X11INSTALL="$(X11INSTALL)" \
  1936. X           TERMFLAGS="$(TERMFLAGS)"
  1937. X
  1938. XNEXT_FLAGS = \
  1939. X           CFLAGS="$(COPTS) -DGAMMA=lgamma -DNEXT -DREADLINE -DSGTTY" \
  1940. X           LIBS="-lNeXT_s -lsys_s -lm" \
  1941. X           X11FLAGS="$(X11FLAGS)" \
  1942. X           X11INCLUDES=" " X11LIBS=" " PLOTXFLAG=" " \
  1943. X           GNUPLOT_X11=" " X11INSTALL=x11_noinstall \
  1944. X           TERMFLAGS="-Iterm -ObjC -DANSI" OBJS=" $(OBJS) $(NEXTOBJS)"
  1945. X
  1946. XNEXT_X11_FLAGS = \
  1947. X           CFLAGS="$(COPTS) -DGAMMA=lgamma -DNEXT -DREADLINE -DSGTTY -DX_NOT_POSIX" \
  1948. X           LIBS="-lNeXT_s -lsys_s -lm" \
  1949. X           X11LIBS="-L/usr/lib/X11 -lX11" \
  1950. X           X11INCLUDES="$(X11INCLUDES)" X11FLAGS="$(X11FLAGS)" \
  1951. X           PLOTXFLAG="$(PLOTXFLAG)" GNUPLOT_X11=$(GNUPLOT_X11) \
  1952. X           X11INSTALL="$(X11INSTALL)" \
  1953. X           TERMFLAGS="-Iterm -DX11 -ObjC -DANSI" OBJS=" $(OBJS) $(NEXTOBJS)"
  1954. X
  1955. XCRAY_FLAGS = \
  1956. X       CFLAGS="$(COPTS) $(OPTIONS) -DGETCWD -DNOVFORK" \
  1957. X       LIBS="-lm" X11FLAGS=" " \
  1958. X       X11INCLUDES=" " \
  1959. X       X11LIBS=" " \
  1960. X       PLOTXFLAG=" " GNUPLOT_X11=" " \
  1961. X       X11INSTALL=x11_noinstall \
  1962. X       TERMFLAGS="-Iterm"
  1963. X
  1964. XCRAY_X11_FLAGS = \
  1965. X       CFLAGS="$(COPTS) $(OPTIONS) -DGETCWD -DNOVFORK" \
  1966. X       LIBS="-lm" X11FLAGS="$(X11FLAGS)" \
  1967. X       X11INCLUDES="$(X11INCLUDES)" \
  1968. X       X11LIBS="$(X11LIBS)" \
  1969. X       PLOTXFLAG="$(PLOTXFLAG)" GNUPLOT_X11="$(GNUPLOT_X11)" \
  1970. X       X11INSTALL=$(X11INSTALL) \
  1971. X       TERMFLAGS="-Iterm -DX11"
  1972. X
  1973. XPTX_X11_FLAGS = \
  1974. X       CFLAGS="$(COPTS) $(OPTIONS) -DGETCWD -DMEMSET -DMEMCPY -DCRIPPLED_SELECT" \
  1975. X       LIBS="-lm -lplot" X11FLAGS="$(X11FLAGS)" \
  1976. X       X11INCLUDES="$(X11INCLUDES)" \
  1977. X       X11LIBS="-lX11 -lseq -lsocket -linet -lnsl" \
  1978. X       PLOTXFLAG="$(PLOTXFLAG)" GNUPLOT_X11="$(GNUPLOT_X11)" \
  1979. X       X11INSTALL=$(X11INSTALL) \
  1980. X       TERMFLAGS="$(TERMFLAGS)"
  1981. X
  1982. XSEQUENT_X11_FLAGS = \
  1983. X       CFLAGS="$(COPTS) $(OPTIONS) -DSGTTY -DCRIPPLED_SELECT" \
  1984. X       LIBS="-lm -lplot" X11FLAGS="$(X11FLAGS) -DX_WCHAR" \
  1985. X       X11INCLUDES="$(X11INCLUDES)" \
  1986. X       X11LIBS="-lX11 -lseq " \
  1987. X       PLOTXFLAG="$(PLOTXFLAG)" GNUPLOT_X11="$(GNUPLOT_X11)" \
  1988. X       X11INSTALL=$(X11INSTALL) \
  1989. X       TERMFLAGS="$(TERMFLAGS)"
  1990. X
  1991. XCONVEX_X11_FLAGS = \
  1992. X           CFLAGS="$(COPTS) $(OPTIONS) -DHUGE=8.9e307" \
  1993. X           LIBS="$(LIBS)" X11FLAGS="$(X11FLAGS)" X11INCLUDES="$(X11INCLUDES)" \
  1994. X           X11LIBS="$(X11LIBS)" \
  1995. X           PLOTXFLAG="$(PLOTXFLAG)" GNUPLOT_X11=$(GNUPLOT_X11) \
  1996. X           X11INSTALL="$(X11INSTALL)" \
  1997. X           TERMFLAGS="$(TERMFLAGS)"
  1998. X
  1999. XKSR_FLAGS = \
  2000. X           CFLAGS="$(COPTS) $(OPTIONS) -I/usr/sys/include -I/usr/sys/BINARY -DANSI -DNOVFORK -DNOGAMMA -D_XOPEN_SOURCE -DKSR" \
  2001. X           LIBS="$(LIBS)" \
  2002. X           X11FLAGS="$(X11FLAGS) -DMOTIF -D_NO_PROTO -D_OSF_SOURCE" \
  2003. X           X11INCLUDES="$(X11INCLUDES) -I/usr/include/Xm" \
  2004. X           X11LIBS="$(X11LIBS)" \
  2005. X           PLOTXFLAG="$(PLOTXFLAG)" GNUPLOT_X11=$(GNUPLOT_X11) \
  2006. X           X11INSTALL="$(X11INSTALL)" \
  2007. X           TERMFLAGS="$(TERMFLAGS) "
  2008. X
  2009. XLINUX_FLAGS = \
  2010. X           CFLAGS="$(COPTS) $(OPTIONS) -m486 -DGAMMA=lgamma" \
  2011. X           LIBS="-L/usr/X386/lib -lX11 $(LIBS)" \
  2012. X           X11FLAGS="$(X11FLAGS)" X11INCLUDES="-I/usr/X386/include $(X11INCLUDES)" \
  2013. X           X11LIBS="$(X11LIBS)" \
  2014. X           PLOTXFLAG="$(PLOTXFLAG)" GNUPLOT_X11=$(GNUPLOT_X11) \
  2015. X           X11INSTALL="$(X11INSTALL)" \
  2016. X           TERMFLAGS="$(TERMFLAGS)"
  2017. X
  2018. X####################################################################
  2019. X# List of source files
  2020. X# Used for making shar files, lint, and some dependencies.
  2021. XDIRS = term demo docs docs/latextut
  2022. X
  2023. XCSOURCE1 = bf_test.c binary.c command.c setshow.c
  2024. XCSOURCE2 = help.c gnubin.c graphics.c graph3d.c internal.c
  2025. XCSOURCE3 = misc.c eval.c parse.c plot.c readline.c scanner.c standard.c
  2026. XCSOURCE4 = bitmap.c term.c util.c version.c
  2027. XCSOURCE5 = term/ai.trm term/amiga.trm term/aed.trm term/atari.trm \
  2028. X    term/bigfig.trm term/cgi.trm term/corel.trm \
  2029. X    term/djsvga.trm term/dumb.trm \
  2030. X    term/dxf.trm term/dxy.trm term/debug.trm \
  2031. X    term/emxvga.trm term/eepic.trm term/epson.trm term/excl.trm \
  2032. X    term/fig.trm term/grass.trm term/hp26.trm term/hp2648.trm term/hpgl.trm \
  2033. X    term/hp500c.trm term/hpljii.trm term/metafont.trm term/mgr.trm\
  2034. X    term/apollo.trm term/gpr.trm term/hppj.trm term/compact.c
  2035. XCSOURCE6 = term/impcodes.h term/imagen.trm term/next.trm term/object.h \
  2036. X    term/iris4d.trm term/kyo.trm term/latex.trm term/mif.trm \
  2037. X    term/pbm.trm term/pslatex.trm term/gpic.trm term/gnugraph.trm
  2038. XCSOURCE7 = term/post.trm term/pstricks.trm term/qms.trm term/regis.trm \
  2039. X    term/rgip.trm term/sun.trm \
  2040. X    term/t410x.trm term/tek.trm term/texdraw.trm term/tgif.h \
  2041. X    term/tgif.trm term/tpic.trm \
  2042. X    term/unixpc.trm term/unixplot.trm \
  2043. X    term/v384.trm term/vws.trm term/x11.trm term/xlib.trm
  2044. XCSOURCE8 = contour.c specfun.c gplt_x11.c
  2045. XCONFIGURE = configure configure.in Makefile.in docs/Makefile.in\
  2046. X    docs/latextut/Makefile.in 0CONFIG
  2047. XNEXTSRC  = epsviewe.m epsviewe.h
  2048. X# not C code, but still needed
  2049. X
  2050. XDEMOS = demo/1.dat demo/2.dat demo/3.dat demo/contours.dem \
  2051. X    demo/controls.dem demo/electron.dem demo/glass.dat demo/param.dem \
  2052. X    demo/polar.dem demo/simple.dem demo/surface1.dem \
  2053. X    demo/surface2.dem demo/using.dat demo/using.dem demo/world.cor \
  2054. X    demo/world.dat demo/world.dem \
  2055. X    demo/err.dat demo/poldat.dem demo/polar.dat demo/errorbar.dem \
  2056. X    demo/antenna.dat demo/all.dem demo/animate.dem demo/bivariat.dem \
  2057. X    demo/prob.dem demo/stat.inc demo/prob2.dem demo/random.dem \
  2058. X    demo/discrete.dem demo/hidden.dem demo/airfoil.dem demo/gnuplot.rot\
  2059. X    demo/binary.dem demo/spline.dem demo/steps.dem demo/steps.dat \
  2060. X    demo/multimsh.dem demo/whale.dat demo/hemisphr.dat \
  2061. X    demo/scatter.dem demo/scatter2.dat demo/singulr.dem demo/klein.dat
  2062. X
  2063. XETC = Copyright 0README README.gnu README.ami makefile.unx makefile.vms \
  2064. X    linkopt.amg makefile.amg makefile.ami linkopt.vms buildvms.com \
  2065. X    lasergnu makefile.r makefile.nt makefile.g 0FAQ 0BUGS\
  2066. X    term/README History gnuplot.el intergra.x11 0INSTALL README.3p1\
  2067. X    README.3p2 README.3p3 README.3p4 README.pro README.nex README.x11 \
  2068. X    README.3d README.mf README.win README.iso README.3p5 README.pic \
  2069. X    README.xli $(CONFIGURE)
  2070. X
  2071. X#BETA files (not standard distribution files)
  2072. XBETA = 
  2073. X# PC-specific files
  2074. XPC = corgraph.asm corplot.c header.mac hrcgraph.asm lineproc.mac \
  2075. X    linkopt.msc makefile.msc makefile.tc makefile.st makefile.djg \
  2076. X    pcgraph.asm gnuplot.def makefile.286 makefile.emx \
  2077. X    makefile.ztc linkopt.ztc term/fg.trm term/pc.trm 
  2078. XWINDOWS = makefile.win makefile.msw README.win win/wcommon.h \
  2079. X    win/wgnuplib.c win/wgnuplib.def win/wgnuplib.h win/wgnuplib.rc \
  2080. X    win/wgnuplot.def win/wgnuplot.hpj win/wgnuplot.mnu win/wgnuplot.rc \
  2081. X    win/wgraph.c win/winmain.c win/wmenu.c win/wpause.c \
  2082. X    win/wprinter.c win/wresourc.h win/wtext.c win/wtext.h \
  2083. X    win/geticon.c docs/doc2rtf.c term/win.trm
  2084. XOS2 = makefile.os2 os2/makefile os2/dialogs.c os2/dialogs.h os2/gclient.c \
  2085. X    os2/gnuicon.uue os2/gnupmdrv.c os2/gnupmdrv.def os2/gnupmdrv.h \
  2086. X    os2/gnupmdrv.itl os2/gnupmdrv.rc os2/print.c docs/doc2ipf.c \
  2087. X    README.os2 term/pm.trm
  2088. X
  2089. X# Documentation and help files
  2090. XDOCS1 = docs/makefile docs/README docs/checkdoc.c docs/doc2gih.c \
  2091. X    docs/doc2hlp.c docs/doc2hlp.com docs/doc2ms.c docs/doc2tex.c \
  2092. X    docs/gnuplot.1 docs/lasergnu.1 docs/toc_entr.sty docs/doc2info.pl \
  2093. X    docs/titlepag.ms docs/titlepag.tex docs/makefile.ami \
  2094. X    docs/doc2rtf.c
  2095. XDOCS2 = docs/gnuplot.doc docs/gpcard.tex
  2096. XDOCS3 = docs/latextut/makefile docs/latextut/eg1.plt \
  2097. X    docs/latextut/eg2.plt docs/latextut/eg3.dat docs/latextut/eg3.plt \
  2098. X    docs/latextut/eg4.plt docs/latextut/eg5.plt docs/latextut/eg6.plt \
  2099. X    docs/latextut/header.tex docs/latextut/tutorial.tex \
  2100. X    docs/latextut/linepoin.plt
  2101. X
  2102. X#########################################################################
  2103. X# Default target (informational)
  2104. Xinfo:
  2105. X    @echo "Please do a 'make <MACHINE>' where <MACHINE> is one of the following:"
  2106. X    @echo
  2107. X    @echo "apollo       for Apollo running SR10.3 with Apollo's X11"
  2108. X    @echo "dec_osf      for Dec3100/5000 running DEC OSF/1 v1.0"
  2109. X    @echo "dec          for Dec3100/5000 running Ultrix 3.1d with MIT's X11"
  2110. X    @echo "hp           for HP/9000 700 series running HP/UX 8.0 with MIT's X11R4"
  2111. X    @echo "sun          for Sun sparcstation running SunOS 4.1 with suntools (no X11) "
  2112. X    @echo "sun_x11      for Sun sparcstation running SunOS 4.1 with suntools and X11 "
  2113. X    @echo "sgi          for Silicon Graphics IRIS4D machines (no X11) "
  2114. X    @echo "sgix11       for Silicon Graphics IRIS4D machines (X11) "
  2115. X    @echo "next         for NeXT Cube and Slab running NeXTOS 2.0+ (no X11)"
  2116. X    @echo "next_x11     for NeXT Cube and Slab running NeXTOS 2.0+ with X11"
  2117. X    @echo "3b1          for ATT 3b1 machines (no X11) "
  2118. X    @echo "3b2          for ATT 3b2 machines (no X11) "
  2119. X    @echo "386ix        for 386 machines running 386/ix (no X11)"
  2120. X    @echo "386ix_x11    for 386 machines running 386/ix with T.Roell X386"
  2121. X    @echo "isc22_x11    for 386 machines running ISC 2.2 with T.Roell X386"
  2122. X    @echo "aix32        for IBM RS/6000 running AIX 3.2 with xlc 1.2"
  2123. X    @echo "aix32o       for IBM RS/6000 running AIX 3.2 with xlc 1.1"
  2124. X    @echo "x11          for a generic machine (like a sun or dec) with MIT's X11"
  2125. X    @echo "cray         for Cray Y-MP or Cray-2 running Unicos 6.0 or 6.1 (no X11)"
  2126. X    @echo "cray_x11     for Cray Y-MP or Cray-2 running Unicos 6.0 or 6.1 with X11"
  2127. X    @echo "ptx_x11      for Sequent Dynix/PTX with MIT X11"
  2128. X    @echo "sequent_x11  for Sequent Symmetry (DYNIX 3) with X11"
  2129. X    @echo "convex_x11   for Convex 9.0 with MIT X11"
  2130. X    @echo "ksr          for KSR1 running DEC OSF/1 v1.0 (use make -j 16)"
  2131. X    @echo "linux        for LINUX with XFree86-1.2"
  2132. X    @echo
  2133. X    @echo "Examples:"
  2134. X    @echo
  2135. X    @echo "         make x11"
  2136. X    @echo "         make apollo"
  2137. X    @echo "         make apollo       OPTIONS='-DNOCWDRC' "
  2138. X    @echo "         make apollo       DEST='/usr/um/misc/bin' "
  2139. X    @echo "         make dec"
  2140. X    @echo "         make hp"
  2141. X    @echo "         make next"
  2142. X    @echo "         make solaris_x11"
  2143. X    @echo "         make sun          HELPDEST='/usr/um/misc/lib' "
  2144. X    @echo "         make sun          X11INCLUDES='-I/usr/local/include' "
  2145. X    @echo "         make sun_x11"
  2146. X    @echo "         make sgi"
  2147. X    @echo "         make 3b1"
  2148. X    @echo "         make 386ix"
  2149. X    @echo "         make 386ix_x11"
  2150. X    @echo "         make isc22_x11"
  2151. X    @echo "         make aix32        MANDEST='/usr/um/misc/man/man1' COPTS='-O' "
  2152. X    @echo "         make cray"
  2153. X    @echo "         make cray_x11"
  2154. X    @echo
  2155. X    @echo "If you just type 'make All' , it will build gnuplot for Unix X11"
  2156. X    @echo "and the following variables will be used as default:"
  2157. X    @echo
  2158. X    @echo " DEST                     " $(DEST)
  2159. X    @echo " MANDEST                  " $(MANDEST)
  2160. X    @echo " HELPDEST                 " $(HELPDEST)
  2161. X    @echo " EMAIL                    " $(EMAIL)
  2162. X    @echo " CC                       " $(CC)
  2163. X    @echo " COPTS                    " $(COPTS)
  2164. X    @echo " OPTIONS                  " $(OPTIONS)
  2165. X    @echo " CFLAGS                   " $(CFLAGS)
  2166. X    @echo " LIBS                     " $(LIBS)
  2167. X    @echo " X11FLAGS                 " $(X11FLAGS)
  2168. X    @echo " X11LIBS                  " $(X11LIBS)
  2169. X    @echo " X11INCLUDES              " $(X11INCLUDES)
  2170. X    @echo " TERMFLAGS                " $(TERMFLAGS)
  2171. X    @echo " LASERGNU                 " $(LASERGNU)
  2172. X    @echo
  2173. X    @echo "If you are not familiar with makefiles or just want to know what"
  2174. X    @echo " 'make <MACHINE>' would do without actually doing anything, then type"
  2175. X    @echo " 'make <MACHINE> -n' "
  2176. X    @echo
  2177. X
  2178. X###############################################################
  2179. X# Targets for each machine
  2180. X
  2181. Xx11:
  2182. X    $(MAKE) $(MFLAGS) $(MY_FLAGS) $(X11_FLAGS)      $(TARGET)
  2183. X
  2184. Xdec_osf:
  2185. X    $(MAKE) $(MFLAGS) $(MY_FLAGS) $(DEC_OSF_FLAGS)  $(TARGET)
  2186. X
  2187. Xdec:
  2188. X    $(MAKE) $(MFLAGS) $(MY_FLAGS) $(DEC_FLAGS)      $(TARGET)
  2189. X
  2190. Xapollo:
  2191. X    $(MAKE) $(MFLAGS) $(MY_FLAGS) $(APOLLO_FLAGS)   $(TARGET)
  2192. X
  2193. Xhp:
  2194. X    $(MAKE) $(MFLAGS) $(MY_FLAGS) $(HP_FLAGS)       $(TARGET)
  2195. X
  2196. Xnext:
  2197. X    $(MAKE) $(MFLAGS) $(MY_FLAGS) $(NEXT_FLAGS)     $(TARGET)
  2198. X
  2199. Xnext_x11:
  2200. X    $(MAKE) $(MFLAGS) $(MY_FLAGS) $(NEXT_X11_FLAGS) $(TARGET)
  2201. X
  2202. Xsolaris_x11:
  2203. X    $(MAKE) $(MFLAGS) $(MY_FLAGS) $(SOLARIS_X11_FLAGS)  $(TARGET)
  2204. X
  2205. Xsun:
  2206. X    $(MAKE) $(MFLAGS) $(MY_FLAGS) $(SUN_FLAGS)      $(TARGET)
  2207. X
  2208. Xsun_x11:
  2209. X    $(MAKE) $(MFLAGS) $(MY_FLAGS) $(SUN_X11_FLAGS)  $(TARGET)
  2210. X
  2211. Xsun_x11_mgr:
  2212. X    $(MAKE) $(MFLAGS) $(MY_FLAGS) $(SUN_X11_MGR_FLAGS)  $(TARGET)
  2213. X
  2214. Xsgi:
  2215. X    $(MAKE) $(MFLAGS) $(MY_FLAGS) $(SGI_FLAGS)      $(TARGET)
  2216. X
  2217. Xsgix11:
  2218. X    $(MAKE) $(MFLAGS) $(MY_FLAGS) $(SGIX11_FLAGS)   $(TARGET)
  2219. X
  2220. Xcgi:
  2221. X    $(MAKE) $(MFLAGS) $(MY_FLAGS) $(CGI_FLAGS)      $(TARGET)
  2222. X
  2223. X3b1:
  2224. X    $(MAKE) $(MFLAGS) $(MY_FLAGS) $(3B1_FLAGS)      $(TARGET)
  2225. X
  2226. X3b2:
  2227. X    $(MAKE) $(MFLAGS) $(MY_FLAGS) $(3B2_FLAGS)      $(TARGET)
  2228. X
  2229. X386ix:
  2230. X    $(MAKE) $(MFLAGS) $(MY_FLAGS) $(386IX_FLAGS)    $(TARGET)
  2231. X
  2232. X386ix_x11:
  2233. X    $(MAKE) $(MFLAGS) $(MY_FLAGS) $(386IX_X11_FLAGS) $(TARGET)
  2234. X
  2235. Xisc22_x11:
  2236. X    $(MAKE) $(MFLAGS) $(MY_FLAGS) $(ISC22_X11_FLAGS) $(TARGET)
  2237. X
  2238. Xaix32:
  2239. X    $(MAKE) $(MFLAGS) $(MY_FLAGS) $(AIX_FLAGS)      $(TARGET)
  2240. X
  2241. Xaix32o:
  2242. X    $(MAKE) $(MFLAGS) $(MY_FLAGS) $(AIXO_FLAGS)     $(TARGET)
  2243. X
  2244. Xcray:
  2245. X    $(MAKE) $(MFLAGS) $(MY_FLAGS) $(CRAY_FLAGS)     $(TARGET)
  2246. X
  2247. Xcray_x11:
  2248. X    $(MAKE) $(MFLAGS) $(MY_FLAGS) $(CRAY_X11_FLAGS) $(TARGET)
  2249. X
  2250. Xptx_x11:
  2251. X    $(MAKE) $(MFLAGS) $(MY_FLAGS) $(PTX_X11_FLAGS)  $(TARGET)
  2252. X
  2253. Xsequent_x11:
  2254. X    make $(MFLAGS) $(MY_FLAGS) $(SEQUENT_X11_FLAGS) $(TARGET)
  2255. X
  2256. Xconvex_x11:
  2257. X    $(MAKE) $(MFLAGS) $(MY_FLAGS) $(CONVEX_X11_FLAGS) $(TARGET)
  2258. X
  2259. Xksr:
  2260. X    $(MAKE) $(MFLAGS) $(MY_FLAGS) $(KSR_FLAGS)  $(TARGET)
  2261. X
  2262. Xlinux:
  2263. X    $(MAKE) $(MFLAGS) $(MY_FLAGS) $(LINUX_FLAGS)  $(TARGET)
  2264. X
  2265. X#############################################################
  2266. X# Targets that really do something
  2267. X
  2268. Xall:
  2269. X    @echo "Please just type  'make'  in order to get some information on "
  2270. X    @echo "how to build gnuplot under Unix and the X Window System."
  2271. X
  2272. XAll: gnuplot $(GNUPLOT_X11) doc demo/binary1
  2273. X
  2274. Xgnuplot: $(OBJS) version.o
  2275. X    $(LD) -o gnuplot $(OBJS) version.o $(LIBS)
  2276. X
  2277. Xdoc:
  2278. X    ( cd docs; $(MAKE) $(MFLAGS) $(MY_FLAGS) gnuplot.gih )
  2279. X
  2280. Xgnuplot_x11: gplt_x11.c
  2281. X    $(CC) $(CFLAGS) $(X11FLAGS) $(X11INCLUDES) -o gnuplot_x11 \
  2282. X    gplt_x11.c $(X11LIBS)
  2283. X
  2284. Xdemo/binary1 demo/binary2 demo/binary3: bf_test
  2285. X    ( cd demo; ../bf_test )
  2286. X
  2287. Xbf_test: bf_test.o binary.o
  2288. X    $(CC) $(CFLAGS) bf_test.o binary.o -lm -o bf_test
  2289. X################################################################
  2290. X# Installation instructions
  2291. X
  2292. Xinstall:
  2293. X    @echo
  2294. X    @echo "Please do a 'make <MACHINE> TARGET=Install' where <MACHINE> is one of the following:"
  2295. X    @echo
  2296. X    @echo "apollo, dec, hp, sun, sun_x11, sgi, sgix11, cgi,"
  2297. X    @echo "next, next_x11, 3b1, 386ix, 386ix_x11, aix32, aix32o,"
  2298. X    @echo "x11, cray, cray_x11, ptx_x11, sequent_x11, convex_x11"
  2299. X    @echo
  2300. X    @echo "Examples:"
  2301. X    @echo
  2302. X    @echo "         make x11          TARGET=Install "
  2303. X    @echo "         make apollo       TARGET=Install "
  2304. X    @echo "         make dec          TARGET=Install "
  2305. X    @echo "         make hp           TARGET=Install "
  2306. X    @echo "         make sun          TARGET=Install HELPDEST='/usr/um/misc/lib' "
  2307. X    @echo "         make aix32        TARGET=Install MANDEST='/usr/um/misc/man/man1' COPTS='-O' "
  2308. X    @echo
  2309. X################################################################
  2310. X# Installation targets
  2311. X
  2312. XInstall: All man_install $(X11INSTALL) $(LASERGNU)
  2313. X    cp gnuplot $(DEST)
  2314. X    strip $(DEST)/gnuplot
  2315. X    ( cd docs; $(MAKE) $(MFLAGS) $(MY_FLAGS) install-unix HELPDEST=$(HELPDEST) )
  2316. X
  2317. Xx11_install: gnuplot_x11
  2318. X    cp gnuplot_x11 $(DEST)
  2319. X    strip $(DEST)/gnuplot_x11
  2320. X
  2321. Xx11_noinstall:
  2322. X    @echo "X11 not requested, so gnuplot_x11 program not installed"
  2323. X
  2324. Xman_install: docs/gnuplot.1
  2325. X    cp docs/gnuplot.1 $(MANDEST)
  2326. X
  2327. Xlasergnu_install: lasergnu docs/lasergnu.1
  2328. X    cp lasergnu $(DEST)
  2329. X    chmod 755 $(DEST)/lasergnu
  2330. X    cp docs/lasergnu.1 $(MANDEST)
  2331. X
  2332. Xlasergnu_noinstall:
  2333. X    @echo
  2334. X    @echo "Lasergnu will not be installed by default."
  2335. X    @echo "If you think you need the lasergnu script to print"
  2336. X    @echo " files on the imagen or PostScript printers, then"
  2337. X    @echo " type"
  2338. X    @echo "      'make <MACHINE> TARGET=Install LASERGNU='lasergnu_install' "
  2339. X    @echo
  2340. X    @echo "Lasergnu is really not needed since within gnuplot you can"
  2341. X    @echo " can create files (in impress or PostScript language) and"
  2342. X    @echo " print them through your favorite print command (lpr, lp, prf, ipr)."
  2343. X    @echo
  2344. X
  2345. X################################################################
  2346. X# Dependencies
  2347. X
  2348. Xplot.o: plot.c
  2349. X    $(CC) $(CFLAGS) $(PLOTXFLAG) -c plot.c
  2350. X
  2351. Xterm.o: term.h term.c $(CSOURCE5) $(CSOURCE6) $(CSOURCE7)
  2352. X    $(CC) $(CFLAGS) $(TERMFLAGS) -c term.c
  2353. X
  2354. Xversion.o:
  2355. X    $(CC) $(CFLAGS) -DCONTACT=\"$(EMAIL)\" -c version.c
  2356. X
  2357. Xepsviewe.o : epsviewe.h epsviewe.m
  2358. X    $(CC) -ObjC -c epsviewe.m
  2359. X
  2360. X$(OBJS): plot.h
  2361. X
  2362. Xcommand.o: command.c
  2363. X    $(CC) $(CFLAGS) -c command.c -DHELPFILE=\"$(HELPDEST)/gnuplot.gih\" $(COMFLAGS)
  2364. X
  2365. Xcommand.o help.o misc.o: help.h
  2366. X
  2367. Xcommand.o graphics.o graph3d.o misc.o plot.o setshow.o term.o: setshow.h
  2368. X
  2369. Xbitmap.o term.o: bitmap.h
  2370. X
  2371. Xsetshow.o: setshow.c
  2372. X    $(CC) $(CFLAGS) -c setshow.c $(SSFLAGS)
  2373. X
  2374. X################################################################
  2375. X# Miscellaneous targets
  2376. X
  2377. XSOURCES=plot.h help.h setshow.h bitmap.h term.h $(CSOURCE1) $(CSOURCE2) \
  2378. X    $(CSOURCE3) $(CSOURCE4) $(CSOURCE5) $(CSOURCE6) $(CSOURCE7)\
  2379. X    $(CSOURCE8) $(NEXTSRC) $(WINDOWS) $(OS2)
  2380. X
  2381. XDOCS  = $(DOCS1) $(DOCS2) $(DOCS3)
  2382. X
  2383. Xlint:
  2384. X    lint -hx $(SOURCES)
  2385. X
  2386. Xclean:
  2387. X    rm -f *.o *.orig *.rej *~ *.bak term/*~ term/*.orig term/*.bak
  2388. X    ( cd docs; $(MAKE) $(MFLAGS) clean )
  2389. X    ( cd docs/latextut; $(MAKE) $(MFLAGS) clean )
  2390. X
  2391. Xspotless:
  2392. X    rm -f *.o *~ *.orig *.rej *.bak term/*~ term/*.orig term/*.bak \
  2393. X    TAGS gnuplot gnuplot_x11 \
  2394. X    bf_test demo/binary[1-3]
  2395. X    ( cd docs; $(MAKE) $(MFLAGS) clean )
  2396. X    ( cd docs/latextut; $(MAKE) $(MFLAGS) spotless )
  2397. X
  2398. X################################################################
  2399. X# Making shar files for mailing gnuplot
  2400. X
  2401. Xshar: gnuplot.sh00 gnuplot.sh01 gnuplot.sh02 gnuplot.sh03 gnuplot.sh04 \
  2402. X    gnuplot.sh05 gnuplot.sh06 gnuplot.sh07 gnuplot.sh08 \
  2403. X    gnuplot.sh09 gnuplot.sh10 gnuplot.sh11 gnuplot.sh12 \
  2404. X    gnuplot.sh13 gnuplot.sh14 gnuplot.sh15 gnuplot.sh16
  2405. X
  2406. Xgnuplot.sh00:
  2407. X    echo '#!/bin/sh' > gnuplot.sh00
  2408. X    echo '# This is a shell file to make directories' >> gnuplot.sh00
  2409. X    echo mkdir $(DIRS) >> gnuplot.sh00
  2410. X
  2411. Xgnuplot.sh01: $(ETC) 
  2412. X    shar $(ETC) > gnuplot.sh01
  2413. X
  2414. Xgnuplot.sh02: $(DOCS1)
  2415. X    shar $(DOCS1) > gnuplot.sh02
  2416. X
  2417. Xgnuplot.sh03: $(DOCS2)
  2418. X    shar $(DOCS2) > gnuplot.sh03
  2419. X
  2420. Xgnuplot.sh04: $(DOCS3)
  2421. X    shar $(DOCS3) > gnuplot.sh04
  2422. X
  2423. Xgnuplot.sh05: $(CSOURCE1)
  2424. X    shar $(CSOURCE1) > gnuplot.sh05
  2425. X
  2426. Xgnuplot.sh06: $(CSOURCE2)
  2427. X    shar $(CSOURCE2) > gnuplot.sh06
  2428. X
  2429. Xgnuplot.sh07: $(CSOURCE3)
  2430. X    shar $(CSOURCE3) > gnuplot.sh07
  2431. X
  2432. Xgnuplot.sh08: $(CSOURCE4)
  2433. X    shar $(CSOURCE4) > gnuplot.sh08
  2434. X
  2435. Xgnuplot.sh09: $(CSOURCE5)
  2436. X    shar $(CSOURCE5) > gnuplot.sh09
  2437. X
  2438. Xgnuplot.sh10: $(CSOURCE6)
  2439. X    shar $(CSOURCE6) > gnuplot.sh10
  2440. X
  2441. Xgnuplot.sh11: $(CSOURCE7)
  2442. X    shar $(CSOURCE7) > gnuplot.sh11
  2443. X
  2444. Xgnuplot.sh12: $(PC)
  2445. X    shar $(PC) > gnuplot.sh12
  2446. X
  2447. Xgnuplot.sh13: $(CSOURCE8)
  2448. X    shar $(CSOURCE8) > gnuplot.sh13
  2449. X
  2450. Xgnuplot.sh14: $(DEMOS)
  2451. X    shar $(DEMOS) > gnuplot.sh14
  2452. X
  2453. Xgnuplot.sh15: $(WINDOWS)
  2454. X    shar $(WINDOWS) > gnuplot.sh15
  2455. X
  2456. Xgnuplot.sh16: $(BETA)
  2457. X    shar $(BETA) > gnuplot.sh16
  2458. X
  2459. Xtar: $(ETC) $(SOURCES) $(PC) $(DEMOS) $(BETA) $(DOCS) 
  2460. X    $(TAR) cvf /tmp/gnuplot.tar $(ETC) $(SOURCES) $(PC)\
  2461. X         $(DEMOS) $(BETA) $(DOCS) 
  2462. X#
  2463. X# the following uses Rick Saltz's makekit shar generation tools
  2464. X#
  2465. X
  2466. Xkit: $(ETC) $(SOURCES) $(PC) $(DEMOS) $(BETA) $(DOCS) 
  2467. X    makekit -s135k -k30 $(ETC) $(SOURCES) $(PC)\
  2468. X         $(DEMOS) $(BETA) $(DOCS) 
  2469. X
  2470. Xbranch: rcs rcsdoc rcsdemo
  2471. X
  2472. Xrcs:
  2473. X    rcs -b$(RCSVER) $(ETC) $(SOURCES) $(PC) 
  2474. X
  2475. Xrcsdoc:
  2476. X    rcs -b$(RCSVER) $(DOCS)
  2477. X
  2478. Xrcsdemo:
  2479. X    rcs -b$(RCSVER) $(DEMOS)
  2480. X
  2481. Xciall: ci cidoc cidemo
  2482. X
  2483. Xci:
  2484. X    ci -l$(RCSVER) -m$(RCSCOM) -t-$(RCSCOM) $(SOURCES) $(PC) $(ETC) 
  2485. X
  2486. Xcidoc:
  2487. X    ci -l$(RCSVER) -m$(RCSCOM) -t-$(RCSCOM) $(DOCS)
  2488. X
  2489. Xcidemo:
  2490. X    ci -l$(RCSVER) -m$(RCSCOM) -t-$(RCSCOM) $(DEMOS)
  2491. X
  2492. Xciforce:
  2493. X    ci -f$(RCSVER) -m$(RCSCOM) -t-$(RCSCOM) $(SOURCES) $(ETC) $(DOCS) $(DEMOS) $(PC)
  2494. X
  2495. Xcoall: co codoc codemo
  2496. X
  2497. Xco:
  2498. X    co -l -r$(RCSVER) $(ETC) $(SOURCES) $(PC)
  2499. X
  2500. Xcodoc:
  2501. X    co -l -r$(RCSVER) $(DOCS)
  2502. X
  2503. Xcodemo:
  2504. X    co -l -r$(RCSVER) $(DEMOS)
  2505. END_OF_FILE
  2506.   if test 33720 -ne `wc -c <'gnuplot/makefile.unx'`; then
  2507.     echo shar: \"'gnuplot/makefile.unx'\" unpacked with wrong size!
  2508.   fi
  2509.   # end of 'gnuplot/makefile.unx'
  2510. fi
  2511. echo shar: End of archive 13 \(of 33\).
  2512. cp /dev/null ark13isdone
  2513. MISSING=""
  2514. for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 ; do
  2515.     if test ! -f ark${I}isdone ; then
  2516.     MISSING="${MISSING} ${I}"
  2517.     fi
  2518. done
  2519. if test "${MISSING}" = "" ; then
  2520.     echo You have unpacked all 33 archives.
  2521.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  2522. else
  2523.     echo You still must unpack the following archives:
  2524.     echo "        " ${MISSING}
  2525. fi
  2526. exit 0
  2527. exit 0 # Just in case...
  2528.