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