Annotation of OpenXM_contrib/gnuplot/show.c, Revision 1.1.1.2
1.1 maekawa 1: #ifndef lint
1.1.1.2 ! maekawa 2: static char *RCSid = "$Id: show.c,v 1.23.2.2 1999/09/29 17:17:26 lhecking Exp $";
1.1 maekawa 3: #endif
4:
5: /* GNUPLOT - show.c */
6:
7: /*[
8: * Copyright 1986 - 1993, 1998 Thomas Williams, Colin Kelley
9: *
10: * Permission to use, copy, and distribute this software and its
11: * documentation for any purpose with or without fee is hereby granted,
12: * provided that the above copyright notice appear in all copies and
13: * that both that copyright notice and this permission notice appear
14: * in supporting documentation.
15: *
16: * Permission to modify the software is granted, but not the right to
17: * distribute the complete modified source code. Modifications are to
18: * be distributed as patches to the released version. Permission to
19: * distribute binaries produced by compiling modified sources is granted,
20: * provided you
21: * 1. distribute the corresponding source modifications from the
22: * released version in the form of a patch file along with the binaries,
23: * 2. add special version identification to distinguish your version
24: * in addition to the base release version number,
25: * 3. provide your name and address as the primary contact for the
26: * support of your modified version, and
27: * 4. retain our contact information in regard to use of the base
28: * software.
29: * Permission to distribute the released version of the source code along
30: * with corresponding source modifications in the form of a patch file is
31: * granted with same provisions 2 through 4 for binary distributions.
32: *
33: * This software is provided "as is" without express or implied warranty
34: * to the extent permitted by applicable law.
35: ]*/
36:
37:
38: /*
39: * 19 September 1992 Lawrence Crowl (crowl@cs.orst.edu)
40: * Added user-specified bases for log scaling.
41: */
42:
43:
44: #include "plot.h"
45: #include "setshow.h"
46:
47: #define DEF_FORMAT "%g" /* default format for tic mark labels */
48: #define SIGNIF (0.01) /* less than one hundredth of a tic mark */
49:
50:
51: /* input data, parsing variables */
52:
53: extern TBOOLEAN is_3d_plot;
54:
55: /* From version.c, used in show_version () */
56: extern char version[];
57: extern char patchlevel[];
58: extern char date[];
59: extern char gnuplot_copyright[];
60: extern char faq_location[];
61: extern char bug_email[];
62: extern char help_email[];
63:
64:
65: #ifndef TIMEFMT
66: #define TIMEFMT "%d/%m/%y,%H:%M"
67: #endif
68: /* format for date/time for reading time in datafile */
69:
70:
71:
72: /******** Local functions ********/
73:
74: static void show_style __PROTO((char name[], enum PLOT_STYLE style));
75: static void show_range __PROTO((int axis, double min, double max, int autosc, char *text));
76: static void show_zero __PROTO((void));
77: static void show_border __PROTO((void));
78: static void show_dgrid3d __PROTO((void));
79: static void show_offsets __PROTO((void));
80: static void show_samples __PROTO((void));
81: static void show_isosamples __PROTO((void));
82: static void show_output __PROTO((void));
83: static void show_view __PROTO((void));
84: static void show_size __PROTO((void));
85: static void show_origin __PROTO((void));
86: static void show_title __PROTO((void));
87: static void show_xyzlabel __PROTO((char *name, label_struct * label));
88: static void show_angles __PROTO((void));
89: static void show_boxwidth __PROTO((void));
90: static void show_bars __PROTO((void));
91: static void show_xzeroaxis __PROTO((void));
92: static void show_yzeroaxis __PROTO((void));
93: static void show_label __PROTO((int tag));
94: static void show_linestyle __PROTO((int tag));
95: static void show_arrow __PROTO((int tag));
96: static void show_grid __PROTO((void));
97: static void show_key __PROTO((void));
98: static void show_keytitle __PROTO((void));
99: static void show_mtics __PROTO((int mini, double freq, char *name));
100: static void show_pointsize __PROTO((void));
101: static void show_encoding __PROTO((void));
102: static void show_polar __PROTO((void));
103: static void show_parametric __PROTO((void));
104: static void show_tics __PROTO((int showx, int showy, int showz, int showx2, int showy2));
105: static void show_ticdef __PROTO((int tics, int axis, struct ticdef * tdef, char *text, int rotate_tics, char *ticfmt));
106: static void show_term __PROTO((void));
107: static void show_plot __PROTO((void));
108: static void show_autoscale __PROTO((void));
109: static void show_clip __PROTO((void));
110: static void show_contour __PROTO((void));
111: static void show_mapping __PROTO((void));
112: static void show_format __PROTO((void));
113: static void show_logscale __PROTO((void));
114: static void show_variables __PROTO((void));
115: static void show_surface __PROTO((void));
116: static void show_hidden3d __PROTO((void));
117: static void show_label_contours __PROTO((void));
118: static void show_margin __PROTO((void));
119: static void show_position __PROTO((struct position * pos));
120:
121: static TBOOLEAN show_one __PROTO((void));
122: static TBOOLEAN show_two __PROTO((void));
123: static void show_timefmt __PROTO((void));
124: static void show_locale __PROTO((void));
125: static void show_missing __PROTO((void));
126: static void show_datatype __PROTO((char *name, int axis));
127: static void show_locale __PROTO((void));
128:
129: /* following code segment appears over and over again */
130:
131: #define SHOW_NUM_OR_TIME(x, axis) \
132: do{if (datatype[axis]==TIME) { \
133: char s[80]; char *p; \
134: putc('"', stderr); \
135: gstrftime(s,80,timefmt,(double)(x)); \
136: for(p=s; *p; ++p) {\
137: if ( *p == '\t' ) fputs("\\t",stderr);\
138: else if (*p == '\n') fputs("\\n",stderr); \
139: else if ( *p > 126 || *p < 32 ) fprintf(stderr,"\\%03o",*p);\
140: else putc(*p, stderr);\
141: }\
142: putc('"', stderr);\
143: } else {\
1.1.1.2 ! maekawa 144: fprintf(stderr,"%#g",x);\
1.1 maekawa 145: }} while(0)
146:
147:
148: /******* The 'show' command *******/
149: void show_command()
150: {
151: /* show at is undocumented/hidden... */
152: static char GPFAR showmess[] =
153: "valid set options: [] = choose one, {} means optional\n\n\
154: \t'all', 'angles', 'arrow', 'autoscale', 'bar', 'border', 'boxwidth',\n\
155: \t'clip', 'cntrparam', 'contour', 'data', 'dgrid3d', 'dummy',\n\
156: \t'encoding', 'format', 'function', 'grid', 'hidden', 'isosamples',\n\
157: \t'key', 'label', 'linestyle', 'locale', 'logscale', 'mapping', 'margin',\n\
158: \t'missing', 'offsets', 'origin', 'output', 'plot', 'parametric',\n\
159: \t'pointsize', 'polar', '[rtuv]range', 'samples', 'size', 'terminal',\n\
160: \t'tics', 'timestamp', 'timefmt', 'title', 'variables', 'version',\n\
161: \t'view', '[xyz]{2}label', '[xyz]{2}range', '{m}[xyz]{2}tics',\n\
162: \t'[xyz]{2}[md]tics', '[xyz]{2}zeroaxis', '[xyz]data', 'zero',\n\
163: \t'zeroaxis'";
164:
165:
166: c_token++;
167:
168: if (!show_one() && !show_two())
169: int_error(showmess, c_token);
170: screen_ok = FALSE;
171: (void) putc('\n', stderr);
172: }
173:
174: /* return TRUE if a command match, FALSE if not */
175: static TBOOLEAN
176: show_one()
177: {
178: if (almost_equals(c_token, "ac$tion_table") ||
179: equals(c_token, "at")) {
180: c_token++;
181: show_at();
182: c_token++;
183: } else if (almost_equals(c_token, "ar$row")) {
184: struct value a;
185: int tag = 0;
186:
187: c_token++;
188: if (!END_OF_COMMAND) {
189: tag = (int) real(const_express(&a));
190: if (tag <= 0)
191: int_error("tag must be > zero", c_token);
192: }
193: (void) putc('\n', stderr);
194: show_arrow(tag);
195: } else if (almost_equals(c_token, "au$toscale")) {
196: (void) putc('\n', stderr);
197: show_autoscale();
198: c_token++;
199: } else if (almost_equals(c_token, "b$ars")) {
200: (void) putc('\n', stderr);
201: show_bars();
202: c_token++;
203: } else if (almost_equals(c_token, "bor$der")) {
204: (void) putc('\n', stderr);
205: show_border();
206: c_token++;
207: } else if (almost_equals(c_token, "box$width")) {
208: (void) putc('\n', stderr);
209: show_boxwidth();
210: c_token++;
211: } else if (almost_equals(c_token, "c$lip")) {
212: (void) putc('\n', stderr);
213: show_clip();
214: c_token++;
215: } else if (almost_equals(c_token, "ma$pping")) {
216: (void) putc('\n', stderr);
217: show_mapping();
218: c_token++;
219: } else if (almost_equals(c_token, "co$ntour") ||
220: almost_equals(c_token, "cn$trparam")) {
221: (void) putc('\n', stderr);
222: show_contour();
223: c_token++;
224: } else if (almost_equals(c_token, "da$ta")) {
225: c_token++;
226: if (!almost_equals(c_token, "s$tyle"))
227: int_error("expecting keyword 'style'", c_token);
228: (void) putc('\n', stderr);
229: show_style("data", data_style);
230: c_token++;
231: } else if (almost_equals(c_token, "dg$rid3d")) {
232: (void) putc('\n', stderr);
233: show_dgrid3d();
234: c_token++;
235: } else if (almost_equals(c_token, "du$mmy")) {
236: (void) fprintf(stderr, "\n\tdummy variables are \"%s\" and \"%s\"\n",
237: dummy_var[0], dummy_var[1]);
238: c_token++;
239: } else if (almost_equals(c_token, "fo$rmat")) {
240: show_format();
241: c_token++;
242: } else if (almost_equals(c_token, "fu$nctions")) {
243: c_token++;
244: if (almost_equals(c_token, "s$tyle")) {
245: (void) putc('\n', stderr);
246: show_style("functions", func_style);
247: c_token++;
248: } else
249: show_functions();
250: } else if (almost_equals(c_token, "lo$gscale")) {
251: (void) putc('\n', stderr);
252: show_logscale();
253: c_token++;
254: } else if (almost_equals(c_token, "of$fsets")) {
255: (void) putc('\n', stderr);
256: show_offsets();
257: c_token++;
258: } else if (almost_equals(c_token, "ma$rgin")) {
259: (void) putc('\n', stderr);
260: show_margin();
261: c_token++;
262: } else if (almost_equals(c_token, "o$utput")) {
263: (void) putc('\n', stderr);
264: show_output();
265: c_token++;
266: } else if (almost_equals(c_token, "tit$le")) {
267: (void) putc('\n', stderr);
268: show_xyzlabel("title", &title);
269: c_token++;
270: } else if (almost_equals(c_token, "mis$sing")) {
271: (void) putc('\n', stderr);
272: show_missing();
273: c_token++;
274: } else if (almost_equals(c_token, "xl$abel")) {
275: (void) putc('\n', stderr);
276: show_xyzlabel("xlabel", &xlabel);
277: c_token++;
278: } else if (almost_equals(c_token, "x2l$abel")) {
279: (void) putc('\n', stderr);
280: show_xyzlabel("x2label", &x2label);
281: c_token++;
282: } else if (almost_equals(c_token, "yl$abel")) {
283: (void) putc('\n', stderr);
284: show_xyzlabel("ylabel", &ylabel);
285: c_token++;
286: } else if (almost_equals(c_token, "y2l$abel")) {
287: (void) putc('\n', stderr);
288: show_xyzlabel("y2label", &y2label);
289: c_token++;
290: } else if (almost_equals(c_token, "zl$abel")) {
291: (void) putc('\n', stderr);
292: show_xyzlabel("zlabel", &zlabel);
293: c_token++;
294: } else if (almost_equals(c_token, "keyt$itle")) {
295: (void) putc('\n', stderr);
296: show_keytitle();
297: c_token++;
298: } else if (almost_equals(c_token, "xda$ta")) {
299: (void) putc('\n', stderr);
300: show_datatype("xdata", FIRST_X_AXIS);
301: c_token++;
302: } else if (almost_equals(c_token, "yda$ta")) {
303: (void) putc('\n', stderr);
304: show_datatype("ydata", FIRST_Y_AXIS);
305: c_token++;
306: } else if (almost_equals(c_token, "x2da$ta")) {
307: (void) putc('\n', stderr);
308: show_datatype("x2data", SECOND_X_AXIS);
309: c_token++;
310: } else if (almost_equals(c_token, "y2da$ta")) {
311: (void) putc('\n', stderr);
312: show_datatype("y2data", SECOND_Y_AXIS);
313: c_token++;
314: } else if (almost_equals(c_token, "zda$ta")) {
315: (void) putc('\n', stderr);
316: show_datatype("zdata", FIRST_Z_AXIS);
317: c_token++;
318: } else if (almost_equals(c_token, "timef$mt")) {
319: (void) putc('\n', stderr);
320: show_timefmt();
321: c_token++;
322: } else if (almost_equals(c_token, "loca$le")) {
323: (void) putc('\n', stderr);
324: show_locale();
325: c_token++;
326: } else if (almost_equals(c_token, "xzero$axis")) {
327: (void) putc('\n', stderr);
328: show_xzeroaxis();
329: c_token++;
330: } else if (almost_equals(c_token, "yzero$axis")) {
331: (void) putc('\n', stderr);
332: show_yzeroaxis();
333: c_token++;
334: } else if (almost_equals(c_token, "zeroa$xis")) {
335: (void) putc('\n', stderr);
336: show_xzeroaxis();
337: show_yzeroaxis();
338: c_token++;
339: } else if (almost_equals(c_token, "la$bel")) {
340: struct value a;
341: int tag = 0;
342:
343: c_token++;
344: if (!END_OF_COMMAND) {
345: tag = (int) real(const_express(&a));
346: if (tag <= 0)
347: int_error("tag must be > zero", c_token);
348: }
349: (void) putc('\n', stderr);
350: show_label(tag);
351: } else if (almost_equals(c_token, "li$nestyle") || equals(c_token, "ls")) {
352: struct value a;
353: int tag = 0;
354:
355: c_token++;
356: if (!END_OF_COMMAND) {
357: tag = (int) real(const_express(&a));
358: if (tag <= 0)
359: int_error("tag must be > zero", c_token);
360: }
361: (void) putc('\n', stderr);
362: show_linestyle(tag);
363: } else if (almost_equals(c_token, "g$rid")) {
364: (void) putc('\n', stderr);
365: show_grid();
366: c_token++;
367: } else if (almost_equals(c_token, "mxt$ics")) {
368: (void) putc('\n', stderr);
369: show_mtics(mxtics, mxtfreq, "x");
370: c_token++;
371: } else if (almost_equals(c_token, "myt$ics")) {
372: (void) putc('\n', stderr);
373: show_mtics(mytics, mytfreq, "y");
374: c_token++;
375: } else if (almost_equals(c_token, "mzt$ics")) {
376: (void) putc('\n', stderr);
377: show_mtics(mztics, mztfreq, "z");
378: c_token++;
379: } else if (almost_equals(c_token, "mx2t$ics")) {
380: (void) putc('\n', stderr);
381: show_mtics(mx2tics, mx2tfreq, "x2");
382: c_token++;
383: } else if (almost_equals(c_token, "my2t$ics")) {
384: (void) putc('\n', stderr);
385: show_mtics(my2tics, my2tfreq, "y2");
386: c_token++;
387: } else if (almost_equals(c_token, "k$ey")) {
388: (void) putc('\n', stderr);
389: show_key();
390: c_token++;
391: } else
392: return (FALSE);
393: return TRUE;
394: }
395:
396: /* return TRUE if a command match, FALSE if not */
397: static TBOOLEAN
398: show_two()
399: {
400: if (almost_equals(c_token, "p$lot")) {
401: (void) putc('\n', stderr);
402: show_plot();
403: c_token++;
404: } else if (almost_equals(c_token, "par$ametric")) {
405: (void) putc('\n', stderr);
406: show_parametric();
407: c_token++;
408: } else if (almost_equals(c_token, "poi$ntsize")) {
409: (void) putc('\n', stderr);
410: show_pointsize();
411: c_token++;
412: } else if (almost_equals(c_token, "enc$oding")) {
413: (void) putc('\n', stderr);
414: show_encoding();
415: c_token++;
416: } else if (almost_equals(c_token, "pol$ar")) {
417: (void) putc('\n', stderr);
418: show_polar();
419: c_token++;
420: } else if (almost_equals(c_token, "an$gles")) {
421: (void) putc('\n', stderr);
422: show_angles();
423: c_token++;
424: } else if (almost_equals(c_token, "ti$cs")) {
425: (void) putc('\n', stderr);
426: show_tics(TRUE, TRUE, TRUE, TRUE, TRUE);
427: c_token++;
428: } else if (almost_equals(c_token, "tim$estamp")) {
429: (void) putc('\n', stderr);
430: show_xyzlabel("time", &timelabel);
431: fprintf(stderr, "\twritten in %s corner\n", (timelabel_bottom ? "bottom" : "top"));
432: if (timelabel_rotate)
433: fputs("\trotated if the terminal allows it\n\t", stderr);
434: else
435: fputs("\tnot rotated\n\t", stderr);
436: c_token++;
437: } else if (almost_equals(c_token, "su$rface")) {
438: (void) putc('\n', stderr);
439: show_surface();
440: c_token++;
441: } else if (almost_equals(c_token, "hi$dden3d")) {
442: (void) putc('\n', stderr);
443: show_hidden3d();
444: c_token++;
445: } else if (almost_equals(c_token, "cla$bel")) {
446: (void) putc('\n', stderr);
447: show_label_contours();
448: c_token++;
449: } else if (almost_equals(c_token, "xti$cs")) {
450: show_tics(TRUE, FALSE, FALSE, TRUE, FALSE);
451: c_token++;
452: } else if (almost_equals(c_token, "yti$cs")) {
453: show_tics(FALSE, TRUE, FALSE, FALSE, TRUE);
454: c_token++;
455: } else if (almost_equals(c_token, "zti$cs")) {
456: show_tics(FALSE, FALSE, TRUE, FALSE, FALSE);
457: c_token++;
458: } else if (almost_equals(c_token, "x2ti$cs")) {
459: show_tics(FALSE, FALSE, FALSE, TRUE, FALSE);
460: c_token++;
461: } else if (almost_equals(c_token, "y2ti$cs")) {
462: show_tics(FALSE, FALSE, FALSE, FALSE, TRUE);
463: c_token++;
464: } else if (almost_equals(c_token, "xdti$cs")) {
465: show_tics(TRUE, FALSE, FALSE, TRUE, FALSE);
466: c_token++;
467: } else if (almost_equals(c_token, "ydti$cs")) {
468: show_tics(FALSE, TRUE, FALSE, FALSE, TRUE);
469: c_token++;
470: } else if (almost_equals(c_token, "zdti$cs")) {
471: show_tics(FALSE, FALSE, TRUE, FALSE, FALSE);
472: c_token++;
473: } else if (almost_equals(c_token, "x2dti$cs")) {
474: show_tics(FALSE, FALSE, FALSE, TRUE, FALSE);
475: c_token++;
476: } else if (almost_equals(c_token, "y2dti$cs")) {
477: show_tics(FALSE, FALSE, FALSE, FALSE, TRUE);
478: c_token++;
479: } else if (almost_equals(c_token, "xmti$cs")) {
480: show_tics(TRUE, FALSE, FALSE, TRUE, FALSE);
481: c_token++;
482: } else if (almost_equals(c_token, "ymti$cs")) {
483: show_tics(FALSE, TRUE, FALSE, FALSE, TRUE);
484: c_token++;
485: } else if (almost_equals(c_token, "zmti$cs")) {
486: show_tics(FALSE, FALSE, TRUE, FALSE, FALSE);
487: c_token++;
488: } else if (almost_equals(c_token, "x2mti$cs")) {
489: show_tics(FALSE, FALSE, FALSE, TRUE, FALSE);
490: c_token++;
491: } else if (almost_equals(c_token, "y2mti$cs")) {
492: show_tics(FALSE, FALSE, FALSE, FALSE, TRUE);
493: c_token++;
494: } else if (almost_equals(c_token, "sa$mples")) {
495: (void) putc('\n', stderr);
496: show_samples();
497: c_token++;
498: } else if (almost_equals(c_token, "isosa$mples")) {
499: (void) putc('\n', stderr);
500: show_isosamples();
501: c_token++;
502: } else if (almost_equals(c_token, "si$ze")) {
503: (void) putc('\n', stderr);
504: show_size();
505: c_token++;
506: } else if (almost_equals(c_token, "orig$in")) {
507: (void) putc('\n', stderr);
508: show_origin();
509: c_token++;
510: } else if (almost_equals(c_token, "t$erminal")) {
511: (void) putc('\n', stderr);
512: show_term();
513: c_token++;
514: } else if (almost_equals(c_token, "rr$ange")) {
515: (void) putc('\n', stderr);
516: show_range(R_AXIS, rmin, rmax, autoscale_r, "r");
517: c_token++;
518: } else if (almost_equals(c_token, "tr$ange")) {
519: (void) putc('\n', stderr);
520: show_range(T_AXIS, tmin, tmax, autoscale_t, "t");
521: c_token++;
522: } else if (almost_equals(c_token, "ur$ange")) {
523: (void) putc('\n', stderr);
524: show_range(U_AXIS, umin, umax, autoscale_u, "u");
525: c_token++;
526: } else if (almost_equals(c_token, "vi$ew")) {
527: (void) putc('\n', stderr);
528: show_view();
529: c_token++;
530: } else if (almost_equals(c_token, "vr$ange")) {
531: (void) putc('\n', stderr);
532: show_range(V_AXIS, vmin, vmax, autoscale_v, "v");
533: c_token++;
534: } else if (almost_equals(c_token, "v$ariables")) {
535: show_variables();
536: c_token++;
537: } else if (almost_equals(c_token, "ve$rsion")) {
538: show_version(stderr);
539: c_token++;
540: if (almost_equals(c_token, "l$ong")) {
541: show_version_long();
542: c_token++;
543: }
544: } else if (almost_equals(c_token, "xr$ange")) {
545: (void) putc('\n', stderr);
546: show_range(FIRST_X_AXIS, xmin, xmax, autoscale_x, "x");
547: c_token++;
548: } else if (almost_equals(c_token, "yr$ange")) {
549: (void) putc('\n', stderr);
550: show_range(FIRST_Y_AXIS, ymin, ymax, autoscale_y, "y");
551: c_token++;
552: } else if (almost_equals(c_token, "x2r$ange")) {
553: (void) putc('\n', stderr);
554: show_range(SECOND_X_AXIS, x2min, x2max, autoscale_x2, "x2");
555: c_token++;
556: } else if (almost_equals(c_token, "y2r$ange")) {
557: (void) putc('\n', stderr);
558: show_range(SECOND_Y_AXIS, y2min, y2max, autoscale_y2, "y2");
559: c_token++;
560: } else if (almost_equals(c_token, "zr$ange")) {
561: (void) putc('\n', stderr);
562: show_range(FIRST_Z_AXIS, zmin, zmax, autoscale_z, "z");
563: c_token++;
564: } else if (almost_equals(c_token, "z$ero")) {
565: (void) putc('\n', stderr);
566: show_zero();
567: c_token++;
568: } else if (almost_equals(c_token, "a$ll")) {
569: c_token++;
570: show_version(stderr);
571: show_autoscale();
572: show_bars();
573: show_border();
574: show_boxwidth();
575: show_clip();
576: show_contour();
577: show_dgrid3d();
578: show_mapping();
579: (void) fprintf(stderr, "\tdummy variables are \"%s\" and \"%s\"\n",
580: dummy_var[0], dummy_var[1]);
581: show_format();
582: show_style("data", data_style);
583: show_style("functions", func_style);
584: show_grid();
585: show_xzeroaxis();
586: show_yzeroaxis();
587: show_label(0);
588: show_arrow(0);
589: show_linestyle(0);
590: show_keytitle();
591: show_key();
592: show_logscale();
593: show_offsets();
594: show_margin();
595: show_output();
596: show_parametric();
597: show_pointsize();
598: show_encoding();
599: show_polar();
600: show_angles();
601: show_samples();
602: show_isosamples();
603: show_view();
604: show_surface();
605: #ifndef LITE
606: show_hidden3d();
607: #endif
608: show_size();
609: show_origin();
610: show_term();
611: show_tics(TRUE, TRUE, TRUE, TRUE, TRUE);
612: show_mtics(mxtics, mxtfreq, "x");
613: show_mtics(mytics, mytfreq, "y");
614: show_mtics(mztics, mztfreq, "z");
615: show_mtics(mx2tics, mx2tfreq, "x2");
616: show_mtics(my2tics, my2tfreq, "y2");
617: show_xyzlabel("time", &timelabel);
618: if (parametric || polar) {
619: if (!is_3d_plot)
620: show_range(T_AXIS, tmin, tmax, autoscale_t, "t");
621: else {
622: show_range(U_AXIS, umin, umax, autoscale_u, "u");
623: show_range(V_AXIS, vmin, vmax, autoscale_v, "v");
624: }
625: }
626: show_range(FIRST_X_AXIS, xmin, xmax, autoscale_x, "x");
627: show_range(FIRST_Y_AXIS, ymin, ymax, autoscale_y, "y");
628: show_range(SECOND_X_AXIS, x2min, x2max, autoscale_x2, "x2");
629: show_range(SECOND_Y_AXIS, y2min, y2max, autoscale_y2, "y2");
630: show_range(FIRST_Z_AXIS, zmin, zmax, autoscale_z, "z");
631: show_xyzlabel("title", &title);
632: show_xyzlabel("xlabel", &xlabel);
633: show_xyzlabel("ylabel", &ylabel);
634: show_xyzlabel("zlabel", &zlabel);
635: show_xyzlabel("x2label", &x2label);
636: show_xyzlabel("y2label", &y2label);
637: show_datatype("xdata", FIRST_X_AXIS);
638: show_datatype("ydata", FIRST_Y_AXIS);
639: show_datatype("x2data", SECOND_X_AXIS);
640: show_datatype("y2data", SECOND_Y_AXIS);
641: show_datatype("zdata", FIRST_Z_AXIS);
642: show_timefmt();
643: show_locale();
644: show_zero();
645: show_missing();
646: show_plot();
647: show_variables();
648: show_functions();
649: c_token++;
650: } else
651: return (FALSE);
652: return (TRUE);
653: }
654:
655:
656: /*********** support functions for 'show' **********/
657: /* perhaps these need to be put into a constant array ? */
658: static void show_style(name, style)
659: char name[];
660: enum PLOT_STYLE style;
661: {
662: fprintf(stderr, "\t%s are plotted with ", name);
663: switch (style) {
664: case LINES:
665: fputs("lines\n", stderr);
666: break;
667: case POINTSTYLE:
668: fputs("points\n", stderr);
669: break;
670: case IMPULSES:
671: fputs("impulses\n", stderr);
672: break;
673: case LINESPOINTS:
674: fputs("linespoints\n", stderr);
675: break;
676: case DOTS:
677: fputs("dots\n", stderr);
678: break;
679: case YERRORBARS:
680: fputs("yerrorbars\n", stderr);
681: break;
682: case XERRORBARS:
683: fputs("xerrorbars\n", stderr);
684: break;
685: case XYERRORBARS:
686: fputs("xyerrorbars\n", stderr);
687: break;
688: case BOXES:
689: fputs("boxes\n", stderr);
690: break;
691: case BOXERROR:
692: fputs("boxerrorbars\n", stderr);
693: break;
694: case BOXXYERROR:
695: fputs("boxxyerrorbars\n", stderr);
696: break;
697: case STEPS:
698: fputs("steps\n", stderr);
699: break;
700: case FSTEPS:
701: fputs("fsteps\n", stderr);
702: break;
703: case HISTEPS:
704: fputs("histeps\n", stderr);
705: break;
706: case VECTOR:
707: fputs("vector\n", stderr);
708: break;
709: case FINANCEBARS:
710: fputs("financebars\n", stderr);
711: break;
712: case CANDLESTICKS:
713: fputs("candlesticsks\n", stderr);
714: break;
715: }
716: }
717:
718: static void show_bars()
719: {
720: /* I really like this: "terrorbars" ;-) */
721: if (bar_size > 0.0)
722: fprintf(stderr, "\terrorbars are plotted with bars of size %f\n",
723: bar_size);
724: else
725: fputs("\terrors are plotted without bars\n", stderr);
726: }
727:
728: static void show_boxwidth()
729: {
730: if (boxwidth < 0.0)
731: fputs("\tboxwidth is auto\n", stderr);
732: else
733: fprintf(stderr, "\tboxwidth is %g\n", boxwidth);
734: }
735: static void show_dgrid3d()
736: {
737: if (dgrid3d)
738: fprintf(stderr, "\
739: \tdata grid3d is enabled for mesh of size %dx%d, norm=%d\n",
740: dgrid3d_row_fineness,
741: dgrid3d_col_fineness,
742: dgrid3d_norm_value);
743: else
744: fputs("\tdata grid3d is disabled\n", stderr);
745: }
746:
747: static void show_range(axis, min, max, autosc, text)
748: int axis;
749: double min, max;
750: TBOOLEAN autosc;
751: char *text;
752: {
753: /* this probably ought to just invoke save_range(stderr) from misc.c
754: * since I think it is identical
755: */
756:
757: if (datatype[axis] == TIME)
758: fprintf(stderr, "\tset %sdata time\n", text);
759: fprintf(stderr, "\tset %srange [", text);
760: if (autosc & 1) {
761: fputc('*', stderr);
762: } else {
763: SHOW_NUM_OR_TIME(min, axis);
764: }
765: fputs(" : ", stderr);
766: if (autosc & 2) {
767: fputc('*', stderr);
768: } else {
769: SHOW_NUM_OR_TIME(max, axis);
770: }
771: fprintf(stderr, "] %sreverse %swriteback",
772: (range_flags[axis] & RANGE_REVERSE) ? "" : "no",
773: (range_flags[axis] & RANGE_WRITEBACK) ? "" : "no");
774:
775: if (autosc) {
776: /* add current (hidden) range as comments */
777: fputs(" # (currently [", stderr);
778: if (autosc & 1) {
779: SHOW_NUM_OR_TIME(min, axis);
780: }
781: putc(':', stderr);
782: if (autosc & 2) {
783: SHOW_NUM_OR_TIME(max, axis);
784: }
785: fputs("] )\n", stderr);
786: } else {
787: putc('\n', stderr);
788: }
789: }
790:
791: static void show_zero()
792: {
793: fprintf(stderr, "\tzero is %g\n", zero);
794: }
795:
796: static void show_offsets()
797: {
798: fprintf(stderr, "\toffsets are %g, %g, %g, %g\n", loff, roff, toff, boff);
799: }
800:
801: static void show_border()
802: {
803: fprintf(stderr, "\tborder is %sdrawn %d\n", draw_border ? "" : "not ",
804: draw_border);
805: /* HBB 980609: added facilities to specify border linestyle */
806: fprintf(stderr, "\tBorder drawn with linetype %d, linewidth %.3f\n",
807: border_lp.l_type + 1, border_lp.l_width);
808: }
809:
810: static void show_output()
811: {
812: if (outstr)
813: fprintf(stderr, "\toutput is sent to '%s'\n", outstr);
814: else
815: fputs("\toutput is sent to STDOUT\n", stderr);
816: }
817:
818: static void show_samples()
819: {
820: fprintf(stderr, "\tsampling rate is %d, %d\n", samples_1, samples_2);
821: }
822:
823: static void show_isosamples()
824: {
825: fprintf(stderr, "\tiso sampling rate is %d, %d\n",
826: iso_samples_1, iso_samples_2);
827: }
828:
829: static void show_surface()
830: {
831: fprintf(stderr, "\tsurface is %sdrawn\n", draw_surface ? "" : "not ");
832: }
833:
834: static void show_hidden3d()
835: {
836: #ifdef LITE
837: printf(" Hidden Line Removal Not Supported in LITE version\n");
838: #else
839: fprintf(stderr, "\thidden surface is %s\n", hidden3d ? "removed" : "drawn");
840: show_hidden3doptions();
841: #endif /* LITE */
842: }
843:
844: static void show_label_contours()
845: {
846: if (label_contours)
847: fprintf(stderr, "\tcontour line types are varied & labeled with format '%s'\n", contour_format);
848: else
849: fputs("\tcontour line types are all the same\n", stderr);
850: }
851:
852: static void show_view()
853: {
854: fprintf(stderr, "\tview is %g rot_x, %g rot_z, %g scale, %g scale_z\n",
855: surface_rot_x, surface_rot_z, surface_scale, surface_zscale);
856: }
857:
858: static void show_size()
859: {
860: fprintf(stderr, "\tsize is scaled by %g,%g\n", xsize, ysize);
861: if (aspect_ratio > 0)
862: fprintf(stderr, "\tTry to set aspect ratio to %g:1.0\n", aspect_ratio);
863: else if (aspect_ratio == 0)
864: fputs("\tNo attempt to control aspect ratio\n", stderr);
865: else
866: fprintf(stderr, "\tTry to set LOCKED aspect ratio to %g:1.0\n",
867: -aspect_ratio);
868: }
869:
870: static void show_origin()
871: {
872: fprintf(stderr, "\torigin is set to %g,%g\n", xoffset, yoffset);
873: }
874:
875: static void show_xyzlabel(name, label)
876: char *name;
877: label_struct *label;
878: {
879: char str[MAX_LINE_LEN + 1];
880: fprintf(stderr, "\t%s is \"%s\", offset at %f, %f",
881: name, conv_text(str, label->text), label->xoffset, label->yoffset);
882: if (*label->font)
883: fprintf(stderr, ", using font \"%s\"", conv_text(str, label->font));
884: putc('\n', stderr);
885: }
886:
887: static void show_keytitle()
888: {
889: char str[MAX_LINE_LEN+1];
890: fprintf(stderr, "\tkeytitle is \"%s\"\n",
891: conv_text(str, key_title));
892: }
893:
894: static void show_timefmt()
895: {
896: char str[MAX_LINE_LEN+1];
897: fprintf(stderr, "\tread format for time is \"%s\"\n",
898: conv_text(str, timefmt));
899: }
900:
901: static void show_locale()
902: {
903: fprintf(stderr, "\tlocale is \"%s\"\n", cur_locale);
904: }
905:
906: static void show_xzeroaxis()
907: {
908: if (xzeroaxis.l_type > -3)
909: fprintf(stderr, "\txzeroaxis is drawn with linestyle %d, linewidth %.3f\n", xzeroaxis.l_type + 1, xzeroaxis.l_width);
910: else
911: fputs("\txzeroaxis is OFF\n", stderr);
912: if (x2zeroaxis.l_type > -3)
913: fprintf(stderr, "\tx2zeroaxis is drawn with linestyle %d, linewidth %.3f\n", x2zeroaxis.l_type + 1, x2zeroaxis.l_width);
914: else
915: fputs("\tx2zeroaxis is OFF\n", stderr);
916: }
917:
918: static void show_yzeroaxis()
919: {
920: if (yzeroaxis.l_type > -3)
921: fprintf(stderr, "\tyzeroaxis is drawn with linestyle %d, linewidth %.3f\n", yzeroaxis.l_type + 1, yzeroaxis.l_width);
922: else
923: fputs("\tyzeroaxis is OFF\n", stderr);
924: if (y2zeroaxis.l_type > -3)
925: fprintf(stderr, "\ty2zeroaxis is drawn with linestyle %d, linewidth %.3f\n", y2zeroaxis.l_type + 1, y2zeroaxis.l_width);
926: else
927: fputs("\ty2zeroaxis is OFF\n", stderr);
928: }
929:
930: static void show_label(tag)
931: int tag; /* 0 means show all */
932: {
933: struct text_label *this_label;
934: TBOOLEAN showed = FALSE;
935: char str[MAX_LINE_LEN + 1];
936:
937: for (this_label = first_label; this_label != NULL;
938: this_label = this_label->next) {
939: if (tag == 0 || tag == this_label->tag) {
940: showed = TRUE;
941: fprintf(stderr, "\tlabel %d \"%s\" at ",
942: this_label->tag, conv_text(str, this_label->text));
943: show_position(&this_label->place);
944: switch (this_label->pos) {
945: case LEFT:{
946: fputs(" left", stderr);
947: break;
948: }
949: case CENTRE:{
950: fputs(" centre", stderr);
951: break;
952: }
953: case RIGHT:{
954: fputs(" right", stderr);
955: break;
956: }
957: }
958: fprintf(stderr, " %s ", this_label->rotate ? "rotated (if possible)" : "not rotated");
959: if ((this_label->font)[0] != NUL)
960: fprintf(stderr, " font \"%s\"", this_label->font);
961: /* Entry font added by DJL */
962: fputc('\n', stderr);
963: }
964: }
965: if (tag > 0 && !showed)
966: int_error("label not found", c_token);
967: }
968:
969: static void show_arrow(tag)
970: int tag; /* 0 means show all */
971: {
972: struct arrow_def *this_arrow;
973: TBOOLEAN showed = FALSE;
974:
975: for (this_arrow = first_arrow; this_arrow != NULL;
976: this_arrow = this_arrow->next) {
977: if (tag == 0 || tag == this_arrow->tag) {
978: showed = TRUE;
979: fprintf(stderr, "\tarrow %d, linetype %d, linewidth %.3f %s\n\t from ",
980: this_arrow->tag,
981: this_arrow->lp_properties.l_type + 1,
982: this_arrow->lp_properties.l_width,
983: this_arrow->head ? "" : " (nohead)");
984: show_position(&this_arrow->start);
985: fputs(" to ", stderr);
986: show_position(&this_arrow->end);
987: putc('\n', stderr);
988: }
989: }
990: if (tag > 0 && !showed)
991: int_error("arrow not found", c_token);
992: }
993:
994: static void show_linestyle(tag)
995: int tag; /* 0 means show all */
996: {
997: struct linestyle_def *this_linestyle;
998: TBOOLEAN showed = FALSE;
999:
1000: for (this_linestyle = first_linestyle; this_linestyle != NULL;
1001: this_linestyle = this_linestyle->next) {
1002: if (tag == 0 || tag == this_linestyle->tag) {
1003: showed = TRUE;
1004: fprintf(stderr, "\tlinestyle %d, linetype %d, linewidth %.3f, pointtype %d, pointsize %.3f\n",
1005: this_linestyle->tag,
1006: this_linestyle->lp_properties.l_type + 1,
1007: this_linestyle->lp_properties.l_width,
1008: this_linestyle->lp_properties.p_type + 1,
1009: this_linestyle->lp_properties.p_size);
1010: }
1011: }
1012: if (tag > 0 && !showed)
1013: int_error("linestyle not found", c_token);
1014: }
1015:
1016: static void show_grid()
1017: {
1018: if (!work_grid.l_type) {
1019: fputs("\tgrid is OFF\n", stderr);
1020: return;
1021: }
1022: fprintf(stderr, "\t%s grid drawn at%s%s%s%s%s%s%s%s%s%s tics\n",
1023: (polar_grid_angle != 0) ? "Polar" : "Rectangular",
1024: work_grid.l_type & GRID_X ? " x" : "",
1025: work_grid.l_type & GRID_Y ? " y" : "",
1026: work_grid.l_type & GRID_Z ? " z" : "",
1027: work_grid.l_type & GRID_X2 ? " x2" : "",
1028: work_grid.l_type & GRID_Y2 ? " y2" : "",
1029: work_grid.l_type & GRID_MX ? " mx" : "",
1030: work_grid.l_type & GRID_MY ? " my" : "",
1031: work_grid.l_type & GRID_MZ ? " mz" : "",
1032: work_grid.l_type & GRID_MX2 ? " mx2" : "",
1033: work_grid.l_type & GRID_MY2 ? " my2" : "");
1034:
1035: fprintf(stderr, "\tMajor grid drawn with linetype %d, linewidth %.3f\n",
1036: grid_lp.l_type + 1, grid_lp.l_width);
1037: fprintf(stderr, "\tMinor grid drawn with linetype %d, linewidth %.3f\n",
1038: mgrid_lp.l_type + 1, mgrid_lp.l_width);
1039:
1040: if (polar_grid_angle)
1041: fprintf(stderr, "\tGrid radii drawn every %f %s\n",
1042: polar_grid_angle / ang2rad,
1043: angles_format == ANGLES_DEGREES ? "degrees" : "radians");
1044: }
1045:
1046: static void show_mtics(minitic, minifreq, name)
1047: int minitic;
1048: double minifreq;
1049: char *name;
1050: {
1051: switch (minitic) {
1052: case MINI_OFF:
1053: fprintf(stderr, "\tminor %stics are off\n", name);
1054: break;
1055: case MINI_DEFAULT:
1056: fprintf(stderr, "\tminor %stics are computed automatically for log scales\n", name);
1057: break;
1058: case MINI_AUTO:
1059: fprintf(stderr, "\tminor %stics are computed automatically\n", name);
1060: break;
1061: case MINI_USER:
1062: fprintf(stderr, "\tminor %stics are drawn with %d subintervals between major xtic marks\n", name, (int) minifreq);
1063: break;
1064: default:
1065: int_error("Unknown minitic type in show_mtics()", NO_CARET);
1066: }
1067: }
1068:
1069: static void show_key()
1070: {
1071: char str[80];
1072: *str = '\0';
1073: switch (key) {
1074: case -1:
1075: if (key_vpos == TUNDER) {
1076: strcpy(str, "below");
1077: } else if (key_vpos == TTOP) {
1078: strcpy(str, "top");
1079: } else {
1080: strcpy(str, "bottom");
1081: }
1082: if (key_hpos == TOUT) {
1083: strcpy(str, "outside (right)");
1084: } else if (key_hpos == TLEFT) {
1085: strcat(str, " left");
1086: } else {
1087: strcat(str, " right");
1088: }
1089: if (key_vpos != TUNDER && key_hpos != TOUT) {
1090: strcat(str, " corner");
1091: }
1092: fprintf(stderr, "\tkey is ON, position: %s\n", str);
1093: break;
1094: case 0:
1095: fputs("\tkey is OFF\n", stderr);
1096: break;
1097: case 1:
1098: fputs("\tkey is at ", stderr);
1099: show_position(&key_user_pos);
1100: putc('\n', stderr);
1101: break;
1102: }
1103: if (key) {
1104: fprintf(stderr, "\tkey is %s justified, %s reversed and ",
1105: key_just == JLEFT ? "left" : "right",
1106: key_reverse ? "" : "not");
1107: if (key_box.l_type >= -2)
1108: fprintf(stderr, "boxed\n\twith linetype %d, linewidth %.3f\n",
1109: key_box.l_type + 1, key_box.l_width);
1110: else
1111: fprintf(stderr, "not boxed\n\
1112: \tsample length is %g characters\n\
1113: \tvertical spacing is %g characters\n\
1114: \twidth adjustment is %g characters\n\
1115: \tkey title is \"%s\"\n",
1116: key_swidth,
1117: key_vert_factor,
1118: key_width_fix,
1119: key_title);
1120: }
1121: }
1122:
1123: static void show_parametric()
1124: {
1125: fprintf(stderr, "\tparametric is %s\n", (parametric) ? "ON" : "OFF");
1126: }
1127:
1128: static void show_pointsize()
1129: {
1130: fprintf(stderr, "\tpointsize is %g\n", pointsize);
1131: }
1132:
1133: static void show_encoding()
1134: {
1135: fprintf(stderr, "\tencoding is %s\n", encoding_names[encoding]);
1136: }
1137:
1138: static void show_polar()
1139: {
1140: fprintf(stderr, "\tpolar is %s\n", (polar) ? "ON" : "OFF");
1141: }
1142:
1143: static void show_angles()
1144: {
1145: fputs("\tAngles are in ", stderr);
1146: switch (angles_format) {
1147: case ANGLES_RADIANS:
1148: fputs("radians\n", stderr);
1149: break;
1150: case ANGLES_DEGREES:
1151: fputs("degrees\n", stderr);
1152: break;
1153: }
1154: }
1155:
1156:
1157: static void show_tics(showx, showy, showz, showx2, showy2)
1158: TBOOLEAN showx, showy, showz, showx2, showy2;
1159: {
1160: char str[MAX_LINE_LEN+1];
1161: fprintf(stderr, "\ttics are %s, \
1162: \tticslevel is %g\n\
1163: \tmajor ticscale is %g and minor ticscale is %g\n",
1164: (tic_in ? "IN" : "OUT"),
1165: ticslevel,
1166: ticscale, miniticscale);
1167:
1168: if (showx)
1169: show_ticdef(xtics, FIRST_X_AXIS, &xticdef, "x", rotate_xtics,
1170: conv_text(str, xformat));
1171: if (showx2)
1172: show_ticdef(x2tics, SECOND_X_AXIS, &x2ticdef, "x2", rotate_x2tics,
1173: conv_text(str, x2format));
1174: if (showy)
1175: show_ticdef(ytics, FIRST_Y_AXIS, &yticdef, "y", rotate_ytics,
1176: conv_text(str, yformat));
1177: if (showy2)
1178: show_ticdef(y2tics, SECOND_Y_AXIS, &y2ticdef, "y2", rotate_y2tics,
1179: conv_text(str, y2format));
1180: if (showz)
1181: show_ticdef(ztics, FIRST_Z_AXIS, &zticdef, "z", rotate_ztics,
1182: conv_text(str, zformat));
1183: screen_ok = FALSE;
1184: }
1185:
1186: /* called by show_tics */
1187: static void show_ticdef(tics, axis, tdef, text, rotate_tics, ticfmt)
1188: int tics; /* xtics ytics or ztics */
1189: int axis;
1190: struct ticdef *tdef; /* xticdef yticdef or zticdef */
1191: char *text; /* "x", ..., "x2", "y2" */
1192: char *ticfmt;
1193: int rotate_tics;
1194: {
1195: register struct ticmark *t;
1196:
1197: fprintf(stderr, "\t%s-axis tics:\t", text);
1198: switch (tics & TICS_MASK) {
1199: case NO_TICS:
1200: fputs("OFF\n", stderr);
1201: return;
1202: case TICS_ON_AXIS:
1203: fputs("on axis", stderr);
1204: if (tics & TICS_MIRROR)
1205: fprintf(stderr, " and mirrored %s", (tic_in ? "OUT" : "IN"));
1206: break;
1207: case TICS_ON_BORDER:
1208: fputs("on border", stderr);
1209: if (tics & TICS_MIRROR)
1210: fputs(" and mirrored on opposite border", stderr);
1211: break;
1212: }
1213:
1214: fprintf(stderr,"\n\t labels are format \"%s\"", ticfmt);
1215: if (rotate_tics)
1216: fputs(", rotated in 2D mode, terminal permitting.\n\t", stderr);
1217: else
1218: fputs(" and are not rotated\n\t", stderr);
1219:
1220: switch (tdef->type) {
1221: case TIC_COMPUTED:{
1222: fputs(" intervals computed automatically\n", stderr);
1223: break;
1224: }
1225: case TIC_MONTH:{
1226: fputs(" Months computed automatically\n", stderr);
1227: break;
1228: }
1229: case TIC_DAY:{
1230: fputs(" Days computed automatically\n", stderr);
1231: break;
1232: }
1233: case TIC_SERIES:{
1234: fputs(" series", stderr);
1235: if (tdef->def.series.start != -VERYLARGE) {
1236: fputs(" from ", stderr);
1237: SHOW_NUM_OR_TIME(tdef->def.series.start, axis);
1238: }
1239: fprintf(stderr, " by %g%s", tdef->def.series.incr, datatype[axis] == TIME ? " secs" : "");
1240: if (tdef->def.series.end != VERYLARGE) {
1241: fputs(" until ", stderr);
1242: SHOW_NUM_OR_TIME(tdef->def.series.end, axis);
1243: }
1244: putc('\n', stderr);
1245: break;
1246: }
1247: case TIC_USER:{
1248: /* this appears to be unused? lh
1249: int time;
1250: time = (datatype[axis] == TIME);
1251: */
1252: fputs(" list (", stderr);
1253: for (t = tdef->def.user; t != NULL; t = t->next) {
1254: if (t->label) {
1255: char str[MAX_LINE_LEN+1];
1256: fprintf(stderr, "\"%s\" ", conv_text(str, t->label));
1257: }
1258: SHOW_NUM_OR_TIME(t->position, axis);
1259: if (t->next)
1260: fputs(", ", stderr);
1261: }
1262: fputs(")\n", stderr);
1263: break;
1264: }
1265: default:{
1266: int_error("unknown ticdef type in show_ticdef()", NO_CARET);
1267: /* NOTREACHED */
1268: }
1269: }
1270: }
1271:
1272:
1273: static void show_margin()
1274: {
1275: if (lmargin >= 0)
1276: fprintf(stderr, "\tlmargin is set to %d\n", lmargin);
1277: else
1278: fputs("\tlmargin is computed automatically\n", stderr);
1279: if (bmargin >= 0)
1280: fprintf(stderr, "\tbmargin is set to %d\n", bmargin);
1281: else
1282: fputs("\tbmargin is computed automatically\n", stderr);
1283: if (rmargin >= 0)
1284: fprintf(stderr, "\trmargin is set to %d\n", rmargin);
1285: else
1286: fputs("\trmargin is computed automatically\n", stderr);
1287: if (tmargin >= 0)
1288: fprintf(stderr, "\ttmargin is set to %d\n", tmargin);
1289: else
1290: fputs("\ttmargin is computed automatically\n", stderr);
1291: }
1292:
1293: static void show_term()
1294: {
1295: if (term)
1296: fprintf(stderr, "\tterminal type is %s %s\n",
1297: term->name, term_options);
1298: else
1299: fputs("\tterminal type is unknown\n", stderr);
1300: }
1301:
1302: static void show_plot()
1303: {
1304: fprintf(stderr, "\tlast plot command was: %s\n", replot_line);
1305: }
1306:
1307: static void show_autoscale()
1308: {
1309: fputs("\tautoscaling is ", stderr);
1310: if (parametric) {
1311: if (is_3d_plot) {
1312: fprintf(stderr, "\tt: %s%s%s, ",
1313: (autoscale_t) ? "ON" : "OFF",
1314: (autoscale_t == 1) ? " (min)" : "",
1315: (autoscale_t == 2) ? " (max)" : "");
1316: } else {
1317: fprintf(stderr, "\tu: %s%s%s, ",
1318: (autoscale_u) ? "ON" : "OFF",
1319: (autoscale_u == 1) ? " (min)" : "",
1320: (autoscale_u == 2) ? " (max)" : "");
1321: fprintf(stderr, "v: %s%s%s, ",
1322: (autoscale_v) ? "ON" : "OFF",
1323: (autoscale_v == 1) ? " (min)" : "",
1324: (autoscale_v == 2) ? " (max)" : "");
1325: }
1326: } else
1327: putc('\t', stderr);
1328:
1329: if (polar) {
1330: fprintf(stderr, "r: %s%s%s, ", (autoscale_r) ? "ON" : "OFF",
1331: (autoscale_r == 1) ? " (min)" : "",
1332: (autoscale_r == 2) ? " (max)" : "");
1333: }
1334: fprintf(stderr, "x: %s%s%s, ", (autoscale_x) ? "ON" : "OFF",
1335: (autoscale_x == 1) ? " (min)" : "",
1336: (autoscale_x == 2) ? " (max)" : "");
1337: fprintf(stderr, "y: %s%s%s, ", (autoscale_y) ? "ON" : "OFF",
1338: (autoscale_y == 1) ? " (min)" : "",
1339: (autoscale_y == 2) ? " (max)" : "");
1.1.1.2 ! maekawa 1340: fprintf(stderr, "x2: %s%s%s, ", (autoscale_x2) ? "ON" : "OFF",
! 1341: (autoscale_x2 == 1) ? " (min)" : "",
! 1342: (autoscale_x2 == 2) ? " (max)" : "");
! 1343: fprintf(stderr, "y2: %s%s%s, ", (autoscale_y2) ? "ON" : "OFF",
! 1344: (autoscale_y2 == 1) ? " (min)" : "",
! 1345: (autoscale_y2 == 2) ? " (max)" : "");
1.1 maekawa 1346: fprintf(stderr, "z: %s%s%s\n", (autoscale_z) ? "ON" : "OFF",
1347: (autoscale_z == 1) ? " (min)" : "",
1348: (autoscale_z == 2) ? " (max)" : "");
1349: }
1350:
1351: static void show_clip()
1352: {
1353: fprintf(stderr, "\tpoint clip is %s\n", (clip_points) ? "ON" : "OFF");
1354:
1355: if (clip_lines1)
1356: fputs("\tdrawing and clipping lines between inrange and outrange points\n", stderr);
1357: else
1358: fputs("\tnot drawing lines between inrange and outrange points\n", stderr);
1359:
1360: if (clip_lines2)
1361: fputs("\tdrawing and clipping lines between two outrange points\n", stderr);
1362: else
1363: fputs("\tnot drawing lines between two outrange points\n", stderr);
1364: }
1365:
1366: static void show_mapping()
1367: {
1368: fputs("\tmapping for 3-d data is ", stderr);
1369:
1370: switch (mapping3d) {
1371: case MAP3D_CARTESIAN:
1372: fputs("cartesian\n", stderr);
1373: break;
1374: case MAP3D_SPHERICAL:
1375: fputs("spherical\n", stderr);
1376: break;
1377: case MAP3D_CYLINDRICAL:
1378: fputs("cylindrical\n", stderr);
1379: break;
1380: }
1381: }
1382:
1383: static void show_contour()
1384: {
1385: fprintf(stderr, "\tcontour for surfaces are %s",
1386: (draw_contour) ? "drawn" : "not drawn\n");
1387:
1388: if (draw_contour) {
1389: fprintf(stderr, " in %d levels on ", contour_levels);
1390: switch (draw_contour) {
1391: case CONTOUR_BASE:
1392: fputs("grid base\n", stderr);
1393: break;
1394: case CONTOUR_SRF:
1395: fputs("surface\n", stderr);
1396: break;
1397: case CONTOUR_BOTH:
1398: fputs("grid base and surface\n", stderr);
1399: break;
1400: }
1401: switch (contour_kind) {
1402: case CONTOUR_KIND_LINEAR:
1403: fputs("\t\tas linear segments\n", stderr);
1404: break;
1405: case CONTOUR_KIND_CUBIC_SPL:
1406: fprintf(stderr, "\t\tas cubic spline interpolation segments with %d pts\n", contour_pts);
1407: break;
1408: case CONTOUR_KIND_BSPLINE:
1409: fprintf(stderr, "\t\tas bspline approximation segments of order %d with %d pts\n", contour_order, contour_pts);
1410: break;
1411: }
1412: switch (levels_kind) {
1413: case LEVELS_AUTO:
1414: fprintf(stderr, "\t\tapprox. %d automatic levels\n", contour_levels);
1415: break;
1416: case LEVELS_DISCRETE:
1417: {
1418: int i;
1419: fprintf(stderr, "\t\t%d discrete levels at ", contour_levels);
1420: fprintf(stderr, "%g", levels_list[0]);
1421: for (i = 1; i < contour_levels; i++)
1422: fprintf(stderr, ",%g ", levels_list[i]);
1423: putc('\n', stderr);
1424: break;
1425: }
1426: case LEVELS_INCREMENTAL:
1427: fprintf(stderr, "\t\t%d incremental levels starting at %g, step %g, end %g\n", contour_levels, levels_list[0], levels_list[1],
1428: levels_list[0] + (contour_levels - 1) * levels_list[1]);
1429: /* contour-levels counts both ends */
1430: break;
1431: }
1432: /* fprintf(stderr,"\t\tcontour line types are %s\n", label_contours ? "varied" : "all the same"); */
1433: show_label_contours();
1434: }
1435: }
1436:
1437: static void show_format()
1438: {
1.1.1.2 ! maekawa 1439: char str[MAX_LINE_LEN+1];
1.1 maekawa 1440:
1.1.1.2 ! maekawa 1441: fprintf(stderr, "\ttic format is x-axis: \"%s\"", conv_text(str, xformat));
! 1442: fprintf(stderr, ", y-axis: \"%s\"", conv_text(str, yformat));
! 1443: fprintf(stderr, ", z-axis: \"%s\"", conv_text(str, zformat));
! 1444: fprintf(stderr, ", x2-axis: \"%s\"", conv_text(str, x2format));
! 1445: fprintf(stderr, ", y2-axis: \"%s\"\n", conv_text(str, y2format));
1.1 maekawa 1446: }
1447:
1448: #define SHOW_LOG(FLAG, BASE, TEXT) \
1449: if (FLAG) fprintf(stderr, "%s %s (base %g)", !count++ ? "\tlogscaling" : " and", TEXT,BASE)
1450:
1451: static void show_logscale()
1452: {
1453: int count = 0;
1454:
1455: SHOW_LOG(is_log_x, base_log_x, "x");
1456: SHOW_LOG(is_log_y, base_log_y, "y");
1457: SHOW_LOG(is_log_z, base_log_z, "z");
1458: SHOW_LOG(is_log_x2, base_log_x2, "x2");
1459: SHOW_LOG(is_log_y2, base_log_y2, "y2");
1460:
1461: if (count == 0)
1462: fputs("\tno logscaling\n", stderr);
1463: else if (count == 1)
1464: fputs(" only\n", stderr);
1465: else
1466: putc('\n', stderr);
1467: }
1468:
1469: static void show_variables()
1470: {
1471: register struct udvt_entry *udv = first_udv;
1472: int len;
1473:
1474: fputs("\n\tVariables:\n", stderr);
1475: while (udv) {
1476: len = instring(udv->udv_name, ' ');
1477: fprintf(stderr, "\t%-*s ", len, udv->udv_name);
1478: if (udv->udv_undef)
1479: fputs("is undefined\n", stderr);
1480: else {
1481: fputs("= ", stderr);
1482: disp_value(stderr, &(udv->udv_value));
1483: (void) putc('\n', stderr);
1484: }
1485: udv = udv->next_udv;
1486: }
1487: }
1488:
1489: /*
1490: * Used in plot.c and misc.c
1491: * By adding FILE *fp, we can now use show_version()
1492: * to save version information to a file.
1493: */
1494: void show_version(fp)
1495: FILE *fp;
1496: {
1497: /* If printed to a file, we prefix everything with
1498: * a hash mark to comment out the version information.
1499: */
1500: char prefix[6]; /* "# " */
1501: char *p = prefix;
1502:
1503: prefix[0] = '#';
1504: prefix[1] = prefix[2] = prefix[3] = prefix[4] = ' ';
1505: prefix[5] = NUL;
1506:
1507: if (fp == stderr) {
1508: /* No hash mark - let p point to the trailing '\0' */
1509: p += sizeof(prefix) - 1;
1510: } else {
1511: #ifdef GNUPLOT_BINDIR
1512: # ifdef X11
1513: fprintf(fp, "#!%s/gnuplot -persist\n#\n", GNUPLOT_BINDIR);
1514: # else
1515: fprintf(fp, "#!%s/gnuplot\n#\n", GNUPLOT_BINDIR);
1516: # endif /* not X11 */
1517: #endif /* GNUPLOT_BINDIR */
1518: }
1519: fprintf(fp, "%s\n\
1520: %s\t%s\n\
1521: %s\t%sversion %s\n\
1522: %s\tpatchlevel %s\n\
1523: %s\tlast modified %s\n\
1524: %s\n\
1525: %s\t%s\n\
1526: %s\tThomas Williams, Colin Kelley and many others\n\
1527: %s\n\
1528: %s\tType `help` to access the on-line reference manual\n\
1529: %s\tThe gnuplot FAQ is available from\n\
1.1.1.2 ! maekawa 1530: %s\t<%s>\n\
1.1 maekawa 1531: %s\n\
1532: %s\tSend comments and requests for help to <%s>\n\
1533: %s\tSend bugs, suggestions and mods to <%s>\n\
1534: %s\n",
1535: p, /* empty line */
1536: p, PROGRAM,
1537: p, OS, version,
1538: p, patchlevel,
1539: p, date,
1540: p, /* empty line */
1541: p, gnuplot_copyright,
1542: p, /* authors */
1543: p, /* empty line */
1544: p, /* Type help */
1545: p, /* FAQ is at */
1546: p, faq_location,
1547: p, /* empty line */
1548: p, help_email,
1549: p, bug_email,
1550: p); /* empty line */
1551: }
1552:
1553: void show_version_long()
1554: {
1555: char *helpfile = NULL;
1556: #ifdef HAVE_SYS_UTSNAME_H
1557: struct utsname uts;
1558:
1559: /* something is fundamentally wrong if this fails ... */
1560: if (uname(&uts) > -1) {
1561: # ifdef _AIX
1562: fprintf(stderr, "\nSystem: %s %s.%s", uts.sysname, uts.version, uts.release);
1563: # elif defined (SCO)
1564: fprintf(stderr, "\nSystem: SCO %s", uts.release);
1565: # else
1566: fprintf(stderr, "\nSystem: %s %s", uts.sysname, uts.release);
1567: # endif
1568: } else {
1569: fprintf(stderr, "\n%s\n", OS);
1570: }
1571:
1572: #else /* ! HAVE_SYS_UTSNAME_H */
1573:
1574: fprintf(stderr, "\n%s\n", OS);
1575:
1576: #endif /* HAVE_SYS_UTSNAME_H */
1577:
1578: fputs("\nCompile options:\n", stderr);
1579:
1580: {
1581: /* The following code could be a lot simpler if
1582: * it wasn't for Borland's broken compiler ...
1583: */
1584: const char *rdline, *gnu_rdline, *libgd, *libpng, *linuxvga,
1585: *nocwdrc, *x11, *unixplot, *gnugraph;
1586:
1587: rdline =
1588: #ifdef READLINE
1589: "+READLINE "
1590: #else
1591: "-READLINE "
1592: #endif
1593: ,gnu_rdline =
1.1.1.2 ! maekawa 1594: #ifdef HAVE_LIBREADLINE
! 1595: "+LIBREADLINE "
1.1 maekawa 1596: #else
1.1.1.2 ! maekawa 1597: "-LIBREADLINE "
1.1 maekawa 1598: #endif
1599: ,libgd =
1600: #ifdef HAVE_LIBGD
1601: "+LIBGD "
1602: #else
1603: "-LIBGD "
1604: #endif
1605: ,libpng =
1606: #ifdef HAVE_LIBPNG
1607: "+LIBPNG "
1608: #else
1609: "-LIBPNG "
1610: #endif
1611: ,linuxvga =
1612: #ifdef LINUXVGA
1613: "+LINUXVGA "
1614: #else
1615: ""
1616: #endif
1617: ,nocwdrc =
1618: #ifdef NOCWDRC
1619: "+NOCWDRC "
1620: #else
1621: "-NOCWDRC "
1622: #endif
1623: ,x11 =
1624:
1625: #ifdef X11
1626: "+X11 "
1627: #else
1628: ""
1629: #endif
1630: ,unixplot =
1631: #ifdef UNIXPLOT
1632: "+UNIXPLOT "
1633: #else
1634: ""
1635: #endif
1636: ,gnugraph =
1637: #ifdef GNUGRAPH
1638: "+GNUGRAPH "
1639: #else
1640: ""
1641: #endif
1642: ;
1643: fprintf(stderr, "%s%s%s%s%s%s%s%s%s\n\n", rdline, gnu_rdline,
1644: libgd, libpng, linuxvga, nocwdrc, x11, unixplot, gnugraph);
1645: }
1646:
1647: if ((helpfile = getenv("GNUHELP")) == NULL) {
1648: #if defined(ATARI) || defined(MTOS)
1649: if ((helpfile = getenv("GNUPLOTPATH")) == NULL) {
1650: helpfile = HELPFILE;
1651: }
1652: #else
1653: helpfile = HELPFILE;
1654: #endif
1655: }
1656: fprintf(stderr, "HELPFILE = \"%s\"\n\
1657: FAQ location = <%s>\n\
1658: CONTACT = <%s>\n\
1659: HELPMAIL = <%s>\n", helpfile, faq_location, bug_email, help_email);
1660: }
1661:
1662: static void show_datatype(name, axis)
1663: char *name;
1664: int axis;
1665: {
1666: fprintf(stderr, "\t%s is set to %s\n", name,
1667: datatype[axis] == TIME ? "time" : "numerical");
1668: }
1669:
1670: char *
1671: conv_text(s, t)
1672: char *s, *t;
1673: {
1674: /* convert unprintable characters as \okt, tab as \t, newline \n .. */
1675: char *r;
1676: r = s;
1677: while (*t != '\0') {
1678: switch (*t) {
1679: case '\t':
1680: *s++ = '\\';
1681: *s++ = 't';
1682: break;
1683: case '\n':
1684: *s++ = '\\';
1685: *s++ = 'n';
1686: break;
1687: #ifndef OSK
1688: case '\r':
1689: *s++ = '\\';
1690: *s++ = 'r';
1691: break;
1692: #endif
1693: case '"':
1694: case '\\':
1695: *s++ = '\\';
1696: *s++ = *t;
1697: break;
1698:
1699: default:{
1700: if ((*t & 0177) > 31 && (*t & 0177) < 127)
1701: *s++ = *t;
1702: else {
1703: *s++ = '\\';
1704: sprintf(s, "%o", *t);
1705: while (*s != '\0')
1706: s++;
1707: }
1708: }
1709: }
1710: t++;
1711: }
1712: *s = '\0';
1713: return (r);
1714: }
1715:
1716:
1717: static void show_position(pos)
1718: struct position *pos;
1719: {
1720: static char *msg[] =
1721: {"(first axes) ", "(second axes) ", "(graph units) ", "(screen units) "};
1722:
1723: assert(first_axes == 0 && second_axes == 1 && graph == 2 && screen == 3);
1724:
1725: fprintf(stderr, "(%s%g, %s%g, %s%g)",
1726: pos->scalex == first_axes ? "" : msg[pos->scalex], pos->x,
1727: pos->scaley == pos->scalex ? "" : msg[pos->scaley], pos->y,
1728: pos->scalez == pos->scaley ? "" : msg[pos->scalez], pos->z);
1729:
1730: }
1731:
1732: static void show_missing()
1733: {
1734: if (missing_val == NULL)
1735: fputs("\tNo string is interpreted as missing data\n", stderr);
1736: else
1737: fprintf(stderr, "\t\"%s\" is interpreted as missing value\n", missing_val);
1738: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>