home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / misc / volume40 / gnuplot / part02 < prev    next >
Encoding:
Text File  |  1993-10-21  |  79.3 KB  |  3,076 lines

  1. Newsgroups: comp.sources.misc
  2. From: woo@playfair.stanford.edu ("Alexander Woo")
  3. Subject: v40i014:  gnuplot - interactive function plotting utility, Part02/33
  4. Message-ID: <1993Oct21.144207.1387@sparky.sterling.com>
  5. X-Md4-Signature: 0b488dae23dac977cc7908ceff183e1c
  6. Sender: kent@sparky.sterling.com (Kent Landfield)
  7. Organization: Sterling Software
  8. Date: Thu, 21 Oct 1993 14:42:07 GMT
  9. Approved: kent@sparky.sterling.com
  10.  
  11. Submitted-by: woo@playfair.stanford.edu ("Alexander Woo")
  12. Posting-number: Volume 40, Issue 14
  13. Archive-name: gnuplot/part02
  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/setshow.c
  22. # Wrapped by kent@sparky on Wed Oct 20 17:14:38 1993
  23. PATH=/bin:/usr/bin:/usr/ucb:/usr/local/bin:/usr/lbin ; export PATH
  24. echo If this archive is complete, you will see the following message:
  25. echo '          "shar: End of archive 2 (of 33)."'
  26. if test -f 'gnuplot/setshow.c' -a "${1}" != "-c" ; then 
  27.   echo shar: Will not clobber existing file \"'gnuplot/setshow.c'\"
  28. else
  29.   echo shar: Extracting \"'gnuplot/setshow.c'\" \(76221 characters\)
  30.   sed "s/^X//" >'gnuplot/setshow.c' <<'END_OF_FILE'
  31. Xstatic char *RCSid = "$Id: setshow.c%v 3.50.1.11 1993/08/10 03:55:03 woo Exp $";
  32. X
  33. X
  34. X/* GNUPLOT - setshow.c */
  35. X/*
  36. X * Copyright (C) 1986 - 1993   Thomas Williams, Colin Kelley
  37. X *
  38. X * Permission to use, copy, and distribute this software and its
  39. X * documentation for any purpose with or without fee is hereby granted, 
  40. X * provided that the above copyright notice appear in all copies and 
  41. X * that both that copyright notice and this permission notice appear 
  42. X * in supporting documentation.
  43. X *
  44. X * Permission to modify the software is granted, but not the right to
  45. X * distribute the modified code.  Modifications are to be distributed 
  46. X * as patches to released version.
  47. X *  
  48. X * This software is provided "as is" without express or implied warranty.
  49. X * 
  50. X *
  51. X * AUTHORS
  52. X * 
  53. X *   Original Software:
  54. X *     Thomas Williams,  Colin Kelley.
  55. X * 
  56. X *   Gnuplot 2.0 additions:
  57. X *       Russell Lang, Dave Kotz, John Campbell.
  58. X *
  59. X *   Gnuplot 3.0 additions:
  60. X *       Gershon Elber and many others.
  61. X *
  62. X * 19 September 1992  Lawrence Crowl  (crowl@cs.orst.edu)
  63. X * Added user-specified bases for log scaling.
  64. X * 
  65. X * There is a mailing list for gnuplot users. Note, however, that the
  66. X * newsgroup 
  67. X *    comp.graphics.gnuplot 
  68. X * is identical to the mailing list (they
  69. X * both carry the same set of messages). We prefer that you read the
  70. X * messages through that newsgroup, to subscribing to the mailing list.
  71. X * (If you can read that newsgroup, and are already on the mailing list,
  72. X * please send a message info-gnuplot-request@dartmouth.edu, asking to be
  73. X * removed from the mailing list.)
  74. X *
  75. X * The address for mailing to list members is
  76. X *       info-gnuplot@dartmouth.edu
  77. X * and for mailing administrative requests is 
  78. X *       info-gnuplot-request@dartmouth.edu
  79. X * The mailing list for bug reports is 
  80. X *       bug-gnuplot@dartmouth.edu
  81. X * The list of those interested in beta-test versions is
  82. X *       info-gnuplot-beta@dartmouth.edu
  83. X */
  84. X
  85. X#include <stdio.h>
  86. X#include <math.h>
  87. X#include "plot.h"
  88. X#include "setshow.h"
  89. X
  90. X#define DEF_FORMAT   "%g"    /* default format for tic mark labels */
  91. X#define SIGNIF (0.01)        /* less than one hundredth of a tic mark */
  92. X
  93. X/*
  94. X * global variables to hold status of 'set' options
  95. X *
  96. X */
  97. XTBOOLEAN        autoscale_r    = TRUE;
  98. XTBOOLEAN        autoscale_t    = TRUE;
  99. XTBOOLEAN        autoscale_u    = TRUE;
  100. XTBOOLEAN        autoscale_v    = TRUE;
  101. XTBOOLEAN        autoscale_x    = TRUE;
  102. XTBOOLEAN        autoscale_y    = TRUE;
  103. XTBOOLEAN        autoscale_z    = TRUE;
  104. XTBOOLEAN        autoscale_lt    = TRUE;
  105. XTBOOLEAN        autoscale_lu    = TRUE;
  106. XTBOOLEAN        autoscale_lv    = TRUE;
  107. XTBOOLEAN        autoscale_lx    = TRUE;
  108. XTBOOLEAN        autoscale_ly    = TRUE;
  109. XTBOOLEAN        autoscale_lz    = TRUE;
  110. Xdouble            boxwidth    = -1.0; /* box width (automatic) */
  111. XTBOOLEAN         clip_points    = FALSE;
  112. XTBOOLEAN         clip_lines1    = TRUE;
  113. XTBOOLEAN         clip_lines2    = FALSE;
  114. XTBOOLEAN        draw_border    = TRUE;
  115. XTBOOLEAN        draw_surface    = TRUE;
  116. XTBOOLEAN        timedate    = FALSE;
  117. Xchar            dummy_var[MAX_NUM_VAR][MAX_ID_LEN+1] = { "x", "y" };
  118. Xchar            xformat[MAX_ID_LEN+1] = DEF_FORMAT;
  119. Xchar            yformat[MAX_ID_LEN+1] = DEF_FORMAT;
  120. Xchar            zformat[MAX_ID_LEN+1] = DEF_FORMAT;
  121. Xenum PLOT_STYLE        data_style    = POINTSTYLE;
  122. Xenum PLOT_STYLE        func_style    = LINES;
  123. XTBOOLEAN        grid        = FALSE;
  124. Xint            key        = -1;    /* default position */
  125. Xdouble            key_x;
  126. Xdouble            key_y;    /* user specified position for key */
  127. Xdouble            key_z;
  128. XTBOOLEAN        is_log_x    = FALSE;
  129. XTBOOLEAN        is_log_y    = FALSE;
  130. XTBOOLEAN        is_log_z    = FALSE;
  131. Xdouble            base_log_x    = 0.0;
  132. Xdouble            base_log_y    = 0.0;
  133. Xdouble            base_log_z    = 0.0;
  134. Xdouble            log_base_log_x    = 0.0;
  135. Xdouble            log_base_log_y    = 0.0;
  136. Xdouble            log_base_log_z    = 0.0;
  137. XFILE*            outfile;
  138. Xchar            outstr[MAX_ID_LEN+1] = "STDOUT";
  139. XTBOOLEAN        parametric    = FALSE;
  140. XTBOOLEAN        polar        = FALSE;
  141. XTBOOLEAN        hidden3d    = FALSE;
  142. XTBOOLEAN        label_contours    = TRUE; /* different linestyles are used for contours when set */
  143. Xint            angles_format    = ANGLES_RADIANS;
  144. Xint            mapping3d    = MAP3D_CARTESIAN;
  145. Xint            samples        = SAMPLES; /* samples is always equal to samples_1 */
  146. Xint            samples_1    = SAMPLES;
  147. Xint            samples_2    = SAMPLES;
  148. Xint            iso_samples_1    = ISO_SAMPLES;
  149. Xint            iso_samples_2    = ISO_SAMPLES;
  150. Xfloat            xsize        = 1.0;  /* scale factor for size */
  151. Xfloat            ysize        = 1.0;  /* scale factor for size */
  152. Xfloat            zsize        = 1.0;  /* scale factor for size */
  153. Xfloat            surface_rot_z   = 30.0; /* Default 3d transform. */
  154. Xfloat            surface_rot_x   = 60.0;
  155. Xfloat            surface_scale   = 1.0;
  156. Xfloat            surface_zscale  = 1.0;
  157. Xint            term        = 0;        /* unknown term is 0 */
  158. Xchar            term_options[MAX_LINE_LEN+1] = "";
  159. Xchar            title[MAX_LINE_LEN+1] = "";
  160. Xchar            xlabel[MAX_LINE_LEN+1] = "";
  161. Xchar            ylabel[MAX_LINE_LEN+1] = "";
  162. Xchar            zlabel[MAX_LINE_LEN+1] = "";
  163. Xint            time_xoffset    = 0;
  164. Xint            time_yoffset    = 0;
  165. Xint            title_xoffset    = 0;
  166. Xint            title_yoffset    = 0;
  167. Xint            xlabel_xoffset    = 0;
  168. Xint            xlabel_yoffset    = 0;
  169. Xint            ylabel_xoffset    = 0;
  170. Xint            ylabel_yoffset    = 0;
  171. Xint            zlabel_xoffset    = 0;
  172. Xint            zlabel_yoffset    = 0;
  173. Xdouble            rmin        = -0.0;
  174. Xdouble            rmax        =  10.0;
  175. Xdouble            tmin        = -5.0;
  176. Xdouble            tmax        =  5.0;
  177. Xdouble            umin        = -5.0;
  178. Xdouble            umax        = 5.0;
  179. Xdouble            vmin        = -5.0;
  180. Xdouble            vmax        = 5.0;
  181. Xdouble            xmin        = -10.0;
  182. Xdouble            xmax        = 10.0;
  183. Xdouble            ymin        = -10.0;
  184. Xdouble            ymax        = 10.0;
  185. Xdouble            zmin        = -10.0;
  186. Xdouble            zmax        = 10.0;
  187. Xdouble            loff        = 0.0;
  188. Xdouble            roff        = 0.0;
  189. Xdouble            toff        = 0.0;
  190. Xdouble            boff        = 0.0;
  191. Xint            draw_contour    = CONTOUR_NONE;
  192. Xint            contour_pts    = 5;
  193. Xint            contour_kind    = CONTOUR_KIND_LINEAR;
  194. Xint            contour_order    = 4;
  195. Xint            contour_levels    = 5;
  196. Xdouble            zero        = ZERO;    /* zero threshold, not 0! */
  197. Xint            levels_kind    = LEVELS_AUTO;
  198. Xdouble            levels_list[MAX_DISCRETE_LEVELS];  /* storage for z levels to draw contours at */
  199. X
  200. Xint            dgrid3d_row_fineness = 10;
  201. Xint            dgrid3d_col_fineness = 10;
  202. Xint            dgrid3d_norm_value = 1;
  203. XTBOOLEAN        dgrid3d        = FALSE;
  204. X
  205. XTBOOLEAN         xzeroaxis    = TRUE;
  206. XTBOOLEAN         yzeroaxis    = TRUE;
  207. X
  208. XTBOOLEAN         xtics        = TRUE;
  209. XTBOOLEAN         ytics        = TRUE;
  210. XTBOOLEAN         ztics        = TRUE;
  211. X
  212. Xfloat             ticslevel    = 0.5;
  213. X
  214. Xstruct ticdef        xticdef        = {TIC_COMPUTED};
  215. Xstruct ticdef        yticdef        = {TIC_COMPUTED};
  216. Xstruct ticdef        zticdef        = {TIC_COMPUTED};
  217. X
  218. XTBOOLEAN        tic_in        = TRUE;
  219. X
  220. Xstruct text_label     *first_label    = NULL;
  221. Xstruct arrow_def     *first_arrow    = NULL;
  222. X
  223. X/*** other things we need *****/
  224. X#ifdef _Windows
  225. X#include <string.h>
  226. X#else
  227. X#if !defined(ATARI) && !defined (AMIGA_SC_6_1)
  228. Xextern char *strcpy(),*strcat();
  229. Xextern int      strlen();
  230. X#endif
  231. X#endif
  232. X
  233. X#if defined(unix) || defined(PIPES)
  234. Xextern FILE *popen();
  235. X#endif
  236. X
  237. X/* input data, parsing variables */
  238. Xextern struct lexical_unit token[];
  239. Xextern char input_line[];
  240. Xextern int num_tokens, c_token;
  241. Xextern TBOOLEAN interactive;    /* from plot.c */
  242. X
  243. Xextern char replot_line[];
  244. Xextern struct udvt_entry *first_udv;
  245. Xextern TBOOLEAN is_3d_plot;
  246. X
  247. Xextern double magnitude(),real();
  248. Xextern struct value *const_express();
  249. X
  250. X#ifdef _Windows
  251. Xextern FILE * open_printer();
  252. Xextern void close_printer();
  253. X#endif
  254. X
  255. X/******** Local functions ********/
  256. Xstatic void set_xyzlabel();
  257. Xstatic void set_label();
  258. Xstatic void set_nolabel();
  259. Xstatic void set_arrow();
  260. Xstatic void set_noarrow();
  261. Xstatic void load_tics();
  262. Xstatic void load_tic_user();
  263. Xstatic void free_marklist();
  264. Xstatic void load_tic_series();
  265. Xstatic void load_offsets();
  266. X
  267. Xstatic void show_style(), show_range(), show_zero(), show_border(), show_dgrid3d();
  268. Xstatic void show_offsets(), show_output(), show_samples(), show_isosamples();
  269. Xstatic void show_view(), show_size(), show_title(), show_xlabel();
  270. Xstatic void show_angles(), show_boxwidth();
  271. Xstatic void show_ylabel(), show_zlabel(), show_xzeroaxis(), show_yzeroaxis();
  272. Xstatic void show_label(), show_arrow(), show_grid(), show_key();
  273. Xstatic void show_polar(), show_parametric(), show_tics(), show_ticdef();
  274. Xstatic void show_time(), show_term(), show_plot(), show_autoscale(), show_clip();
  275. Xstatic void show_contour(), show_mapping(), show_format(), show_logscale();
  276. Xstatic void show_variables(), show_surface(), show_hidden3d(), show_label_contours();
  277. Xstatic void delete_label();
  278. Xstatic int assign_label_tag();
  279. Xstatic void delete_arrow();
  280. Xstatic int assign_arrow_tag();
  281. Xstatic TBOOLEAN set_one(), set_two(), set_three();
  282. Xstatic TBOOLEAN show_one(), show_two();
  283. X
  284. X/******** The 'set' command ********/
  285. Xvoid
  286. Xset_command()
  287. X{
  288. Xstatic char GPFAR setmess[] =
  289. X    "valid set options:  'angles' '{no}arrow', {no}autoscale', \n\
  290. X    '{no}border', 'boxwidth', '{no}clabel', '{no}clip', 'cntrparam', \n\
  291. X        '{no}contour', 'data style', '{no}dgrid3d', 'dummy', 'format', \n\
  292. X        'function style', '{no}grid', '{no}hidden3d', 'isosamples', '{no}key', \n\
  293. X    '{no}label', '{no}logscale', 'mapping', 'offsets', 'output', \n\
  294. X    '{no}parametric', '{no}polar', 'rrange', 'samples', 'size', \n\
  295. X    '{no}surface', 'terminal', 'tics', 'ticslevel', '{no}time', 'title', \n\
  296. X    'trange', 'urange', 'view', 'vrange', 'xlabel', 'xrange', '{no}xtics', \n\
  297. X    'xmtics', 'xdtics', '{no}xzeroaxis', 'ylabel', 'yrange', '{no}ytics', \n\
  298. X    'ymtics', 'ydtics', '{no}yzeroaxis', 'zero', '{no}zeroaxis', 'zlabel', \n\
  299. X    'zrange', '{no}ztics', 'zmtics', 'zdtics'";
  300. X
  301. X    c_token++;
  302. X
  303. X    if (!set_one() && !set_two() && !set_three())
  304. X    int_error(setmess, c_token);
  305. X}
  306. X
  307. X/* return TRUE if a command match, FALSE if not */
  308. Xstatic TBOOLEAN
  309. Xset_one()
  310. X{
  311. X    if (almost_equals(c_token,"ar$row")) {
  312. X        c_token++;
  313. X        set_arrow();
  314. X    }
  315. X    else if (almost_equals(c_token,"noar$row")) {
  316. X        c_token++;
  317. X        set_noarrow();
  318. X    }
  319. X     else if (almost_equals(c_token,"au$toscale")) {
  320. X        c_token++;
  321. X        if (END_OF_COMMAND) {
  322. X           autoscale_r=autoscale_t = autoscale_x = autoscale_y = autoscale_z = TRUE;
  323. X        } else if (equals(c_token, "xy") || equals(c_token, "yx")) {
  324. X           autoscale_x = autoscale_y = TRUE;
  325. X           c_token++;
  326. X        } else if (equals(c_token, "r")) {
  327. X           autoscale_r = TRUE;
  328. X           c_token++;
  329. X        } else if (equals(c_token, "t")) {
  330. X           autoscale_t = TRUE;
  331. X           c_token++;
  332. X        } else if (equals(c_token, "x")) {
  333. X           autoscale_x = TRUE;
  334. X           c_token++;
  335. X        } else if (equals(c_token, "y")) {
  336. X           autoscale_y = TRUE;
  337. X           c_token++;
  338. X        } else if (equals(c_token, "z")) {
  339. X           autoscale_z = TRUE;
  340. X           c_token++;
  341. X        }
  342. X    } 
  343. X    else if (almost_equals(c_token,"noau$toscale")) {
  344. X        c_token++;
  345. X        if (END_OF_COMMAND) {
  346. X           autoscale_r=autoscale_t = autoscale_x = autoscale_y = autoscale_z = FALSE;
  347. X        } else if (equals(c_token, "xy") || equals(c_token, "tyx")) {
  348. X           autoscale_x = autoscale_y = FALSE;
  349. X           c_token++;
  350. X        } else if (equals(c_token, "r")) {
  351. X           autoscale_r = FALSE;
  352. X           c_token++;
  353. X        } else if (equals(c_token, "t")) {
  354. X           autoscale_t = FALSE;
  355. X           c_token++;
  356. X        } else if (equals(c_token, "x")) {
  357. X           autoscale_x = FALSE;
  358. X           c_token++;
  359. X        } else if (equals(c_token, "y")) {
  360. X           autoscale_y = FALSE;
  361. X           c_token++;
  362. X        } else if (equals(c_token, "z")) {
  363. X           autoscale_z = FALSE;
  364. X           c_token++;
  365. X        }
  366. X    } 
  367. X    else if (almost_equals(c_token,"bor$der")) {
  368. X        draw_border = TRUE;
  369. X        c_token++;
  370. X    }
  371. X    else if (almost_equals(c_token,"nobor$der")) {
  372. X        draw_border = FALSE;
  373. X        c_token++;
  374. X    }
  375. X    else if (almost_equals(c_token,"box$width")) {
  376. X        struct value a;
  377. X        c_token++;
  378. X        if (END_OF_COMMAND)
  379. X            boxwidth = -1.0;
  380. X        else
  381. X            boxwidth = magnitude(const_express(&a));
  382. X    }
  383. X    else if (almost_equals(c_token,"c$lip")) {
  384. X        c_token++;
  385. X        if (END_OF_COMMAND)
  386. X         /* assuming same as points */
  387. X         clip_points = TRUE;
  388. X        else if (almost_equals(c_token, "p$oints"))
  389. X         clip_points = TRUE;
  390. X        else if (almost_equals(c_token, "o$ne"))
  391. X         clip_lines1 = TRUE;
  392. X        else if (almost_equals(c_token, "t$wo"))
  393. X         clip_lines2 = TRUE;
  394. X        else
  395. X         int_error("expecting 'points', 'one', or 'two'", c_token);
  396. X        c_token++;
  397. X    }
  398. X    else if (almost_equals(c_token,"noc$lip")) {
  399. X        c_token++;
  400. X        if (END_OF_COMMAND) {
  401. X           /* same as all three */
  402. X           clip_points = FALSE;
  403. X           clip_lines1 = FALSE;
  404. X           clip_lines2 = FALSE;
  405. X        } else if (almost_equals(c_token, "p$oints"))
  406. X         clip_points = FALSE;
  407. X        else if (almost_equals(c_token, "o$ne"))
  408. X         clip_lines1 = FALSE;
  409. X        else if (almost_equals(c_token, "t$wo"))
  410. X         clip_lines2 = FALSE;
  411. X        else
  412. X         int_error("expecting 'points', 'one', or 'two'", c_token);
  413. X        c_token++;
  414. X    }
  415. X    else if (almost_equals(c_token,"hi$dden3d")) {
  416. X#ifdef LITE
  417. X        printf(" Hidden Line Removal Not Supported in LITE version\n");
  418. X#else
  419. X        hidden3d = TRUE;
  420. X#endif /* LITE */
  421. X        c_token++;
  422. X    }
  423. X    else if (almost_equals(c_token,"nohi$dden3d")) {
  424. X#ifdef LITE
  425. X        printf(" Hidden Line Removal Not Supported in LITE version\n");
  426. X#else
  427. X        hidden3d = FALSE;
  428. X#endif /* LITE */
  429. X        c_token++;
  430. X    }
  431. X     else if (almost_equals(c_token,"cla$bel")) {
  432. X         label_contours = TRUE;
  433. X         c_token++;
  434. X     }
  435. X     else if (almost_equals(c_token,"nocla$bel")) {
  436. X         label_contours = FALSE;
  437. X         c_token++;
  438. X      }
  439. X    else if (almost_equals(c_token,"ma$pping3d")) {
  440. X        c_token++;
  441. X        if (END_OF_COMMAND)
  442. X         /* assuming same as points */
  443. X         mapping3d = MAP3D_CARTESIAN;
  444. X        else if (almost_equals(c_token, "ca$rtesian"))
  445. X         mapping3d = MAP3D_CARTESIAN;
  446. X        else if (almost_equals(c_token, "s$pherical"))
  447. X         mapping3d = MAP3D_SPHERICAL;
  448. X        else if (almost_equals(c_token, "cy$lindrical"))
  449. X         mapping3d = MAP3D_CYLINDRICAL;
  450. X        else
  451. X         int_error("expecting 'cartesian', 'spherical', or 'cylindrical'", c_token);
  452. X        c_token++;
  453. X    }
  454. X    else if (almost_equals(c_token,"co$ntour")) {
  455. X        c_token++;
  456. X        if (END_OF_COMMAND)
  457. X         /* assuming same as points */
  458. X         draw_contour = CONTOUR_BASE;
  459. X        else if (almost_equals(c_token, "ba$se"))
  460. X         draw_contour = CONTOUR_BASE;
  461. X        else if (almost_equals(c_token, "s$urface"))
  462. X         draw_contour = CONTOUR_SRF;
  463. X        else if (almost_equals(c_token, "bo$th"))
  464. X         draw_contour = CONTOUR_BOTH;
  465. X        else
  466. X         int_error("expecting 'base', 'surface', or 'both'", c_token);
  467. X        c_token++;
  468. X    }
  469. X    else if (almost_equals(c_token,"noco$ntour")) {
  470. X        c_token++;
  471. X        draw_contour = CONTOUR_NONE;
  472. X    }
  473. X    else if (almost_equals(c_token,"cntrp$aram")) {
  474. X        struct value a;
  475. X
  476. X        c_token++;
  477. X        if (END_OF_COMMAND) {
  478. X         /* assuming same as defaults */
  479. X         contour_pts = 5;
  480. X         contour_kind = CONTOUR_KIND_LINEAR;
  481. X         contour_order = 4;
  482. X         contour_levels = 5;
  483. X          levels_kind = LEVELS_AUTO;
  484. X        }
  485. X        else if (almost_equals(c_token, "p$oints")) {
  486. X         c_token++;
  487. X         contour_pts = (int) real(const_express(&a));
  488. X        }
  489. X        else if (almost_equals(c_token, "li$near")) {
  490. X         c_token++;
  491. X         contour_kind = CONTOUR_KIND_LINEAR;
  492. X        }
  493. X        else if (almost_equals(c_token, "c$ubicspline")) {
  494. X         c_token++;
  495. X         contour_kind = CONTOUR_KIND_CUBIC_SPL;
  496. X        }
  497. X        else if (almost_equals(c_token, "b$spline")) {
  498. X         c_token++;
  499. X         contour_kind = CONTOUR_KIND_BSPLINE;
  500. X        }
  501. X
  502. X           else if (almost_equals(c_token, "le$vels")) {
  503. X               int i=0;  /* local counter */
  504. X               c_token++;
  505. X            /*  RKC: I have modified the next two:
  506. X             *   to use commas to separate list elements as in xtics
  507. X              *   so that incremental lists start,incr[,end]as in "
  508. X              */
  509. X               if (almost_equals(c_token, "di$screte")) {
  510. X                  levels_kind = LEVELS_DISCRETE;
  511. X                  c_token++;
  512. X                if(END_OF_COMMAND)
  513. X                 int_error("expecting discrete level", c_token);
  514. X                else
  515. X                  levels_list[i++] = real(const_express(&a));
  516. X                while(!END_OF_COMMAND){
  517. X                  if (!equals(c_token, ","))
  518. X                    int_error("expecting comma to separate discrete levels", c_token);
  519. X                  c_token++;
  520. X                  levels_list[i++] =  real(const_express(&a));
  521. X                }
  522. X                  contour_levels = i;
  523. X               }
  524. X               else if (almost_equals(c_token, "in$cremental")) {
  525. X                  levels_kind = LEVELS_INCREMENTAL;
  526. X                  c_token++;
  527. X                levels_list[i++] =  real(const_express(&a));
  528. X                if (!equals(c_token, ","))
  529. X                  int_error("expecting comma to separate start,incr levels", c_token);
  530. X                c_token++;
  531. X                if((levels_list[i++] = real(const_express(&a)))==0)
  532. X                  int_error("increment cannot be 0", c_token);
  533. X                 if(!END_OF_COMMAND){
  534. X                  if (!equals(c_token, ","))
  535. X                    int_error("expecting comma to separate incr,stop levels", c_token);
  536. X                  c_token++;
  537. X                 contour_levels = (real(const_express(&a))-levels_list[0])/levels_list[1];
  538. X                  }
  539. X               }
  540. X               else if (almost_equals(c_token, "au$to")) {
  541. X                   levels_kind = LEVELS_AUTO;
  542. X                 c_token++;
  543. X                 if(!END_OF_COMMAND)
  544. X                     contour_levels = (int) real(const_express(&a));
  545. X             }
  546. X             else {
  547. X              if(levels_kind == LEVELS_DISCRETE)
  548. X                int_error("Levels type is discrete, ignoring new number of contour levels", c_token);
  549. X                contour_levels = (int) real(const_express(&a));
  550. X            }
  551. X         }
  552. X        else if (almost_equals(c_token, "o$rder")) {
  553. X         int order;
  554. X         c_token++;
  555. X         order = (int) real(const_express(&a));
  556. X         if ( order < 2 || order > 10 )
  557. X             int_error("bspline order must be in [2..10] range.", c_token);
  558. X         contour_order = order;
  559. X        }
  560. X        else
  561. X         int_error("expecting 'linear', 'cubicspline', 'bspline', 'points', 'levels' or 'order'", c_token);
  562. X        c_token++;
  563. X    }
  564. X    else if (almost_equals(c_token,"da$ta")) {
  565. X        c_token++;
  566. X        if (!almost_equals(c_token,"s$tyle"))
  567. X            int_error("expecting keyword 'style'",c_token);
  568. X        data_style = get_style();
  569. X    }
  570. X    else if (almost_equals(c_token,"dg$rid3d")) {
  571. X        int i;
  572. X        TBOOLEAN was_comma = TRUE;
  573. X        int local_vals[3];
  574. X        struct value a;
  575. X
  576. X        local_vals[0] = dgrid3d_row_fineness;
  577. X        local_vals[1] = dgrid3d_col_fineness;
  578. X        local_vals[2] = dgrid3d_norm_value;
  579. X        c_token++;
  580. X        for (i = 0; i < 3 && !(END_OF_COMMAND);) {
  581. X            if (equals(c_token,",")) {
  582. X                if (was_comma) i++;
  583. X                was_comma = TRUE;
  584. X                c_token++;
  585. X            }
  586. X            else {
  587. X                if (!was_comma)
  588. X                    int_error("',' expected",c_token);
  589. X                local_vals[i] = real(const_express(&a));
  590. X                i++;
  591. X                was_comma = FALSE;
  592. X            }
  593. X        }
  594. X
  595. X
  596. X        if (local_vals[0] < 2 || local_vals[0] > 1000)
  597. X            int_error("Row size must be in [2:1000] range; size unchanged",
  598. X                  c_token);
  599. X        if (local_vals[1] < 2 || local_vals[1] > 1000)
  600. X            int_error("Col size must be in [2:1000] range; size unchanged",
  601. X                  c_token);
  602. X        if (local_vals[2] < 1 || local_vals[2] > 100)
  603. X            int_error("Norm must be in [1:100] range; norm unchanged", c_token);
  604. X
  605. X        dgrid3d_row_fineness = local_vals[0];
  606. X        dgrid3d_col_fineness = local_vals[1];
  607. X        dgrid3d_norm_value = local_vals[2];
  608. X        dgrid3d = TRUE;
  609. X    }
  610. X    else if (almost_equals(c_token,"nodg$rid3d")) {
  611. X        c_token++;
  612. X        dgrid3d = FALSE;
  613. X    }
  614. X    else if (almost_equals(c_token,"du$mmy")) {
  615. X        c_token++;
  616. X        if (END_OF_COMMAND)
  617. X            int_error("expecting dummy variable name", c_token);
  618. X        else {
  619. X            if (!equals(c_token,","))
  620. X                copy_str(dummy_var[0],c_token++);
  621. X            if (!END_OF_COMMAND && equals(c_token,",")) {
  622. X                c_token++;
  623. X                if (END_OF_COMMAND)
  624. X                    int_error("expecting second dummy variable name", c_token);
  625. X                copy_str(dummy_var[1],c_token++);
  626. X                }
  627. X        }
  628. X    }
  629. X    else if (almost_equals(c_token,"fo$rmat")) {
  630. X        TBOOLEAN setx, sety, setz;
  631. X        c_token++;
  632. X        if (equals(c_token,"x")) {
  633. X            setx = TRUE; sety = setz = FALSE;
  634. X            c_token++;
  635. X        }
  636. X        else if (equals(c_token,"y")) {
  637. X            setx = setz = FALSE; sety = TRUE;
  638. X            c_token++;
  639. X        }
  640. X        else if (equals(c_token,"z")) {
  641. X            setx = sety = FALSE; setz = TRUE;
  642. X            c_token++;
  643. X        }
  644. X        else if (equals(c_token,"xy") || equals(c_token,"yx")) {
  645. X            setx = sety = TRUE; setz = FALSE;
  646. X            c_token++;
  647. X        }
  648. X        else if (isstring(c_token) || END_OF_COMMAND) {
  649. X            /* Assume he wants all */
  650. X            setx = sety = setz = TRUE;
  651. X        }
  652. X        if (END_OF_COMMAND) {
  653. X            if (setx)
  654. X                (void) strcpy(xformat,DEF_FORMAT);
  655. X            if (sety)
  656. X                (void) strcpy(yformat,DEF_FORMAT);
  657. X            if (setz)
  658. X                (void) strcpy(zformat,DEF_FORMAT);
  659. X        }
  660. X        else {
  661. X            if (!isstring(c_token))
  662. X              int_error("expecting format string",c_token);
  663. X            else {
  664. X                if (setx)
  665. X                 quote_str(xformat,c_token);
  666. X                if (sety)
  667. X                 quote_str(yformat,c_token);
  668. X                if (setz)
  669. X                 quote_str(zformat,c_token);
  670. X                c_token++;
  671. X            }
  672. X        }
  673. X    }
  674. X    else if (almost_equals(c_token,"fu$nction")) {
  675. X        c_token++;
  676. X        if (!almost_equals(c_token,"s$tyle"))
  677. X            int_error("expecting keyword 'style'",c_token);
  678. X        func_style = get_style();
  679. X    }
  680. X    else if (almost_equals(c_token,"la$bel")) {
  681. X        c_token++;
  682. X        set_label();
  683. X    }
  684. X    else if (almost_equals(c_token,"nola$bel")) {
  685. X        c_token++;
  686. X        set_nolabel();
  687. X    }
  688. X    else if (almost_equals(c_token,"lo$gscale")) {
  689. X        c_token++;
  690. X        if (END_OF_COMMAND) {
  691. X        is_log_x = is_log_y = is_log_z = TRUE;
  692. X        base_log_x = base_log_y = base_log_z = 10.0;
  693. X        log_base_log_x = log_base_log_y = log_base_log_z = log(10.0);
  694. X        } else {
  695. X        TBOOLEAN change_x = FALSE;
  696. X        TBOOLEAN change_y = FALSE;
  697. X        TBOOLEAN change_z = FALSE;
  698. X        if (chr_in_str(c_token, 'x'))
  699. X            change_x = TRUE;
  700. X        if (chr_in_str(c_token, 'y'))
  701. X            change_y = TRUE;
  702. X        if (chr_in_str(c_token, 'z'))
  703. X            change_z = TRUE;
  704. X        c_token++;
  705. X                if (END_OF_COMMAND) {
  706. X            if (change_x) {
  707. X            is_log_x = TRUE;
  708. X            base_log_x = 10.0;
  709. X            log_base_log_x = log(10.0);
  710. X            }
  711. X            if (change_y) {
  712. X            is_log_y = TRUE;
  713. X            base_log_y = 10.0;
  714. X            log_base_log_y = log(10.0);
  715. X            }
  716. X            if (change_z) {
  717. X            is_log_z = TRUE;
  718. X            base_log_z = 10.0;
  719. X            log_base_log_z = log(10.0);
  720. X            }
  721. X        } else {
  722. X            struct value a;
  723. X            double newbase = magnitude(const_express(&a));
  724. X            c_token++;
  725. X            if (newbase < 1.1)
  726. X            int_error("log base must be >= 1.1; logscale unchanged",
  727. X                c_token);
  728. X            else {
  729. X            if (change_x) {
  730. X                is_log_x = TRUE;
  731. X                base_log_x = newbase;
  732. X                log_base_log_x = log(newbase);
  733. X            }
  734. X            if (change_y) {
  735. X                is_log_y = TRUE;
  736. X                base_log_y = newbase;
  737. X                log_base_log_y = log(newbase);
  738. X            }
  739. X            if (change_z) {
  740. X                is_log_z = TRUE;
  741. X                base_log_z = newbase;
  742. X                log_base_log_z = log(newbase);
  743. X            }
  744. X            }
  745. X        }
  746. X        }
  747. X    }
  748. X    else if (almost_equals(c_token,"nolo$gscale")) {
  749. X        c_token++;
  750. X        if (END_OF_COMMAND) {
  751. X        is_log_x = is_log_y = is_log_z = FALSE;
  752. X        } else {
  753. X        if (chr_in_str(c_token, 'x')) {
  754. X            is_log_x = FALSE;
  755. X            base_log_x = 0.0;
  756. X            log_base_log_x = 0.0;
  757. X                }
  758. X        if (chr_in_str(c_token, 'y')) {
  759. X            is_log_y = FALSE;
  760. X            base_log_y = 0.0;
  761. X            log_base_log_y = 0.0;
  762. X                }
  763. X        if (chr_in_str(c_token, 'z')) {
  764. X            is_log_z = FALSE;
  765. X            base_log_z = 0.0;
  766. X            log_base_log_z = 0.0;
  767. X                }
  768. X        c_token++;
  769. X        }
  770. X    } 
  771. X    else if (almost_equals(c_token,"of$fsets")) {
  772. X        c_token++;
  773. X        if (END_OF_COMMAND) {
  774. X            loff = roff = toff = boff = 0.0;  /* Reset offsets */
  775. X        }
  776. X        else {
  777. X            load_offsets (&loff,&roff,&toff,&boff);
  778. X        }
  779. X    }
  780. X    else
  781. X        return(FALSE);    /* no command match */
  782. X    return(TRUE);
  783. X}
  784. X
  785. X
  786. X/* return TRUE if a command match, FALSE if not */
  787. Xstatic TBOOLEAN
  788. Xset_two()
  789. X{
  790. X     char testfile[MAX_LINE_LEN+1];
  791. X#if defined(unix) || defined(PIPES)
  792. X     static TBOOLEAN pipe_open = FALSE;
  793. X#endif /* unix || PIPES */
  794. X
  795. X    if (almost_equals(c_token,"o$utput")) {
  796. X        register FILE *f;
  797. X
  798. X        c_token++;
  799. X        if (term && term_init)
  800. X            (*term_tbl[term].reset)();
  801. X        if (END_OF_COMMAND) {    /* no file specified */
  802. X             UP_redirect (4);
  803. X            if (outfile != stdout) { /* Never close stdout */
  804. X#if defined(unix) || defined(PIPES)
  805. X                if ( pipe_open ) {
  806. X                    (void) pclose(outfile);
  807. X                    pipe_open = FALSE;
  808. X                } else
  809. X#endif /* unix || PIPES */
  810. X#ifdef _Windows
  811. X                  if ( !stricmp(outstr,"'PRN'") )
  812. X                    close_printer();
  813. X                  else
  814. X#endif
  815. X                    (void) fclose(outfile);
  816. X            }
  817. X            outfile = stdout; /* Don't dup... */
  818. X            term_init = FALSE;
  819. X            (void) strcpy(outstr,"STDOUT");
  820. X        } else if (!isstring(c_token))
  821. X            int_error("expecting filename",c_token);
  822. X        else {
  823. X            quote_str(testfile,c_token);
  824. X#if defined(unix) || defined(PIPES)
  825. X            if ( *testfile == '|' ) {
  826. X              if ((f = popen(testfile+1,"w")) == (FILE *)NULL)
  827. X                os_error("cannot create pipe; output not changed",c_token);
  828. X              else
  829. X                pipe_open = TRUE;
  830. X            } else
  831. X#endif /* unix || PIPES */
  832. X#ifdef _Windows
  833. X            if ( !stricmp(outstr,"'PRN'") ) {
  834. X                /* we can't call open_printer() while printer is open, so */
  835. X                close_printer();    /* close printer immediately if open */
  836. X                outfile = stdout;    /* and reset output to stdout */
  837. X                term_init = FALSE;
  838. X                (void) strcpy(outstr,"STDOUT");
  839. X            }
  840. X            if ( !stricmp(testfile,"PRN") ) {
  841. X              if ((f = open_printer()) == (FILE *)NULL)
  842. X                os_error("cannot open printer temporary file; output may have changed",c_token);
  843. X            } else
  844. X#endif
  845. X              if ((f = fopen(testfile,"w")) == (FILE *)NULL)
  846. X                os_error("cannot open file; output not changed",c_token);
  847. X            if (outfile != stdout) /* Never close stdout */
  848. X#if defined(unix) || defined(PIPES)
  849. X                if( pipe_open ) {
  850. X                (void) pclose(outfile);
  851. X                pipe_open=FALSE;
  852. X                } else
  853. X#endif /* unix || PIPES */
  854. X                (void) fclose(outfile);
  855. X            outfile = f;
  856. X            term_init = FALSE;
  857. X            outstr[0] = '\'';
  858. X            (void) strcat(strcpy(outstr+1,testfile),"'");
  859. X             UP_redirect (1);
  860. X        }
  861. X        c_token++;
  862. X    }
  863. X    else if (almost_equals(c_token,"tit$le")) {
  864. X        set_xyzlabel(title,&title_xoffset,&title_yoffset);
  865. X    }
  866. X    else if (almost_equals(c_token,"xl$abel")) {
  867. X        set_xyzlabel(xlabel,&xlabel_xoffset,&xlabel_yoffset);
  868. X    }
  869. X    else if (almost_equals(c_token,"yl$abel")) {
  870. X        set_xyzlabel(ylabel,&ylabel_xoffset,&ylabel_yoffset);
  871. X    }
  872. X    else if (almost_equals(c_token,"zl$abel")) {
  873. X        set_xyzlabel(zlabel,&zlabel_xoffset,&zlabel_yoffset);
  874. X    }
  875. X    else if (almost_equals(c_token,"xzero$axis")) {
  876. X        c_token++;
  877. X        xzeroaxis = TRUE;
  878. X    } 
  879. X    else if (almost_equals(c_token,"yzero$axis")) {
  880. X        c_token++;
  881. X        yzeroaxis = TRUE;
  882. X    } 
  883. X    else if (almost_equals(c_token,"zeroa$xis")) {
  884. X        c_token++;
  885. X        yzeroaxis = TRUE;
  886. X        xzeroaxis = TRUE;
  887. X    } 
  888. X    else if (almost_equals(c_token,"noxzero$axis")) {
  889. X        c_token++;
  890. X        xzeroaxis = FALSE;
  891. X    } 
  892. X    else if (almost_equals(c_token,"noyzero$axis")) {
  893. X        c_token++;
  894. X        yzeroaxis = FALSE;
  895. X    } 
  896. X    else if (almost_equals(c_token,"nozero$axis")) {
  897. X        c_token++;
  898. X        xzeroaxis = FALSE;
  899. X        yzeroaxis = FALSE;
  900. X    } 
  901. X    else if (almost_equals(c_token,"par$ametric")) {
  902. X        if (!parametric) {
  903. X           parametric = TRUE;
  904. X           strcpy (dummy_var[0], "t");
  905. X           strcpy (dummy_var[1], "y");
  906. X           if (interactive)
  907. X             (void) fprintf(stderr,"\n\tdummy variable is t for curves, u/v for surfaces\n");
  908. X        }
  909. X        c_token++;
  910. X    }
  911. X    else if (almost_equals(c_token,"nopar$ametric")) {
  912. X        if (parametric) {
  913. X           parametric = FALSE;
  914. X           strcpy (dummy_var[0], "x");
  915. X           strcpy (dummy_var[1], "y");
  916. X           if (interactive)
  917. X             (void) fprintf(stderr,"\n\tdummy variable is x for curves, x/y for surfaces\n");
  918. X        }
  919. X        c_token++;
  920. X    }
  921. X    else if (almost_equals(c_token,"pol$ar")) {
  922. X        if (!polar) {
  923. X            polar = TRUE;
  924. X            if (parametric) {
  925. X                tmin = 0.0;
  926. X                tmax = 2*Pi;
  927. X            } else if (angles_format == ANGLES_DEGREES) {
  928. X                xmin = 0.0;
  929. X                xmax = 360.0;
  930. X            } else {
  931. X                xmin = 0.0;
  932. X                xmax = 2*Pi;
  933. X            }
  934. X        }
  935. X        c_token++;
  936. X    }
  937. X    else if (almost_equals(c_token,"nopo$lar")) {
  938. X        if (polar) {
  939. X            polar = FALSE;
  940. X            if (parametric) {
  941. X                tmin = -5.0;
  942. X                tmax = 5.0;
  943. X            } else {
  944. X                xmin = -10.0;
  945. X                xmax = 10.0;
  946. X            }
  947. X        }
  948. X        c_token++;
  949. X    }
  950. X    else if (almost_equals(c_token,"an$gles")) {
  951. X        c_token++;
  952. X        if (END_OF_COMMAND) {
  953. X        /* assuming same as defaults */
  954. X        angles_format = ANGLES_RADIANS;
  955. X        }
  956. X        else if (almost_equals(c_token, "r$adians")) {
  957. X        angles_format = ANGLES_RADIANS;
  958. X        c_token++;
  959. X        }
  960. X        else if (almost_equals(c_token, "d$egrees")) {
  961. X        angles_format = ANGLES_DEGREES;
  962. X        c_token++;
  963. X        }
  964. X        else
  965. X         int_error("expecting 'radians' or 'degrees'", c_token);
  966. X    }
  967. X    else if (almost_equals(c_token,"g$rid")) {
  968. X        grid = TRUE;
  969. X        c_token++;
  970. X    }
  971. X    else if (almost_equals(c_token,"nog$rid")) {
  972. X        grid = FALSE;
  973. X        c_token++;
  974. X    }
  975. X    else if (almost_equals(c_token,"su$rface")) {
  976. X        draw_surface = TRUE;
  977. X        c_token++;
  978. X    }
  979. X    else if (almost_equals(c_token,"nosu$rface")) {
  980. X        draw_surface = FALSE;
  981. X        c_token++;
  982. X    }
  983. X    else if (almost_equals(c_token,"k$ey")) {
  984. X        struct value a;
  985. X        c_token++;
  986. X        if (END_OF_COMMAND) {
  987. X            key = -1;
  988. X        } 
  989. X        else {
  990. X            key_x = real(const_express(&a));
  991. X            if (!equals(c_token,","))
  992. X                int_error("',' expected",c_token);
  993. X            c_token++;
  994. X            key_y = real(const_express(&a));
  995. X            if (equals(c_token,","))
  996. X            {
  997. X                    c_token++;
  998. X                key_z = real(const_express(&a));
  999. X            }
  1000. X            key = 1;
  1001. X        } 
  1002. X    }
  1003. X    else if (almost_equals(c_token,"nok$ey")) {
  1004. X        key = 0;
  1005. X        c_token++;
  1006. X    }
  1007. X    else if (almost_equals(c_token,"tic$s")) {
  1008. X        tic_in = TRUE;
  1009. X        c_token++;
  1010. X        if (almost_equals(c_token,"i$n")) {
  1011. X            tic_in = TRUE;
  1012. X            c_token++;
  1013. X        }
  1014. X        else if (almost_equals(c_token,"o$ut")) {
  1015. X            tic_in = FALSE;
  1016. X            c_token++;
  1017. X        }
  1018. X    }
  1019. X     else if (almost_equals(c_token,"xmt$ics")) {
  1020. X     xtics = TRUE;
  1021. X     c_token++;
  1022. X     if(xticdef.type == TIC_USER){
  1023. X         free_marklist(xticdef.def.user);
  1024. X         xticdef.def.user = NULL;
  1025. X     }
  1026. X    xticdef.type = TIC_MONTH;
  1027. X     }
  1028. X     else if (almost_equals(c_token,"xdt$ics")) {
  1029. X     xtics = TRUE;
  1030. X     c_token++;
  1031. X     if(xticdef.type == TIC_USER){
  1032. X         free_marklist(xticdef.def.user);
  1033. X         xticdef.def.user = NULL;
  1034. X     }
  1035. X    xticdef.type = TIC_DAY;
  1036. X     }
  1037. X     else if (almost_equals(c_token,"xt$ics")) {
  1038. X        xtics = TRUE;
  1039. X        c_token++;
  1040. X        if (END_OF_COMMAND) { /* reset to default */
  1041. X           if (xticdef.type == TIC_USER) {
  1042. X              free_marklist(xticdef.def.user);
  1043. X              xticdef.def.user = NULL;
  1044. X           }
  1045. X           xticdef.type = TIC_COMPUTED;
  1046. X        }
  1047. X        else
  1048. X         load_tics(&xticdef);
  1049. X    } 
  1050. X     else if (almost_equals(c_token,"noxt$ics")) {
  1051. X        xtics = FALSE;
  1052. X        c_token++;
  1053. X    } 
  1054. X     else if (almost_equals(c_token,"ymt$ics")) {
  1055. X     ytics = TRUE;
  1056. X     c_token++;
  1057. X     if(yticdef.type == TIC_USER){
  1058. X         free_marklist(yticdef.def.user);
  1059. X         yticdef.def.user = NULL;
  1060. X     }
  1061. X    yticdef.type = TIC_MONTH;
  1062. X     }
  1063. X     else if (almost_equals(c_token,"ydt$ics")) {
  1064. X     ytics = TRUE;
  1065. X     c_token++;
  1066. X     if(yticdef.type == TIC_USER){
  1067. X         free_marklist(yticdef.def.user);
  1068. X         yticdef.def.user = NULL;
  1069. X     }
  1070. X    yticdef.type = TIC_DAY;
  1071. X     }
  1072. X     else if (almost_equals(c_token,"yt$ics")) {
  1073. X        ytics = TRUE;
  1074. X        c_token++;
  1075. X        if (END_OF_COMMAND) { /* reset to default */
  1076. X           if (yticdef.type == TIC_USER) {
  1077. X              free_marklist(yticdef.def.user);
  1078. X              yticdef.def.user = NULL;
  1079. X           }
  1080. X           yticdef.type = TIC_COMPUTED;
  1081. X        }
  1082. X        else
  1083. X         load_tics(&yticdef);
  1084. X    } 
  1085. X     else if (almost_equals(c_token,"noyt$ics")) {
  1086. X        ytics = FALSE;
  1087. X        c_token++;
  1088. X    } 
  1089. X     else if (almost_equals(c_token,"zmt$ics")) {
  1090. X     ztics = TRUE;
  1091. X     c_token++;
  1092. X     if(zticdef.type == TIC_USER){
  1093. X         free_marklist(zticdef.def.user);
  1094. X         zticdef.def.user = NULL;
  1095. X     }
  1096. X    zticdef.type = TIC_MONTH;
  1097. X     }
  1098. X     else if (almost_equals(c_token,"zdt$ics")) {
  1099. X     ztics = TRUE;
  1100. X     c_token++;
  1101. X     if(zticdef.type == TIC_USER){
  1102. X         free_marklist(zticdef.def.user);
  1103. X         zticdef.def.user = NULL;
  1104. X     }
  1105. X    zticdef.type = TIC_DAY;
  1106. X     }
  1107. X     else if (almost_equals(c_token,"zt$ics")) {
  1108. X        ztics = TRUE;
  1109. X        c_token++;
  1110. X        if (END_OF_COMMAND) { /* reset to default */
  1111. X           if (zticdef.type == TIC_USER) {
  1112. X              free_marklist(zticdef.def.user);
  1113. X              zticdef.def.user = NULL;
  1114. X           }
  1115. X           zticdef.type = TIC_COMPUTED;
  1116. X        }
  1117. X        else
  1118. X         load_tics(&zticdef);
  1119. X    } 
  1120. X     else if (almost_equals(c_token,"nozt$ics")) {
  1121. X        ztics = FALSE;
  1122. X        c_token++;
  1123. X    } 
  1124. X    else if (almost_equals(c_token,"ticsl$evel")) {
  1125. X        double tlvl;
  1126. X        struct value a;
  1127. X
  1128. X        c_token++;
  1129. X        tlvl = real(const_express(&a));
  1130. X        if (tlvl < 0.0)
  1131. X            int_error("tics level must be > 0; ticslevel unchanged",
  1132. X                c_token);
  1133. X        else {
  1134. X            ticslevel = tlvl;
  1135. X        }
  1136. X    }
  1137. X    else
  1138. X    return(FALSE);    /* no command match */
  1139. X
  1140. X    return(TRUE);
  1141. X}
  1142. X
  1143. X
  1144. X/* return TRUE if a command match, FALSE if not */
  1145. Xstatic TBOOLEAN
  1146. Xset_three()
  1147. X{
  1148. X     if (almost_equals(c_token,"sa$mples")) {
  1149. X        register int tsamp1, tsamp2;
  1150. X        struct value a;
  1151. X
  1152. X        c_token++;
  1153. X        tsamp1 = (int)magnitude(const_express(&a));
  1154. X        tsamp2 = tsamp1;
  1155. X        if (!END_OF_COMMAND) {
  1156. X            if (!equals(c_token,","))
  1157. X                int_error("',' expected",c_token);
  1158. X            c_token++;
  1159. X            tsamp2 = (int)magnitude(const_express(&a));
  1160. X        }
  1161. X        if (tsamp1 < 2 || tsamp2 < 2)
  1162. X            int_error("sampling rate must be > 1; sampling unchanged",
  1163. X                c_token);
  1164. X        else {
  1165. X                extern struct surface_points *first_3dplot;
  1166. X            register struct surface_points *f_3dp = first_3dplot;
  1167. X
  1168. X            first_3dplot = NULL;
  1169. X            sp_free(f_3dp);
  1170. X
  1171. X            samples = tsamp1;
  1172. X            samples_1 = tsamp1;
  1173. X            samples_2 = tsamp2;
  1174. X        }
  1175. X    }
  1176. X    else if (almost_equals(c_token,"isosa$mples")) {
  1177. X        register int tsamp1, tsamp2;
  1178. X        struct value a;
  1179. X
  1180. X        c_token++;
  1181. X        tsamp1 = (int)magnitude(const_express(&a));
  1182. X        tsamp2 = tsamp1;
  1183. X        if (!END_OF_COMMAND) {
  1184. X            if (!equals(c_token,","))
  1185. X                int_error("',' expected",c_token);
  1186. X            c_token++;
  1187. X            tsamp2 = (int)magnitude(const_express(&a));
  1188. X        }
  1189. X        if (tsamp1 < 2 || tsamp2 < 2)
  1190. X            int_error("sampling rate must be > 1; sampling unchanged",
  1191. X                c_token);
  1192. X        else {
  1193. X                extern struct curve_points *first_plot;
  1194. X                extern struct surface_points *first_3dplot;
  1195. X            register struct curve_points *f_p = first_plot;
  1196. X            register struct surface_points *f_3dp = first_3dplot;
  1197. X
  1198. X            first_plot = NULL;
  1199. X            first_3dplot = NULL;
  1200. X            cp_free(f_p);
  1201. X            sp_free(f_3dp);
  1202. X
  1203. X            iso_samples_1 = tsamp1;
  1204. X            iso_samples_2 = tsamp2;
  1205. X        }
  1206. X    }
  1207. X    else if (almost_equals(c_token,"si$ze")) {
  1208. X        struct value s;
  1209. X        c_token++;
  1210. X        if (END_OF_COMMAND) {
  1211. X            xsize = 1.0;
  1212. X            ysize = 1.0;
  1213. X        } 
  1214. X        else {
  1215. X                xsize=real(const_express(&s));
  1216. X                if (!equals(c_token,","))
  1217. X                    int_error("',' expected",c_token);
  1218. X                c_token++;
  1219. X                ysize=real(const_express(&s));
  1220. X        } 
  1221. X    } 
  1222. X    else if (almost_equals(c_token,"t$erminal")) {
  1223. X        c_token++;
  1224. X        if (END_OF_COMMAND) {
  1225. X            list_terms();
  1226. X            screen_ok = FALSE;
  1227. X        }
  1228. X        else {
  1229. X            if (term && term_init) {
  1230. X                (*term_tbl[term].reset)();
  1231. X                (void) fflush(outfile);
  1232. X            }
  1233. X            term = set_term(c_token);
  1234. X            c_token++;
  1235. X
  1236. X            /* get optional mode parameters */
  1237. X            if (term)
  1238. X                (*term_tbl[term].options)();
  1239. X            if (interactive && *term_options)
  1240. X                fprintf(stderr,"Options are '%s'\n",term_options);
  1241. X        }
  1242. X    }
  1243. X    else if (almost_equals(c_token,"tim$e")) {
  1244. X        timedate = TRUE;
  1245. X        c_token++;
  1246. X        if (!END_OF_COMMAND) {
  1247. X            struct value a;
  1248. X
  1249. X            /* We have x,y offsets specified */
  1250. X            if (!equals(c_token,","))
  1251. X                time_xoffset = (int)real(const_express(&a));
  1252. X            if (!END_OF_COMMAND && equals(c_token,",")) {
  1253. X                c_token++;
  1254. X                time_yoffset = (int)real(const_express(&a));
  1255. X            }
  1256. X        }
  1257. X    }
  1258. X    else if (almost_equals(c_token,"not$ime")) {
  1259. X        timedate = FALSE;
  1260. X        c_token++;
  1261. X    }
  1262. X    else if (almost_equals(c_token,"rr$ange")) {
  1263. X         TBOOLEAN changed;
  1264. X        c_token++;
  1265. X        if (!equals(c_token,"["))
  1266. X            int_error("expecting '['",c_token);
  1267. X        c_token++;
  1268. X        changed = load_range(&rmin,&rmax);
  1269. X        if (!equals(c_token,"]"))
  1270. X          int_error("expecting ']'",c_token);
  1271. X        c_token++;
  1272. X        if (changed)
  1273. X          autoscale_r = FALSE;
  1274. X    }
  1275. X    else if (almost_equals(c_token,"tr$ange")) {
  1276. X         TBOOLEAN changed;
  1277. X        c_token++;
  1278. X        if (!equals(c_token,"["))
  1279. X            int_error("expecting '['",c_token);
  1280. X        c_token++;
  1281. X        changed = load_range(&tmin,&tmax);
  1282. X        if (!equals(c_token,"]"))
  1283. X          int_error("expecting ']'",c_token);
  1284. X        c_token++;
  1285. X        if (changed)
  1286. X          autoscale_t = FALSE;
  1287. X    }
  1288. X    else if (almost_equals(c_token,"ur$ange")) {
  1289. X         TBOOLEAN changed;
  1290. X        c_token++;
  1291. X        if (!equals(c_token,"["))
  1292. X            int_error("expecting '['",c_token);
  1293. X        c_token++;
  1294. X        changed = load_range(&umin,&umax);
  1295. X        if (!equals(c_token,"]"))
  1296. X          int_error("expecting ']'",c_token);
  1297. X        c_token++;
  1298. X        if (changed)
  1299. X          autoscale_u = FALSE;
  1300. X    }
  1301. X    else if (almost_equals(c_token,"vi$ew")) {
  1302. X        int i;
  1303. X        TBOOLEAN was_comma = TRUE;
  1304. X        double local_vals[4];
  1305. X        struct value a;
  1306. X
  1307. X        local_vals[0] = surface_rot_x;
  1308. X        local_vals[1] = surface_rot_z;
  1309. X        local_vals[2] = surface_scale;
  1310. X        local_vals[3] = surface_zscale;
  1311. X        c_token++;
  1312. X        for (i = 0; i < 4 && !(END_OF_COMMAND);) {
  1313. X            if (equals(c_token,",")) {
  1314. X                if (was_comma) i++;
  1315. X                was_comma = TRUE;
  1316. X                c_token++;
  1317. X            }
  1318. X            else {
  1319. X                if (!was_comma)
  1320. X                    int_error("',' expected",c_token);
  1321. X                local_vals[i] = real(const_express(&a));
  1322. X                i++;
  1323. X                was_comma = FALSE;
  1324. X            }
  1325. X        }
  1326. X
  1327. X        if (local_vals[0] < 0 || local_vals[0] > 180)
  1328. X            int_error("rot_x must be in [0:180] degrees range; view unchanged",
  1329. X                  c_token);
  1330. X        if (local_vals[1] < 0 || local_vals[1] > 360)
  1331. X            int_error("rot_z must be in [0:360] degrees range; view unchanged",
  1332. X                  c_token);
  1333. X        if (local_vals[2] < 1e-6)
  1334. X            int_error("scale must be > 0; view unchanged", c_token);
  1335. X        if (local_vals[3] < 1e-6)
  1336. X            int_error("zscale must be > 0; view unchanged", c_token);
  1337. X
  1338. X        surface_rot_x = local_vals[0];
  1339. X        surface_rot_z = local_vals[1];
  1340. X        surface_scale = local_vals[2];
  1341. X        surface_zscale = local_vals[3];
  1342. X    }
  1343. X    else if (almost_equals(c_token,"vr$ange")) {
  1344. X         TBOOLEAN changed;
  1345. X        c_token++;
  1346. X        if (!equals(c_token,"["))
  1347. X            int_error("expecting '['",c_token);
  1348. X        c_token++;
  1349. X        changed = load_range(&vmin,&vmax);
  1350. X        if (!equals(c_token,"]"))
  1351. X          int_error("expecting ']'",c_token);
  1352. X        c_token++;
  1353. X        if (changed)
  1354. X          autoscale_v = FALSE;
  1355. X    }
  1356. X    else if (almost_equals(c_token,"xr$ange")) {
  1357. X         TBOOLEAN changed;
  1358. X        c_token++;
  1359. X        if (!equals(c_token,"["))
  1360. X            int_error("expecting '['",c_token);
  1361. X        c_token++;
  1362. X        changed = load_range(&xmin,&xmax);
  1363. X        if (!equals(c_token,"]"))
  1364. X          int_error("expecting ']'",c_token);
  1365. X        c_token++;
  1366. X        if (changed)
  1367. X          autoscale_x = FALSE;
  1368. X    }
  1369. X    else if (almost_equals(c_token,"yr$ange")) {
  1370. X         TBOOLEAN changed;
  1371. X        c_token++;
  1372. X        if (!equals(c_token,"["))
  1373. X            int_error("expecting '['",c_token);
  1374. X        c_token++;
  1375. X        changed = load_range(&ymin,&ymax);
  1376. X        if (!equals(c_token,"]"))
  1377. X          int_error("expecting ']'",c_token);
  1378. X        c_token++;
  1379. X        if (changed)
  1380. X          autoscale_y = FALSE;
  1381. X    }
  1382. X    else if (almost_equals(c_token,"zr$ange")) {
  1383. X         TBOOLEAN changed;
  1384. X        c_token++;
  1385. X        if (!equals(c_token,"["))
  1386. X            int_error("expecting '['",c_token);
  1387. X        c_token++;
  1388. X        changed = load_range(&zmin,&zmax);
  1389. X        if (!equals(c_token,"]"))
  1390. X          int_error("expecting ']'",c_token);
  1391. X        c_token++;
  1392. X        if (changed)
  1393. X          autoscale_z = FALSE;
  1394. X    }
  1395. X    else if (almost_equals(c_token,"z$ero")) {
  1396. X        struct value a;
  1397. X        c_token++;
  1398. X        zero = magnitude(const_express(&a));
  1399. X    }
  1400. X    else
  1401. X        return(FALSE);    /* no command match */
  1402. X    return(TRUE);
  1403. X}
  1404. X
  1405. X/*********** Support functions for set_command ***********/
  1406. X
  1407. X/* process a 'set {x/y/z}label command */
  1408. X/* set {x/y/z}label {label_text} {x}{,y} */
  1409. Xstatic void set_xyzlabel(str,xpos,ypos)
  1410. Xchar *str;
  1411. Xint *xpos,*ypos;
  1412. X{
  1413. X    c_token++;
  1414. X    if (END_OF_COMMAND) {    /* no label specified */
  1415. X        str[0] = '\0';
  1416. X    } else {
  1417. X        if (isstring(c_token)) {
  1418. X            /* We have string specified - grab it. */
  1419. X            quotel_str(str,c_token);
  1420. X            c_token++;
  1421. X        }
  1422. X        if (!END_OF_COMMAND) {
  1423. X            struct value a;
  1424. X
  1425. X            /* We have x,y offsets specified */
  1426. X            if (!equals(c_token,","))
  1427. X                *xpos = (int)real(const_express(&a));
  1428. X            if (!END_OF_COMMAND && equals(c_token,",")) {
  1429. X                c_token++;
  1430. X                *ypos = (int)real(const_express(&a));
  1431. X            }
  1432. X        }
  1433. X    }
  1434. X}
  1435. X
  1436. X/* process a 'set label' command */
  1437. X/* set label {tag} {label_text} {at x,y} {pos} */
  1438. Xstatic void
  1439. Xset_label()
  1440. X{
  1441. X    struct value a;
  1442. X    struct text_label *this_label = NULL;
  1443. X    struct text_label *new_label = NULL;
  1444. X    struct text_label *prev_label = NULL;
  1445. X    double x, y, z;
  1446. X    char text[MAX_LINE_LEN+1];
  1447. X    enum JUSTIFY just;
  1448. X    int tag;
  1449. X    TBOOLEAN set_text, set_position, set_just;
  1450. X
  1451. X    /* get tag */
  1452. X    if (!END_OF_COMMAND 
  1453. X       && !isstring(c_token) 
  1454. X       && !equals(c_token, "at")
  1455. X       && !equals(c_token, "left")
  1456. X       && !equals(c_token, "center")
  1457. X       && !equals(c_token, "centre")
  1458. X       && !equals(c_token, "right")) {
  1459. X       /* must be a tag expression! */
  1460. X       tag = (int)real(const_express(&a));
  1461. X       if (tag <= 0)
  1462. X        int_error("tag must be > zero", c_token);
  1463. X    } else
  1464. X     tag = assign_label_tag(); /* default next tag */
  1465. X     
  1466. X    /* get text */
  1467. X    if (!END_OF_COMMAND && isstring(c_token)) {
  1468. X       /* get text */
  1469. X       quotel_str(text, c_token);
  1470. X       c_token++;
  1471. X       set_text = TRUE;
  1472. X    } else {
  1473. X       text[0] = '\0';        /* default no text */
  1474. X       set_text = FALSE;
  1475. X    }
  1476. X     
  1477. X    /* get justification - what the heck, let him put it here */
  1478. X    if (!END_OF_COMMAND && !equals(c_token, "at")) {
  1479. X       if (almost_equals(c_token,"l$eft")) {
  1480. X          just = LEFT;
  1481. X       }
  1482. X       else if (almost_equals(c_token,"c$entre")
  1483. X              || almost_equals(c_token,"c$enter")) {
  1484. X          just = CENTRE;
  1485. X       }
  1486. X       else if (almost_equals(c_token,"r$ight")) {
  1487. X          just = RIGHT;
  1488. X       }
  1489. X       else
  1490. X        int_error("bad syntax in set label", c_token);
  1491. X       c_token++;
  1492. X       set_just = TRUE;
  1493. X    } else {
  1494. X       just = LEFT;            /* default left justified */
  1495. X       set_just = FALSE;
  1496. X    } 
  1497. X
  1498. X    /* get position */
  1499. X    if (!END_OF_COMMAND && equals(c_token, "at")) {
  1500. X       c_token++;
  1501. X       if (END_OF_COMMAND)
  1502. X        int_error("coordinates expected", c_token);
  1503. X       /* get coordinates */
  1504. X       x = real(const_express(&a));
  1505. X       if (!equals(c_token,","))
  1506. X        int_error("',' expected",c_token);
  1507. X       c_token++;
  1508. X       y = real(const_express(&a));
  1509. X       if (equals(c_token,",")) {
  1510. X        c_token++;
  1511. X        z = real(const_express(&a));
  1512. X       }
  1513. X       else
  1514. X            z = 0;
  1515. X       set_position = TRUE;
  1516. X    } else {
  1517. X       x = y = z = 0;            /* default at origin */
  1518. X       set_position = FALSE;
  1519. X    }
  1520. X
  1521. X    /* get justification */
  1522. X    if (!END_OF_COMMAND) {
  1523. X       if (set_just)
  1524. X        int_error("only one justification is allowed", c_token);
  1525. X       if (almost_equals(c_token,"l$eft")) {
  1526. X          just = LEFT;
  1527. X       }
  1528. X       else if (almost_equals(c_token,"c$entre")
  1529. X              || almost_equals(c_token,"c$enter")) {
  1530. X          just = CENTRE;
  1531. X       }
  1532. X       else if (almost_equals(c_token,"r$ight")) {
  1533. X          just = RIGHT;
  1534. X       }
  1535. X       else
  1536. X        int_error("bad syntax in set label", c_token);
  1537. X       c_token++;
  1538. X       set_just = TRUE;
  1539. X    } 
  1540. X
  1541. X    if (!END_OF_COMMAND)
  1542. X     int_error("extraenous or out-of-order arguments in set label", c_token);
  1543. X
  1544. X    /* OK! add label */
  1545. X    if (first_label != NULL) { /* skip to last label */
  1546. X       for (this_label = first_label; this_label != NULL ; 
  1547. X           prev_label = this_label, this_label = this_label->next)
  1548. X        /* is this the label we want? */
  1549. X        if (tag <= this_label->tag)
  1550. X          break;
  1551. X    }
  1552. X    if (this_label != NULL && tag == this_label->tag) {
  1553. X       /* changing the label */
  1554. X       if (set_position) {
  1555. X          this_label->x = x;
  1556. X          this_label->y = y;
  1557. X          this_label->z = z;
  1558. X       }
  1559. X       if (set_text)
  1560. X        (void) strcpy(this_label->text, text);
  1561. X       if (set_just)
  1562. X        this_label->pos = just;
  1563. X    } else {
  1564. X       /* adding the label */
  1565. X       new_label = (struct text_label *) 
  1566. X        alloc ( (unsigned long) sizeof(struct text_label), "label");
  1567. X       if (prev_label != NULL)
  1568. X        prev_label->next = new_label; /* add it to end of list */
  1569. X       else 
  1570. X        first_label = new_label; /* make it start of list */
  1571. X       new_label->tag = tag;
  1572. X       new_label->next = this_label;
  1573. X       new_label->x = x;
  1574. X       new_label->y = y;
  1575. X       new_label->z = z;
  1576. X       (void) strcpy(new_label->text, text);
  1577. X       new_label->pos = just;
  1578. X    }
  1579. X}
  1580. X
  1581. X/* process 'set nolabel' command */
  1582. X/* set nolabel {tag} */
  1583. Xstatic void
  1584. Xset_nolabel()
  1585. X{
  1586. X    struct value a;
  1587. X    struct text_label *this_label;
  1588. X    struct text_label *prev_label; 
  1589. X    int tag;
  1590. X
  1591. X    if (END_OF_COMMAND) {
  1592. X       /* delete all labels */
  1593. X       while (first_label != NULL)
  1594. X        delete_label((struct text_label *)NULL,first_label);
  1595. X    }
  1596. X    else {
  1597. X       /* get tag */
  1598. X       tag = (int)real(const_express(&a));
  1599. X       if (!END_OF_COMMAND)
  1600. X        int_error("extraneous arguments to set nolabel", c_token);
  1601. X       for (this_label = first_label, prev_label = NULL;
  1602. X           this_label != NULL;
  1603. X           prev_label = this_label, this_label = this_label->next) {
  1604. X          if (this_label->tag == tag) {
  1605. X             delete_label(prev_label,this_label);
  1606. X             return;        /* exit, our job is done */
  1607. X          }
  1608. X       }
  1609. X       int_error("label not found", c_token);
  1610. X    }
  1611. X}
  1612. X
  1613. X/* assign a new label tag */
  1614. X/* labels are kept sorted by tag number, so this is easy */
  1615. Xstatic int                /* the lowest unassigned tag number */
  1616. Xassign_label_tag()
  1617. X{
  1618. X    struct text_label *this_label;
  1619. X    int last = 0;            /* previous tag value */
  1620. X
  1621. X    for (this_label = first_label; this_label != NULL;
  1622. X        this_label = this_label->next)
  1623. X     if (this_label->tag == last+1)
  1624. X       last++;
  1625. X     else
  1626. X       break;
  1627. X    
  1628. X    return (last+1);
  1629. X}
  1630. X
  1631. X/* delete label from linked list started by first_label.
  1632. X * called with pointers to the previous label (prev) and the 
  1633. X * label to delete (this).
  1634. X * If there is no previous label (the label to delete is
  1635. X * first_label) then call with prev = NULL.
  1636. X */
  1637. Xstatic void
  1638. Xdelete_label(prev,this)
  1639. X    struct text_label *prev, *this;
  1640. X{
  1641. X    if (this!=NULL)    {        /* there really is something to delete */
  1642. X       if (prev!=NULL)        /* there is a previous label */
  1643. X        prev->next = this->next; 
  1644. X       else                /* this = first_label so change first_label */
  1645. X        first_label = this->next;
  1646. X       free((char *)this);
  1647. X    }
  1648. X}
  1649. X
  1650. X
  1651. X/* process a 'set arrow' command */
  1652. X/* set arrow {tag} {from x,y} {to x,y} {{no}head} */
  1653. Xstatic void
  1654. Xset_arrow()
  1655. X{
  1656. X    struct value a;
  1657. X    struct arrow_def *this_arrow = NULL;
  1658. X    struct arrow_def *new_arrow = NULL;
  1659. X    struct arrow_def *prev_arrow = NULL;
  1660. X    double sx, sy, sz;
  1661. X    double ex, ey, ez;
  1662. X    int tag;
  1663. X    TBOOLEAN set_start, set_end, head = 1;
  1664. X
  1665. X    /* get tag */
  1666. X    if (!END_OF_COMMAND 
  1667. X       && !equals(c_token, "from")
  1668. X       && !equals(c_token, "to")) {
  1669. X       /* must be a tag expression! */
  1670. X       tag = (int)real(const_express(&a));
  1671. X       if (tag <= 0)
  1672. X        int_error("tag must be > zero", c_token);
  1673. X    } else
  1674. X     tag = assign_arrow_tag(); /* default next tag */
  1675. X     
  1676. X    /* get start position */
  1677. X    if (!END_OF_COMMAND && equals(c_token, "from")) {
  1678. X       c_token++;
  1679. X       if (END_OF_COMMAND)
  1680. X        int_error("start coordinates expected", c_token);
  1681. X       /* get coordinates */
  1682. X       sx = real(const_express(&a));
  1683. X       if (!equals(c_token,","))
  1684. X        int_error("',' expected",c_token);
  1685. X       c_token++;
  1686. X       sy = real(const_express(&a));
  1687. X       if (equals(c_token,",")) {
  1688. X        c_token++;
  1689. X        sz = real(const_express(&a));
  1690. X       }
  1691. X       else
  1692. X           sz = 0;
  1693. X       set_start = TRUE;
  1694. X    } else {
  1695. X       sx = sy = sz = 0;            /* default at origin */
  1696. X       set_start = FALSE;
  1697. X    }
  1698. X
  1699. X    /* get end position */
  1700. X    if (!END_OF_COMMAND && equals(c_token, "to")) {
  1701. X       c_token++;
  1702. X       if (END_OF_COMMAND)
  1703. X        int_error("end coordinates expected", c_token);
  1704. X       /* get coordinates */
  1705. X       ex = real(const_express(&a));
  1706. X       if (!equals(c_token,","))
  1707. X        int_error("',' expected",c_token);
  1708. X       c_token++;
  1709. X       ey = real(const_express(&a));
  1710. X       if (equals(c_token,",")) {
  1711. X        c_token++;
  1712. X        ez = real(const_express(&a));
  1713. X       }
  1714. X       else
  1715. X        ez = 0;
  1716. X       set_end = TRUE;
  1717. X    } else {
  1718. X       ex = ey = ez = 0;            /* default at origin */
  1719. X       set_end = FALSE;
  1720. X    }
  1721. X
  1722. X    /* get start position - what the heck, either order is ok */
  1723. X    if (!END_OF_COMMAND && equals(c_token, "from")) {
  1724. X       if (set_start)
  1725. X        int_error("only one 'from' is allowed", c_token);
  1726. X       c_token++;
  1727. X       if (END_OF_COMMAND)
  1728. X        int_error("start coordinates expected", c_token);
  1729. X       /* get coordinates */
  1730. X       sx = real(const_express(&a));
  1731. X       if (!equals(c_token,","))
  1732. X        int_error("',' expected",c_token);
  1733. X       c_token++;
  1734. X       sy = real(const_express(&a));
  1735. X       if (equals(c_token,",")) {
  1736. X        c_token++;
  1737. X        sz = real(const_express(&a));
  1738. X       }
  1739. X       else
  1740. X           sz = 0;
  1741. X       set_start = TRUE;
  1742. X    }
  1743. X
  1744. X    if (!END_OF_COMMAND && equals(c_token, "nohead")) {
  1745. X       c_token++;
  1746. X           head = 0;
  1747. X    }
  1748. X
  1749. X    if (!END_OF_COMMAND && equals(c_token, "head")) {
  1750. X       c_token++;
  1751. X           head = 1;
  1752. X    }
  1753. X
  1754. X    if (!END_OF_COMMAND)
  1755. X     int_error("extraneous or out-of-order arguments in set arrow", c_token);
  1756. X
  1757. X    /* OK! add arrow */
  1758. X    if (first_arrow != NULL) { /* skip to last arrow */
  1759. X       for (this_arrow = first_arrow; this_arrow != NULL ; 
  1760. X           prev_arrow = this_arrow, this_arrow = this_arrow->next)
  1761. X        /* is this the arrow we want? */
  1762. X        if (tag <= this_arrow->tag)
  1763. X          break;
  1764. X    }
  1765. X    if (this_arrow != NULL && tag == this_arrow->tag) {
  1766. X       /* changing the arrow */
  1767. X       if (set_start) {
  1768. X          this_arrow->sx = sx;
  1769. X          this_arrow->sy = sy;
  1770. X          this_arrow->sz = sz;
  1771. X       }
  1772. X       if (set_end) {
  1773. X          this_arrow->ex = ex;
  1774. X          this_arrow->ey = ey;
  1775. X          this_arrow->ez = ez;
  1776. X       }
  1777. X       this_arrow->head = head;
  1778. X    } else {
  1779. X       /* adding the arrow */
  1780. X       new_arrow = (struct arrow_def *) 
  1781. X        alloc ( (unsigned long) sizeof(struct arrow_def), "arrow");
  1782. X       if (prev_arrow != NULL)
  1783. X        prev_arrow->next = new_arrow; /* add it to end of list */
  1784. X       else 
  1785. X        first_arrow = new_arrow; /* make it start of list */
  1786. X       new_arrow->tag = tag;
  1787. X       new_arrow->next = this_arrow;
  1788. X       new_arrow->sx = sx;
  1789. X       new_arrow->sy = sy;
  1790. X       new_arrow->sz = sz;
  1791. X       new_arrow->ex = ex;
  1792. X       new_arrow->ey = ey;
  1793. X       new_arrow->ez = ez;
  1794. X       new_arrow->head = head;
  1795. X    }
  1796. X}
  1797. X
  1798. X/* process 'set noarrow' command */
  1799. X/* set noarrow {tag} */
  1800. Xstatic void
  1801. Xset_noarrow()
  1802. X{
  1803. X    struct value a;
  1804. X    struct arrow_def *this_arrow;
  1805. X    struct arrow_def *prev_arrow; 
  1806. X    int tag;
  1807. X
  1808. X    if (END_OF_COMMAND) {
  1809. X       /* delete all arrows */
  1810. X       while (first_arrow != NULL)
  1811. X        delete_arrow((struct arrow_def *)NULL,first_arrow);
  1812. X    }
  1813. X    else {
  1814. X       /* get tag */
  1815. X       tag = (int)real(const_express(&a));
  1816. X       if (!END_OF_COMMAND)
  1817. X        int_error("extraneous arguments to set noarrow", c_token);
  1818. X       for (this_arrow = first_arrow, prev_arrow = NULL;
  1819. X           this_arrow != NULL;
  1820. X           prev_arrow = this_arrow, this_arrow = this_arrow->next) {
  1821. X          if (this_arrow->tag == tag) {
  1822. X             delete_arrow(prev_arrow,this_arrow);
  1823. X             return;        /* exit, our job is done */
  1824. X          }
  1825. X       }
  1826. X       int_error("arrow not found", c_token);
  1827. X    }
  1828. X}
  1829. X
  1830. X/* assign a new arrow tag */
  1831. X/* arrows are kept sorted by tag number, so this is easy */
  1832. Xstatic int                /* the lowest unassigned tag number */
  1833. Xassign_arrow_tag()
  1834. X{
  1835. X    struct arrow_def *this_arrow;
  1836. X    int last = 0;            /* previous tag value */
  1837. X
  1838. X    for (this_arrow = first_arrow; this_arrow != NULL;
  1839. X        this_arrow = this_arrow->next)
  1840. X     if (this_arrow->tag == last+1)
  1841. X       last++;
  1842. X     else
  1843. X       break;
  1844. X
  1845. X    return (last+1);
  1846. X}
  1847. X
  1848. X/* delete arrow from linked list started by first_arrow.
  1849. X * called with pointers to the previous arrow (prev) and the 
  1850. X * arrow to delete (this).
  1851. X * If there is no previous arrow (the arrow to delete is
  1852. X * first_arrow) then call with prev = NULL.
  1853. X */
  1854. Xstatic void
  1855. Xdelete_arrow(prev,this)
  1856. X    struct arrow_def *prev, *this;
  1857. X{
  1858. X    if (this!=NULL)    {        /* there really is something to delete */
  1859. X       if (prev!=NULL)        /* there is a previous arrow */
  1860. X        prev->next = this->next; 
  1861. X       else                /* this = first_arrow so change first_arrow */
  1862. X        first_arrow = this->next;
  1863. X       free((char *)this);
  1864. X    }
  1865. X}
  1866. X
  1867. X
  1868. Xenum PLOT_STYLE            /* not static; used by command.c */
  1869. Xget_style()
  1870. X{
  1871. Xregister enum PLOT_STYLE ps;
  1872. X
  1873. X    c_token++;
  1874. X    if (almost_equals(c_token,"l$ines"))
  1875. X        ps = LINES;
  1876. X    else if (almost_equals(c_token,"i$mpulses"))
  1877. X        ps = IMPULSES;
  1878. X    else if (almost_equals(c_token,"p$oints"))
  1879. X        ps = POINTSTYLE;
  1880. X    else if (almost_equals(c_token,"linesp$oints"))
  1881. X        ps = LINESPOINTS;
  1882. X    else if (almost_equals(c_token,"d$ots"))
  1883. X        ps = DOTS;
  1884. X    else if (almost_equals(c_token,"e$rrorbars"))
  1885. X        ps = ERRORBARS;
  1886. X    else if (almost_equals(c_token,"b$oxes"))
  1887. X        ps = BOXES;
  1888. X    else if (almost_equals(c_token,"boxer$rorbars"))
  1889. X        ps = BOXERROR;
  1890. X    else if (almost_equals(c_token,"s$teps"))
  1891. X        ps = STEPS;
  1892. X    else
  1893. X        int_error("expecting 'lines', 'points', 'linespoints', 'dots', 'impulses', \n\
  1894. X        'errorbars', 'steps', 'boxes' or 'boxerrorbars'",c_token);
  1895. X    c_token++;
  1896. X    return(ps);
  1897. X}
  1898. X
  1899. X/* For set [xy]tics... command*/
  1900. Xstatic void
  1901. Xload_tics(tdef)
  1902. X    struct ticdef *tdef;    /* change this ticdef */
  1903. X{
  1904. X    if (equals(c_token,"(")) { /* set : TIC_USER */
  1905. X       c_token++;
  1906. X       load_tic_user(tdef);
  1907. X    } else {                /* series : TIC_SERIES */
  1908. X       load_tic_series(tdef);
  1909. X    }
  1910. X}
  1911. X
  1912. X/* load TIC_USER definition */
  1913. X/* (tic[,tic]...)
  1914. X * where tic is ["string"] value
  1915. X * Left paren is already scanned off before entry.
  1916. X */
  1917. Xstatic void
  1918. Xload_tic_user(tdef)
  1919. X    struct ticdef *tdef;
  1920. X{
  1921. X    struct ticmark *list = NULL; /* start of list */
  1922. X    struct ticmark *last = NULL; /* end of list */
  1923. X    struct ticmark *tic = NULL; /* new ticmark */
  1924. X    char temp_string[MAX_LINE_LEN];
  1925. X    struct value a;
  1926. X
  1927. X    while (!END_OF_COMMAND) {
  1928. X       /* parse a new ticmark */
  1929. X       tic = (struct ticmark *)alloc((unsigned long)sizeof(struct ticmark), (char *)NULL);
  1930. X       if (tic == (struct ticmark *)NULL) {
  1931. X          free_marklist(list);
  1932. X          int_error("out of memory for tic mark", c_token);
  1933. X       }
  1934. X
  1935. X       /* has a string with it? */
  1936. X       if (isstring(c_token)) {
  1937. X          quote_str(temp_string,c_token);
  1938. X          tic->label = alloc((unsigned long)strlen(temp_string)+1, "tic label");
  1939. X          (void) strcpy(tic->label, temp_string);
  1940. X          c_token++;
  1941. X       } else
  1942. X        tic->label = NULL;
  1943. X
  1944. X       /* in any case get the value */
  1945. X       tic->position = real(const_express(&a));
  1946. X       tic->next = NULL;
  1947. X
  1948. X       /* append to list */
  1949. X       if (list == NULL)
  1950. X        last = list = tic;    /* new list */
  1951. X       else {                /* append to list */
  1952. X          last->next = tic;
  1953. X          last = tic;
  1954. X       }
  1955. X
  1956. X       /* expect "," or ")" here */
  1957. X       if (!END_OF_COMMAND && equals(c_token, ","))
  1958. X        c_token++;        /* loop again */
  1959. X       else
  1960. X        break;            /* hopefully ")" */
  1961. X    }
  1962. X    
  1963. X    if (END_OF_COMMAND || !equals(c_token, ")")) {
  1964. X       free_marklist(list);
  1965. X       int_error("expecting right parenthesis )", c_token);
  1966. X    }
  1967. X    c_token++;
  1968. X    
  1969. X    /* successful list */
  1970. X    if (tdef->type == TIC_USER) {
  1971. X       /* remove old list */
  1972. X        /* VAX Optimiser was stuffing up following line. Turn Optimiser OFF */
  1973. X       free_marklist(tdef->def.user);
  1974. X       tdef->def.user = NULL;
  1975. X    }
  1976. X    tdef->type = TIC_USER;
  1977. X    tdef->def.user = list;
  1978. X}
  1979. X
  1980. Xstatic void
  1981. Xfree_marklist(list)
  1982. X    struct ticmark *list;
  1983. X{
  1984. X    register struct ticmark *freeable;
  1985. X
  1986. X    while (list != NULL) {
  1987. X       freeable = list;
  1988. X       list = list->next;
  1989. X       if (freeable->label != NULL)
  1990. X        free( (char *)freeable->label );
  1991. X       free( (char *)freeable );
  1992. X    }
  1993. X}
  1994. X
  1995. X/* load TIC_SERIES definition */
  1996. X/* start,incr[,end] */
  1997. Xstatic void
  1998. Xload_tic_series(tdef)
  1999. X    struct ticdef *tdef;
  2000. X{
  2001. X    double start, incr, end;
  2002. X    struct value a;
  2003. X    int incr_token;
  2004. X
  2005. X    start = real(const_express(&a));
  2006. X    if (!equals(c_token, ","))
  2007. X     int_error("expecting comma to separate start,incr", c_token);
  2008. X    c_token++;
  2009. X
  2010. X    incr_token = c_token;
  2011. X    incr = real(const_express(&a));
  2012. X
  2013. X    if (END_OF_COMMAND)
  2014. X     end = VERYLARGE;
  2015. X    else {
  2016. X       if (!equals(c_token, ","))
  2017. X        int_error("expecting comma to separate incr,end", c_token);
  2018. X       c_token++;
  2019. X
  2020. X       end = real(const_express(&a));
  2021. X    }
  2022. X    if (!END_OF_COMMAND)
  2023. X     int_error("tic series is defined by start,increment[,end]", 
  2024. X             c_token);
  2025. X    
  2026. X    if (start < end && incr <= 0)
  2027. X     int_error("increment must be positive", incr_token);
  2028. X    if (start > end && incr >= 0)
  2029. X     int_error("increment must be negative", incr_token);
  2030. X    if (start > end) {
  2031. X       /* put in order */
  2032. X        double numtics;
  2033. X        numtics = floor( (end*(1+SIGNIF) - start)/incr );
  2034. X        end = start;
  2035. X        start = end + numtics*incr;
  2036. X        incr = -incr;
  2037. X/*
  2038. X       double temp = start;
  2039. X       start = end;
  2040. X       end = temp;
  2041. X       incr = -incr;
  2042. X */
  2043. X    }
  2044. X
  2045. X    if (tdef->type == TIC_USER) {
  2046. X       /* remove old list */
  2047. X        /* VAX Optimiser was stuffing up following line. Turn Optimiser OFF */
  2048. X       free_marklist(tdef->def.user);
  2049. X       tdef->def.user = NULL;
  2050. X    }
  2051. X    tdef->type = TIC_SERIES;
  2052. X    tdef->def.series.start = start;
  2053. X    tdef->def.series.incr = incr;
  2054. X    tdef->def.series.end = end;
  2055. X}
  2056. X
  2057. Xstatic void
  2058. Xload_offsets (a, b, c, d)
  2059. Xdouble *a,*b, *c, *d;
  2060. X{
  2061. Xstruct value t;
  2062. X
  2063. X    *a = real (const_express(&t));  /* loff value */
  2064. X    c_token++;
  2065. X    if (equals(c_token,","))
  2066. X        c_token++;
  2067. X    if (END_OF_COMMAND) 
  2068. X        return;
  2069. X
  2070. X    *b = real (const_express(&t));  /* roff value */
  2071. X    c_token++;
  2072. X    if (equals(c_token,","))
  2073. X        c_token++;
  2074. X    if (END_OF_COMMAND) 
  2075. X        return;
  2076. X
  2077. X    *c = real (const_express(&t));  /* toff value */
  2078. X    c_token++;
  2079. X    if (equals(c_token,","))
  2080. X        c_token++;
  2081. X    if (END_OF_COMMAND) 
  2082. X        return;
  2083. X
  2084. X    *d = real (const_express(&t));  /* boff value */
  2085. X    c_token++;
  2086. X}
  2087. X
  2088. X
  2089. XTBOOLEAN                    /* TRUE if a or b were changed */
  2090. Xload_range(a,b)            /* also used by command.c */
  2091. Xdouble *a,*b;
  2092. X{
  2093. Xstruct value t;
  2094. XTBOOLEAN changed = FALSE;
  2095. X
  2096. X    if (equals(c_token,"]"))
  2097. X        return(FALSE);
  2098. X    if (END_OF_COMMAND) {
  2099. X        int_error("starting range value or ':' or 'to' expected",c_token);
  2100. X    } else if (!equals(c_token,"to") && !equals(c_token,":"))  {
  2101. X        *a = real(const_express(&t));
  2102. X        changed = TRUE;
  2103. X    }    
  2104. X    if (!equals(c_token,"to") && !equals(c_token,":"))
  2105. X        int_error("':' or keyword 'to' expected",c_token);
  2106. X    c_token++;
  2107. X    if (!equals(c_token,"]")) {
  2108. X        *b = real(const_express(&t));
  2109. X        changed = TRUE;
  2110. X     }
  2111. X     return(changed);
  2112. X}
  2113. X
  2114. X
  2115. X
  2116. X/******* The 'show' command *******/
  2117. Xvoid
  2118. Xshow_command()
  2119. X{
  2120. X    static char GPFAR showmess[] = 
  2121. X    "valid show options:  'action_table', 'all', 'angles', 'arrow', \n\
  2122. X    'autoscale', 'border', 'boxwidth', 'clip', 'contour', 'data', \n\
  2123. X    'dgrid3d', 'dummy', 'format', 'function', 'grid', 'hidden', 'key', \n\
  2124. X    'label', 'logscale', 'mapping',  'offsets', 'output', 'plot', \n\
  2125. X    'parametric', 'polar', 'rrange', 'samples', 'isosamples', 'view', \n\
  2126. X    'size', 'terminal', 'tics', 'ticslevel', 'time', 'title', 'trange', \n\
  2127. X    'urange', 'vrange', 'variables', 'version', \n\
  2128. X    'xlabel', 'xrange', '{no}xtics', 'xmtics', 'xdtics', '{no}xzeroaxis',\n\
  2129. X    'ylabel', 'yrange', '{no}ytics', 'ymtics', 'ydtics', '{no}yzeroaxis',\n\
  2130. X     'zero', '{no}zeroaxis', 'zlabel', 'zrange', '{no}ztics',\n\
  2131. X     'zmtics', 'zdtics'";
  2132. X
  2133. X    c_token++;
  2134. X
  2135. X    if (!show_one() && !show_two())
  2136. X    int_error(showmess, c_token);
  2137. X    screen_ok = FALSE;
  2138. X    (void) putc('\n',stderr);
  2139. X}
  2140. X
  2141. X/* return TRUE if a command match, FALSE if not */
  2142. Xstatic TBOOLEAN
  2143. Xshow_one()
  2144. X{
  2145. X    if (almost_equals(c_token,"ac$tion_table") ||
  2146. X             equals(c_token,"at") ) {
  2147. X        c_token++; 
  2148. X        show_at();
  2149. X        c_token++;
  2150. X    }
  2151. X    else if (almost_equals(c_token,"ar$row")) {
  2152. X        struct value a;
  2153. X        int tag = 0;
  2154. X
  2155. X        c_token++;
  2156. X        if (!END_OF_COMMAND) {
  2157. X           tag = (int)real(const_express(&a));
  2158. X           if (tag <= 0)
  2159. X            int_error("tag must be > zero", c_token);
  2160. X        }
  2161. X
  2162. X        (void) putc('\n',stderr);
  2163. X        show_arrow(tag);
  2164. X    }
  2165. X    else if (almost_equals(c_token,"au$toscale")) {
  2166. X        (void) putc('\n',stderr);
  2167. X        show_autoscale();
  2168. X        c_token++;
  2169. X    }
  2170. X    else if (almost_equals(c_token,"bor$der")) {
  2171. X        (void) putc('\n',stderr);
  2172. X        show_border();
  2173. X        c_token++;
  2174. X    }
  2175. X    else if (almost_equals(c_token,"box$width")) {
  2176. X        (void) putc('\n',stderr);
  2177. X        show_boxwidth();
  2178. X        c_token++;
  2179. X    }
  2180. X    else if (almost_equals(c_token,"c$lip")) {
  2181. X        (void) putc('\n',stderr);
  2182. X        show_clip();
  2183. X        c_token++;
  2184. X    }
  2185. X    else if (almost_equals(c_token,"ma$pping")) {
  2186. X        (void) putc('\n',stderr);
  2187. X        show_mapping();
  2188. X        c_token++;
  2189. X    }
  2190. X    else if (almost_equals(c_token,"co$ntour")) {
  2191. X        (void) putc('\n',stderr);
  2192. X        show_contour();
  2193. X        c_token++;
  2194. X    }
  2195. X    else if (almost_equals(c_token,"da$ta")) {
  2196. X        c_token++;
  2197. X        if (!almost_equals(c_token,"s$tyle"))
  2198. X            int_error("expecting keyword 'style'",c_token);
  2199. X        (void) putc('\n',stderr);
  2200. X        show_style("data",data_style);
  2201. X        c_token++;
  2202. X    }
  2203. X    else if (almost_equals(c_token,"dg$rid3d")) {
  2204. X        (void) putc('\n',stderr);
  2205. X        show_dgrid3d();
  2206. X        c_token++;
  2207. X    }
  2208. X    else if (almost_equals(c_token,"du$mmy")) {
  2209. X          (void) fprintf(stderr,"\n\tdummy variables are \"%s\" and \"%s\"\n",
  2210. X                        dummy_var[0], dummy_var[1]);
  2211. X        c_token++;
  2212. X    }
  2213. X    else if (almost_equals(c_token,"fo$rmat")) {
  2214. X        show_format();
  2215. X        c_token++;
  2216. X    }
  2217. X    else if (almost_equals(c_token,"fu$nctions")) {
  2218. X        c_token++;
  2219. X        if (almost_equals(c_token,"s$tyle"))  {
  2220. X            (void) putc('\n',stderr);
  2221. X            show_style("functions",func_style);
  2222. X            c_token++;
  2223. X        }
  2224. X        else
  2225. X            show_functions();
  2226. X    }
  2227. X    else if (almost_equals(c_token,"lo$gscale")) {
  2228. X        (void) putc('\n',stderr);
  2229. X        show_logscale();
  2230. X        c_token++;
  2231. X    }
  2232. X    else if (almost_equals(c_token,"of$fsets")) {
  2233. X        (void) putc('\n',stderr);
  2234. X        show_offsets();
  2235. X        c_token++;
  2236. X    }
  2237. X    else if (almost_equals(c_token,"o$utput")) {
  2238. X        (void) putc('\n',stderr);
  2239. X        show_output();
  2240. X        c_token++;
  2241. X    }
  2242. X    else if (almost_equals(c_token,"tit$le")) {
  2243. X        (void) putc('\n',stderr);
  2244. X        show_title();
  2245. X        c_token++;
  2246. X    }
  2247. X    else if (almost_equals(c_token,"xl$abel")) {
  2248. X        (void) putc('\n',stderr);
  2249. X        show_xlabel();
  2250. X        c_token++;
  2251. X    }
  2252. X    else if (almost_equals(c_token,"yl$abel")) {
  2253. X        (void) putc('\n',stderr);
  2254. X        show_ylabel();
  2255. X        c_token++;
  2256. X    }
  2257. X    else if (almost_equals(c_token,"zl$abel")) {
  2258. X        (void) putc('\n',stderr);
  2259. X        show_zlabel();
  2260. X        c_token++;
  2261. X    }
  2262. X    else if (almost_equals(c_token,"xzero$axis")) {
  2263. X        (void) putc('\n',stderr);
  2264. X        show_xzeroaxis();
  2265. X        c_token++;
  2266. X    }
  2267. X    else if (almost_equals(c_token,"yzero$axis")) {
  2268. X        (void) putc('\n',stderr);
  2269. X        show_yzeroaxis();
  2270. X        c_token++;
  2271. X    }
  2272. X    else if (almost_equals(c_token,"zeroa$xis")) {
  2273. X        (void) putc('\n',stderr);
  2274. X        show_xzeroaxis();
  2275. X        show_yzeroaxis();
  2276. X        c_token++;
  2277. X    }
  2278. X    else if (almost_equals(c_token,"la$bel")) {
  2279. X        struct value a;
  2280. X        int tag = 0;
  2281. X
  2282. X        c_token++;
  2283. X        if (!END_OF_COMMAND) {
  2284. X           tag = (int)real(const_express(&a));
  2285. X           if (tag <= 0)
  2286. X            int_error("tag must be > zero", c_token);
  2287. X        }
  2288. X
  2289. X        (void) putc('\n',stderr);
  2290. X        show_label(tag);
  2291. X    }
  2292. X    else if (almost_equals(c_token,"g$rid")) {
  2293. X        (void) putc('\n',stderr);
  2294. X        show_grid();
  2295. X        c_token++;
  2296. X    }
  2297. X    else if (almost_equals(c_token,"k$ey")) {
  2298. X        (void) putc('\n',stderr);
  2299. X        show_key();
  2300. X        c_token++;
  2301. X    }
  2302. X    else
  2303. X        return (FALSE);
  2304. X    return TRUE;
  2305. X}
  2306. X
  2307. X/* return TRUE if a command match, FALSE if not */
  2308. Xstatic TBOOLEAN
  2309. Xshow_two()
  2310. X{
  2311. X    if (almost_equals(c_token,"p$lot")) {
  2312. X        (void) putc('\n',stderr);
  2313. X        show_plot();
  2314. X        c_token++;
  2315. X    }
  2316. X    else if (almost_equals(c_token,"par$ametric")) {
  2317. X        (void) putc('\n',stderr);
  2318. X        show_parametric();
  2319. X        c_token++;
  2320. X    }
  2321. X    else if (almost_equals(c_token,"pol$ar")) {
  2322. X        (void) putc('\n',stderr);
  2323. X        show_polar();
  2324. X        c_token++;
  2325. X    }
  2326. X    else if (almost_equals(c_token,"an$gles")) {
  2327. X        (void) putc('\n',stderr);
  2328. X        show_angles();
  2329. X        c_token++;
  2330. X    }
  2331. X    else if (almost_equals(c_token,"ti$cs")) {
  2332. X        (void) putc('\n',stderr);
  2333. X        show_tics(TRUE,TRUE,TRUE);
  2334. X        c_token++;
  2335. X    }
  2336. X    else if (almost_equals(c_token,"tim$e")) {
  2337. X        (void) putc('\n',stderr);
  2338. X        show_time();
  2339. X        c_token++;
  2340. X    }
  2341. X    else if (almost_equals(c_token,"su$rface")) {
  2342. X        (void) putc('\n',stderr);
  2343. X        show_surface();
  2344. X        c_token++;
  2345. X    }
  2346. X    else if (almost_equals(c_token,"hi$dden3d")) {
  2347. X        (void) putc('\n',stderr);
  2348. X        show_hidden3d();
  2349. X        c_token++;
  2350. X    }
  2351. X     else if (almost_equals(c_token,"cla$bel")) {
  2352. X         (void) putc('\n',stderr);
  2353. X         show_label_contours();
  2354. X         c_token++;
  2355. X     }
  2356. X    else if (almost_equals(c_token,"xti$cs")) {
  2357. X        show_tics(TRUE,FALSE,FALSE);
  2358. X        c_token++;
  2359. X    }
  2360. X    else if (almost_equals(c_token,"yti$cs")) {
  2361. X        show_tics(FALSE,TRUE,FALSE);
  2362. X        c_token++;
  2363. X    }
  2364. X    else if (almost_equals(c_token,"zti$cs")) {
  2365. X        show_tics(FALSE,FALSE,TRUE);
  2366. X        c_token++;
  2367. X    }
  2368. X    else if (almost_equals(c_token,"sa$mples")) {
  2369. X        (void) putc('\n',stderr);
  2370. X        show_samples();
  2371. X        c_token++;
  2372. X    }
  2373. X    else if (almost_equals(c_token,"isosa$mples")) {
  2374. X        (void) putc('\n',stderr);
  2375. X        show_isosamples();
  2376. X        c_token++;
  2377. X    }
  2378. X    else if (almost_equals(c_token,"si$ze")) {
  2379. X        (void) putc('\n',stderr);
  2380. X        show_size();
  2381. X        c_token++;
  2382. X    }
  2383. X    else if (almost_equals(c_token,"t$erminal")) {
  2384. X        (void) putc('\n',stderr);
  2385. X        show_term();
  2386. X        c_token++;
  2387. X    }
  2388. X    else if (almost_equals(c_token,"rr$ange")) {
  2389. X        (void) putc('\n',stderr);
  2390. X        show_range('r',rmin,rmax);
  2391. X        c_token++;
  2392. X    }
  2393. X    else if (almost_equals(c_token,"tr$ange")) {
  2394. X        (void) putc('\n',stderr);
  2395. X        show_range('t',tmin,tmax);
  2396. X        c_token++;
  2397. X    }
  2398. X    else if (almost_equals(c_token,"ur$ange")) {
  2399. X        (void) putc('\n',stderr);
  2400. X        show_range('u',umin,umax);
  2401. X        c_token++;
  2402. X    }
  2403. X    else if (almost_equals(c_token,"vi$ew")) {
  2404. X        (void) putc('\n',stderr);
  2405. X        show_view();
  2406. X        c_token++;
  2407. X    }
  2408. X    else if (almost_equals(c_token,"vr$ange")) {
  2409. X        (void) putc('\n',stderr);
  2410. X        show_range('v',vmin,vmax);
  2411. X        c_token++;
  2412. X    }
  2413. X    else if (almost_equals(c_token,"v$ariables")) {
  2414. X        show_variables();
  2415. X        c_token++;
  2416. X    }
  2417. X    else if (almost_equals(c_token,"ve$rsion")) {
  2418. X        show_version();
  2419. X        c_token++;
  2420. X    }
  2421. X    else if (almost_equals(c_token,"xr$ange")) {
  2422. X        (void) putc('\n',stderr);
  2423. X        show_range('x',xmin,xmax);
  2424. X        c_token++;
  2425. X    }
  2426. X    else if (almost_equals(c_token,"yr$ange")) {
  2427. X        (void) putc('\n',stderr);
  2428. X        show_range('y',ymin,ymax);
  2429. X        c_token++;
  2430. X    }
  2431. X    else if (almost_equals(c_token,"zr$ange")) {
  2432. X        (void) putc('\n',stderr);
  2433. X        show_range('z',zmin,zmax);
  2434. X        c_token++;
  2435. X    }
  2436. X    else if (almost_equals(c_token,"z$ero")) {
  2437. X        (void) putc('\n',stderr);
  2438. X        show_zero();
  2439. X        c_token++;
  2440. X    }
  2441. X    else if (almost_equals(c_token,"a$ll")) {
  2442. X        c_token++;
  2443. X        show_version();
  2444. X        show_autoscale();
  2445. X        show_border();
  2446. X        show_boxwidth();
  2447. X        show_clip();
  2448. X        show_contour();
  2449. X        show_dgrid3d();
  2450. X        show_mapping();
  2451. X          (void) fprintf(stderr,"\tdummy variables are \"%s\" and \"%s\"\n",
  2452. X                        dummy_var[0], dummy_var[1]);
  2453. X        show_format();
  2454. X        show_style("data",data_style);
  2455. X        show_style("functions",func_style);
  2456. X        show_grid();
  2457. X        show_label(0);
  2458. X        show_arrow(0);
  2459. X        show_key();
  2460. X        show_logscale();
  2461. X        show_offsets();
  2462. X        show_output();
  2463. X        show_parametric();
  2464. X        show_polar();
  2465. X        show_angles();
  2466. X        show_samples();
  2467. X        show_isosamples();
  2468. X        show_view();
  2469. X        show_surface();
  2470. X#ifndef LITE
  2471. X        show_hidden3d();
  2472. X#endif
  2473. X        show_size();
  2474. X        show_term();
  2475. X        show_tics(TRUE,TRUE,TRUE);
  2476. X        show_time();
  2477. X        if (parametric)
  2478. X            if (!is_3d_plot)
  2479. X                show_range('t',tmin,tmax);
  2480. X            else {
  2481. X                show_range('u',umin,umax);
  2482. X                show_range('v',vmin,vmax);
  2483. X            }
  2484. X        if (polar)
  2485. X          show_range('r',rmin,rmax);
  2486. X        show_range('x',xmin,xmax);
  2487. X        show_range('y',ymin,ymax);
  2488. X        show_range('z',zmin,zmax);
  2489. X        show_title();
  2490. X        show_xlabel();
  2491. X        show_ylabel();
  2492. X        show_zlabel();
  2493. X        show_zero();
  2494. X        show_plot();
  2495. X        show_variables();
  2496. X        show_functions();
  2497. X        c_token++;
  2498. X    }
  2499. X    else
  2500. X        return (FALSE);
  2501. X    return (TRUE);
  2502. X}
  2503. X
  2504. X
  2505. X/*********** support functions for 'show'  **********/
  2506. Xstatic void
  2507. Xshow_style(name,style)
  2508. Xchar name[];
  2509. Xenum PLOT_STYLE style;
  2510. X{
  2511. X    fprintf(stderr,"\t%s are plotted with ",name);
  2512. X    switch (style) {
  2513. X        case LINES: fprintf(stderr,"lines\n"); break;
  2514. X        case POINTSTYLE: fprintf(stderr,"points\n"); break;
  2515. X        case IMPULSES: fprintf(stderr,"impulses\n"); break;
  2516. X        case LINESPOINTS: fprintf(stderr,"linespoints\n"); break;
  2517. X        case DOTS: fprintf(stderr,"dots\n"); break;
  2518. X        case ERRORBARS: fprintf(stderr,"errorbars\n"); break;
  2519. X        case BOXES: fprintf(stderr,"boxes\n"); break;
  2520. X        case BOXERROR: fprintf(stderr,"boxerrorbars\n"); break;
  2521. X        case STEPS: fprintf(stderr,"steps\n"); break;
  2522. X    }
  2523. X}
  2524. X
  2525. Xstatic void
  2526. Xshow_boxwidth()
  2527. X{
  2528. X    if (boxwidth<0.0)
  2529. X        fprintf(stderr,"\tboxwidth is auto\n");
  2530. X    else
  2531. X        fprintf(stderr,"\tboxwidth is %g\n",boxwidth);
  2532. X}
  2533. Xstatic void
  2534. Xshow_dgrid3d()
  2535. X{
  2536. X    if (dgrid3d)
  2537. X        fprintf(stderr,"\tdata grid3d is enabled for mesh of size %dx%d, norm=%d\n",
  2538. X            dgrid3d_row_fineness,
  2539. X            dgrid3d_col_fineness,
  2540. X            dgrid3d_norm_value);
  2541. X    else
  2542. X        fprintf(stderr,"\tdata grid3d is disabled\n");
  2543. X}
  2544. X
  2545. Xstatic void
  2546. Xshow_range(name,min,max)
  2547. Xchar name;
  2548. Xdouble min,max;
  2549. X{
  2550. X    fprintf(stderr,"\t%crange is [%g : %g]\n",name,min,max);
  2551. X}
  2552. X
  2553. Xstatic void
  2554. Xshow_zero()
  2555. X{
  2556. X    fprintf(stderr,"\tzero is %g\n",zero);
  2557. X}
  2558. X
  2559. Xstatic void
  2560. Xshow_offsets()
  2561. X{
  2562. X    fprintf(stderr,"\toffsets are %g, %g, %g, %g\n",loff,roff,toff,boff);
  2563. X}
  2564. X
  2565. Xstatic void
  2566. Xshow_border()
  2567. X{
  2568. X    fprintf(stderr,"\tborder is %sdrawn\n", draw_border ? "" : "not ");
  2569. X}
  2570. X
  2571. Xstatic void
  2572. Xshow_output()
  2573. X{
  2574. X    fprintf(stderr,"\toutput is sent to %s\n",outstr);
  2575. X}
  2576. X
  2577. Xstatic void
  2578. Xshow_samples()
  2579. X{
  2580. X    fprintf(stderr,"\tsampling rate is %d, %d\n",samples_1, samples_2);
  2581. X}
  2582. X
  2583. Xstatic void
  2584. Xshow_isosamples()
  2585. X{
  2586. X    fprintf(stderr,"\tiso sampling rate is %d, %d\n",
  2587. X        iso_samples_1, iso_samples_2);
  2588. X}
  2589. X
  2590. Xstatic void
  2591. Xshow_surface()
  2592. X{
  2593. X    fprintf(stderr,"\tsurface is %sdrawn\n", draw_surface ? "" : "not ");
  2594. X}
  2595. X
  2596. Xstatic void
  2597. Xshow_hidden3d()
  2598. X{
  2599. X#ifdef LITE
  2600. X    printf(" Hidden Line Removal Not Supported in LITE version\n");
  2601. X#else
  2602. X    fprintf(stderr,"\thidden surface is %s\n", hidden3d ? "removed" : "drawn");
  2603. X#endif /* LITE */
  2604. X}
  2605. X
  2606. Xstatic void
  2607. Xshow_label_contours()
  2608. X{
  2609. X    fprintf(stderr,"\tcontour line types are %s\n", label_contours ? "varied & labeled" : "all the same");
  2610. X}
  2611. X
  2612. Xstatic void
  2613. Xshow_view()
  2614. X{
  2615. X    fprintf(stderr,"\tview is %g rot_x, %g rot_z, %g scale, %g scale_z\n",
  2616. X        surface_rot_x, surface_rot_z, surface_scale, surface_zscale);
  2617. X}
  2618. X
  2619. Xstatic void
  2620. Xshow_size()
  2621. X{
  2622. X    fprintf(stderr,"\tsize is scaled by %g,%g\n",xsize,ysize);
  2623. X}
  2624. X
  2625. Xstatic void
  2626. Xshow_title()
  2627. X{
  2628. X    fprintf(stderr,"\ttitle is \"%s\", offset at %d, %d\n",
  2629. X        title,title_xoffset,title_yoffset);
  2630. X}
  2631. X
  2632. Xstatic void
  2633. Xshow_xlabel()
  2634. X{
  2635. X    fprintf(stderr,"\txlabel is \"%s\", offset at %d, %d\n",
  2636. X        xlabel,xlabel_xoffset,xlabel_yoffset);
  2637. X}
  2638. X
  2639. Xstatic void
  2640. Xshow_ylabel()
  2641. X{
  2642. X    fprintf(stderr,"\tylabel is \"%s\", offset at %d, %d\n",
  2643. X        ylabel,ylabel_xoffset,ylabel_yoffset);
  2644. X}
  2645. Xstatic void
  2646. Xshow_zlabel()
  2647. X{
  2648. X    fprintf(stderr,"\tzlabel is \"%s\", offset at %d, %d\n",
  2649. X        zlabel,zlabel_xoffset,zlabel_yoffset);
  2650. X}
  2651. X
  2652. Xstatic void
  2653. Xshow_xzeroaxis()
  2654. X{
  2655. X    fprintf(stderr,"\txzeroaxis is %s\n",(xzeroaxis)? "ON" : "OFF");
  2656. X}
  2657. X
  2658. Xstatic void
  2659. Xshow_yzeroaxis()
  2660. X{
  2661. X    fprintf(stderr,"\tyzeroaxis is %s\n",(yzeroaxis)? "ON" : "OFF");
  2662. X}
  2663. X
  2664. Xstatic void
  2665. Xshow_label(tag)
  2666. X    int tag;                /* 0 means show all */
  2667. X{
  2668. X    struct text_label *this_label;
  2669. X    TBOOLEAN showed = FALSE;
  2670. X
  2671. X    for (this_label = first_label; this_label != NULL;
  2672. X        this_label = this_label->next) {
  2673. X       if (tag == 0 || tag == this_label->tag) {
  2674. X          showed = TRUE;
  2675. X          fprintf(stderr,"\tlabel %d \"%s\" at %g,%g,%g ",
  2676. X                this_label->tag, this_label->text, 
  2677. X                this_label->x, this_label->y, this_label->z);
  2678. X          switch(this_label->pos) {
  2679. X             case LEFT : {
  2680. X                fprintf(stderr,"left");
  2681. X                break;
  2682. X             }
  2683. X             case CENTRE : {
  2684. X                fprintf(stderr,"centre");
  2685. X                break;
  2686. X             }
  2687. X             case RIGHT : {
  2688. X                fprintf(stderr,"right");
  2689. X                break;
  2690. X             }
  2691. X          }
  2692. X          fputc('\n',stderr);
  2693. X       }
  2694. X    }
  2695. X    if (tag > 0 && !showed)
  2696. X     int_error("label not found", c_token);
  2697. X}
  2698. X
  2699. Xstatic void
  2700. Xshow_arrow(tag)
  2701. X    int tag;                /* 0 means show all */
  2702. X{
  2703. X    struct arrow_def *this_arrow;
  2704. X    TBOOLEAN showed = FALSE;
  2705. X
  2706. X    for (this_arrow = first_arrow; this_arrow != NULL;
  2707. X        this_arrow = this_arrow->next) {
  2708. X       if (tag == 0 || tag == this_arrow->tag) {
  2709. X          showed = TRUE;
  2710. X          fprintf(stderr,"\tarrow %d from %g,%g,%g to %g,%g,%g%s\n",
  2711. X                this_arrow->tag, 
  2712. X                this_arrow->sx, this_arrow->sy, this_arrow->sz,
  2713. X                this_arrow->ex, this_arrow->ey, this_arrow->ez,
  2714. X                this_arrow->head ? "" : " (nohead)");
  2715. X       }
  2716. X    }
  2717. X    if (tag > 0 && !showed)
  2718. X     int_error("arrow not found", c_token);
  2719. X}
  2720. X
  2721. Xstatic void
  2722. Xshow_grid()
  2723. X{
  2724. X    fprintf(stderr,"\tgrid is %s\n",(grid)? "ON" : "OFF");
  2725. X}
  2726. X
  2727. Xstatic void
  2728. Xshow_key()
  2729. X{
  2730. X    switch (key) {
  2731. X        case -1 : 
  2732. X            fprintf(stderr,"\tkey is ON\n");
  2733. X            break;
  2734. X        case 0 :
  2735. X            fprintf(stderr,"\tkey is OFF\n");
  2736. X            break;
  2737. X        case 1 :
  2738. X            fprintf(stderr,"\tkey is at %g,%g,%g\n",key_x,key_y,key_z);
  2739. X            break;
  2740. X    }
  2741. X}
  2742. X
  2743. Xstatic void
  2744. Xshow_parametric()
  2745. X{
  2746. X    fprintf(stderr,"\tparametric is %s\n",(parametric)? "ON" : "OFF");
  2747. X}
  2748. X
  2749. Xstatic void
  2750. Xshow_polar()
  2751. X{
  2752. X    fprintf(stderr,"\tpolar is %s\n",(polar)? "ON" : "OFF");
  2753. X}
  2754. X
  2755. Xstatic void
  2756. Xshow_angles()
  2757. X{
  2758. X    fprintf(stderr,"\tAngles are in ");
  2759. X    switch (angles_format) {
  2760. X        case ANGLES_RADIANS:
  2761. X            fprintf(stderr, "radians\n");
  2762. X        break;
  2763. X        case ANGLES_DEGREES:
  2764. X            fprintf(stderr, "degrees\n");
  2765. X        break;
  2766. X    }
  2767. X}
  2768. X
  2769. X
  2770. Xstatic void
  2771. Xshow_tics(showx, showy, showz)
  2772. X    TBOOLEAN showx, showy, showz;
  2773. X{
  2774. X    fprintf(stderr,"\ttics are %s, ",(tic_in)? "IN" : "OUT");
  2775. X    fprintf(stderr,"\tticslevel is %g\n",ticslevel);
  2776. X
  2777. X    if (showx)
  2778. X     show_ticdef(xtics, 'x', &xticdef);
  2779. X    if (showy)
  2780. X     show_ticdef(ytics, 'y', &yticdef);
  2781. X    if (showz)
  2782. X     show_ticdef(ztics, 'z', &zticdef);
  2783. X    screen_ok = FALSE;
  2784. X}
  2785. X
  2786. X/* called by show_tics */
  2787. Xstatic void
  2788. Xshow_ticdef(tics, axis, tdef)
  2789. X    TBOOLEAN tics;            /* xtics ytics or ztics */
  2790. X    char axis;            /* 'x' 'y' or 'z' */
  2791. X    struct ticdef *tdef;    /* xticdef yticdef or zticdef */
  2792. X{
  2793. X    register struct ticmark *t;
  2794. X
  2795. X    fprintf(stderr, "\t%c-axis tic labelling is ", axis);
  2796. X    if (!tics) {
  2797. X       fprintf(stderr, "OFF\n");
  2798. X       return;
  2799. X    }
  2800. X
  2801. X    switch(tdef->type) {
  2802. X       case TIC_COMPUTED: {
  2803. X          fprintf(stderr, "computed automatically\n");
  2804. X          break;
  2805. X       }
  2806. X        case TIC_MONTH: {
  2807. X        fprintf(stderr, "Months computed automatically\n");
  2808. X        break;
  2809. X       }
  2810. X        case TIC_DAY:{
  2811. X        fprintf(stderr, "Days computed automatically\n");
  2812. X        }
  2813. X       case TIC_SERIES: {
  2814. X          if (tdef->def.series.end == VERYLARGE)
  2815. X            fprintf(stderr, "series from %g by %g\n", 
  2816. X                  tdef->def.series.start, tdef->def.series.incr);
  2817. X          else
  2818. X            fprintf(stderr, "series from %g by %g until %g\n", 
  2819. X                  tdef->def.series.start, tdef->def.series.incr, 
  2820. X                  tdef->def.series.end);
  2821. X          break;
  2822. X       }
  2823. X       case TIC_USER: {
  2824. X          fprintf(stderr, "list (");
  2825. X          for (t = tdef->def.user; t != NULL; t=t->next) {
  2826. X             if (t->label)
  2827. X               fprintf(stderr, "\"%s\" ", t->label);
  2828. X             if (t->next)
  2829. X               fprintf(stderr, "%g, ", t->position);
  2830. X             else
  2831. X               fprintf(stderr, "%g", t->position);
  2832. X          }
  2833. X          fprintf(stderr, ")\n");
  2834. X          break;
  2835. X       }
  2836. X       default: {
  2837. X          int_error("unknown ticdef type in show_ticdef()", NO_CARET);
  2838. X          /* NOTREACHED */
  2839. X       }
  2840. X    }
  2841. X}
  2842. X
  2843. Xstatic void
  2844. Xshow_time()
  2845. X{
  2846. X    fprintf(stderr,"\ttime is %s, offset at %d, %d\n",
  2847. X        (timedate)? "ON" : "OFF",
  2848. X        time_xoffset,time_yoffset);
  2849. X}
  2850. X
  2851. Xstatic void
  2852. Xshow_term()
  2853. X{
  2854. X    fprintf(stderr,"\tterminal type is %s %s\n",
  2855. X        term_tbl[term].name, term_options);
  2856. X}
  2857. X
  2858. Xstatic void
  2859. Xshow_plot()
  2860. X{
  2861. X    fprintf(stderr,"\tlast plot command was: %s\n",replot_line);
  2862. X}
  2863. X
  2864. Xstatic void
  2865. Xshow_autoscale()
  2866. X{
  2867. X    fprintf(stderr,"\tautoscaling is ");
  2868. X    if (parametric)
  2869. X        if (is_3d_plot)
  2870. X            fprintf(stderr,"\tt: %s, ",(autoscale_t)? "ON" : "OFF");
  2871. X        else
  2872. X            fprintf(stderr,"\tu: %s, v: %s, ",
  2873. X                        (autoscale_u)? "ON" : "OFF",
  2874. X                        (autoscale_v)? "ON" : "OFF");
  2875. X    else fprintf(stderr,"\t");
  2876. X
  2877. X    if (polar) fprintf(stderr,"r: %s, ",(autoscale_r)? "ON" : "OFF");
  2878. X    fprintf(stderr,"x: %s, ",(autoscale_x)? "ON" : "OFF");
  2879. X    fprintf(stderr,"y: %s, ",(autoscale_y)? "ON" : "OFF");
  2880. X    fprintf(stderr,"z: %s\n",(autoscale_z)? "ON" : "OFF");
  2881. X}
  2882. X
  2883. Xstatic void
  2884. Xshow_clip()
  2885. X{
  2886. X    fprintf(stderr,"\tpoint clip is %s\n",(clip_points)? "ON" : "OFF");
  2887. X
  2888. X    if (clip_lines1)
  2889. X      fprintf(stderr,
  2890. X         "\tdrawing and clipping lines between inrange and outrange points\n");
  2891. X    else
  2892. X      fprintf(stderr,
  2893. X         "\tnot drawing lines between inrange and outrange points\n");
  2894. X
  2895. X    if (clip_lines2)
  2896. X      fprintf(stderr,
  2897. X         "\tdrawing and clipping lines between two outrange points\n");
  2898. X    else
  2899. X      fprintf(stderr,
  2900. X         "\tnot drawing lines between two outrange points\n");
  2901. X}
  2902. X
  2903. Xstatic void
  2904. Xshow_mapping()
  2905. X{
  2906. X    fprintf(stderr,"\tmapping for 3-d data is ");
  2907. X
  2908. X    switch (mapping3d) {
  2909. X        case MAP3D_CARTESIAN:
  2910. X            fprintf(stderr,"cartesian\n");
  2911. X            break;
  2912. X        case MAP3D_SPHERICAL:
  2913. X            fprintf(stderr,"spherical\n");
  2914. X            break;
  2915. X        case MAP3D_CYLINDRICAL:
  2916. X            fprintf(stderr,"cylindrical\n");
  2917. X            break;
  2918. X    }
  2919. X}
  2920. X
  2921. Xstatic void
  2922. Xshow_contour()
  2923. X{
  2924. X    fprintf(stderr,"\tcontour for surfaces are %s",
  2925. X        (draw_contour)? "drawn" : "not drawn\n");
  2926. X
  2927. X    if (draw_contour) {
  2928. X            fprintf(stderr, " in %d levels on ", contour_levels);
  2929. X        switch (draw_contour) {
  2930. X            case CONTOUR_BASE:
  2931. X                fprintf(stderr,"grid base\n");
  2932. X                break;
  2933. X            case CONTOUR_SRF:
  2934. X                fprintf(stderr,"surface\n");
  2935. X                break;
  2936. X            case CONTOUR_BOTH:
  2937. X                fprintf(stderr,"grid base and surface\n");
  2938. X                break;
  2939. X        }
  2940. X        switch (contour_kind) {
  2941. X            case CONTOUR_KIND_LINEAR:
  2942. X                fprintf(stderr,"\t\tas linear segments\n");
  2943. X                break;
  2944. X            case CONTOUR_KIND_CUBIC_SPL:
  2945. X                fprintf(stderr,"\t\tas cubic spline interpolation segments with %d pts\n",
  2946. X                    contour_pts);
  2947. X                break;
  2948. X            case CONTOUR_KIND_BSPLINE:
  2949. X                fprintf(stderr,"\t\tas bspline approximation segments of order %d with %d pts\n",
  2950. X                    contour_order, contour_pts);
  2951. X                break;
  2952. X        }
  2953. X        switch (levels_kind) {
  2954. X            int i;
  2955. X            case LEVELS_AUTO:
  2956. X                fprintf(stderr,"\t\t%d automatic levels\n", contour_levels);
  2957. X                break;
  2958. X            case LEVELS_DISCRETE:
  2959. X                fprintf(stderr,"\t\t%d discrete levels at ", contour_levels);
  2960. X                        fprintf(stderr, "%g", levels_list[0]);
  2961. X                for(i = 1; i < contour_levels; i++)
  2962. X                    fprintf(stderr,",%g ", levels_list[i]);
  2963. X                fprintf(stderr,"\n");
  2964. X                break;
  2965. X            case LEVELS_INCREMENTAL:
  2966. X                fprintf(stderr,"\t\t%d incremental levels starting at %g, step %g, end %g\n",
  2967. X                    contour_levels, levels_list[0], levels_list[1],
  2968. X                    levels_list[0]+contour_levels*levels_list[1]);
  2969. X                break;
  2970. X        }
  2971. X        fprintf(stderr,"\t\tcontour line types are %s\n", label_contours ? "varied" : "all the same");
  2972. X    }
  2973. X}
  2974. X
  2975. Xstatic void
  2976. Xshow_format()
  2977. X{
  2978. X    fprintf(stderr, "\ttic format is x-axis: \"%s\", y-axis: \"%s\", z-axis: \"%s\"\n",
  2979. X        xformat, yformat, zformat);
  2980. X}
  2981. X
  2982. Xstatic void
  2983. Xshow_logscale()
  2984. X{
  2985. X    if (is_log_x) {
  2986. X        fprintf(stderr,"\tlogscaling x (base %g)", base_log_x);
  2987. X        if (is_log_y && is_log_z)
  2988. X            fprintf(stderr,", y (base %g) and z (base %g)\n",
  2989. X                base_log_y, base_log_z);
  2990. X        else if (is_log_y)
  2991. X            fprintf(stderr," and y (base %g)\n", base_log_y);
  2992. X        else if (is_log_z)
  2993. X            fprintf(stderr," and z (base %g)\n", base_log_z);
  2994. X        else
  2995. X            fprintf(stderr," only\n");
  2996. X    } else if (is_log_y) {
  2997. X        fprintf(stderr,"\tlogscaling y (base %g)", base_log_y);
  2998. X        if (is_log_z)
  2999. X            fprintf(stderr," and z (base %g)\n", base_log_z);
  3000. X        else
  3001. X            fprintf(stderr," only\n");
  3002. X    } else if (is_log_z) {
  3003. X        fprintf(stderr,"\tlogscaling z (base %g) only\n", base_log_z);
  3004. X    } else {
  3005. X        fprintf(stderr,"\tno logscaling\n");
  3006. X    }
  3007. X}
  3008. X
  3009. Xstatic void
  3010. Xshow_variables()
  3011. X{
  3012. Xregister struct udvt_entry *udv = first_udv;
  3013. Xint len;
  3014. X
  3015. X    fprintf(stderr,"\n\tVariables:\n");
  3016. X    while (udv) {
  3017. X         len = instring(udv->udv_name, ' ');
  3018. X        fprintf(stderr,"\t%-*s ",len,udv->udv_name);
  3019. X        if (udv->udv_undef)
  3020. X            fputs("is undefined\n",stderr);
  3021. X        else {
  3022. X            fputs("= ",stderr);
  3023. X            disp_value(stderr,&(udv->udv_value));
  3024. X            (void) putc('\n',stderr);
  3025. X        }
  3026. X        udv = udv->next_udv;
  3027. X    }
  3028. X}
  3029. X
  3030. Xchar *authors[] = {"Thomas Williams","Colin Kelley"}; /* primary */
  3031. Xvoid                /* used by plot.c */
  3032. Xshow_version()
  3033. X{
  3034. Xextern char version[];
  3035. Xextern char patchlevel[];
  3036. Xextern char date[];
  3037. Xextern char copyright[];
  3038. Xextern char bug_email[];
  3039. Xextern char help_email[];
  3040. Xint x;
  3041. Xlong time();
  3042. X
  3043. X    x = time((long *)NULL) & 1;
  3044. X    fprintf(stderr,"\n\t%s\n\t%sversion %s\n",
  3045. X        PROGRAM, OS, version); 
  3046. X    fprintf(stderr,"\tpatchlevel %s\n",patchlevel);
  3047. X     fprintf(stderr, "\tlast modified %s\n", date);
  3048. X    fprintf(stderr,"\n\t%s   %s, %s\n", copyright,authors[x],authors[1-x]);
  3049. X    fprintf(stderr, "\n\tSend comments and requests for help to %s", help_email);
  3050. X    fprintf(stderr, "\n\tSend bugs, suggestions and mods to %s\n", bug_email);
  3051. X}
  3052. END_OF_FILE
  3053.   if test 76221 -ne `wc -c <'gnuplot/setshow.c'`; then
  3054.     echo shar: \"'gnuplot/setshow.c'\" unpacked with wrong size!
  3055.   fi
  3056.   # end of 'gnuplot/setshow.c'
  3057. fi
  3058. echo shar: End of archive 2 \(of 33\).
  3059. cp /dev/null ark2isdone
  3060. MISSING=""
  3061. 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
  3062.     if test ! -f ark${I}isdone ; then
  3063.     MISSING="${MISSING} ${I}"
  3064.     fi
  3065. done
  3066. if test "${MISSING}" = "" ; then
  3067.     echo You have unpacked all 33 archives.
  3068.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  3069. else
  3070.     echo You still must unpack the following archives:
  3071.     echo "        " ${MISSING}
  3072. fi
  3073. exit 0
  3074. exit 0 # Just in case...
  3075.