2 * $Id: gp_types.h,v 1.32 2005/10/22 05:50:13 sfeam Exp $
5 /* GNUPLOT - gp_types.h */
8 * Copyright 2000, 2004 Thomas Williams, Colin Kelley
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.
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,
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
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.
33 * This software is provided "as is" without express or implied warranty
34 * to the extent permitted by applicable law.
37 #ifndef GNUPLOT_GPTYPES_H
38 #define GNUPLOT_GPTYPES_H
42 #define MAX_ID_LEN 50 /* max length of an identifier */
43 #define MAX_LINE_LEN 1024 /* maximum number of chars allowed on line */
45 #define DEG2RAD (M_PI / 180.0)
47 /* type_udv() will return 0 rather than type if udv does not exist */
57 MODE_QUERY, MODE_PLOT, MODE_SPLOT
61 FUNC, DATA, FUNC3D, DATA3D, NODATA
64 /* we explicitly assign values to the types, such that we can
65 * perform bit tests to see if the style involves points and/or lines
66 * bit 0 (val 1) = line, bit 1 (val 2) = point, bit 2 (val 4)= error
67 * This allows rapid decisions about the sample drawn into the key,
70 /* HBB 20010610: new enum, to make mnemonic names for these flags
71 * accessible everywhere */
72 typedef enum e_PLOT_STYLE_FLAGS {
73 PLOT_STYLE_HAS_LINE = (1<<0),
74 PLOT_STYLE_HAS_POINT = (1<<1),
75 PLOT_STYLE_HAS_ERRORBAR = (1<<2),
76 PLOT_STYLE_HAS_FILL = (1<<3),
77 PLOT_STYLE_BITS = (1<<4)
80 typedef enum PLOT_STYLE {
81 LINES = 0*PLOT_STYLE_BITS + PLOT_STYLE_HAS_LINE,
82 POINTSTYLE = 1*PLOT_STYLE_BITS + PLOT_STYLE_HAS_POINT,
83 IMPULSES = 2*PLOT_STYLE_BITS + PLOT_STYLE_HAS_LINE,
84 LINESPOINTS = 3*PLOT_STYLE_BITS + (PLOT_STYLE_HAS_POINT | PLOT_STYLE_HAS_LINE),
85 DOTS = 4*PLOT_STYLE_BITS + 0,
86 XERRORBARS = 5*PLOT_STYLE_BITS + (PLOT_STYLE_HAS_POINT | PLOT_STYLE_HAS_ERRORBAR),
87 YERRORBARS = 6*PLOT_STYLE_BITS + (PLOT_STYLE_HAS_POINT | PLOT_STYLE_HAS_ERRORBAR),
88 XYERRORBARS = 7*PLOT_STYLE_BITS + (PLOT_STYLE_HAS_POINT | PLOT_STYLE_HAS_ERRORBAR),
89 BOXXYERROR = 8*PLOT_STYLE_BITS + (PLOT_STYLE_HAS_LINE | PLOT_STYLE_HAS_FILL),
90 BOXES = 9*PLOT_STYLE_BITS + (PLOT_STYLE_HAS_LINE | PLOT_STYLE_HAS_FILL),
91 BOXERROR = 10*PLOT_STYLE_BITS + (PLOT_STYLE_HAS_LINE | PLOT_STYLE_HAS_FILL),
92 STEPS = 11*PLOT_STYLE_BITS + PLOT_STYLE_HAS_LINE,
93 FSTEPS = 12*PLOT_STYLE_BITS + PLOT_STYLE_HAS_LINE,
94 HISTEPS = 13*PLOT_STYLE_BITS + PLOT_STYLE_HAS_LINE,
95 VECTOR = 14*PLOT_STYLE_BITS + PLOT_STYLE_HAS_LINE,
96 CANDLESTICKS = 15*PLOT_STYLE_BITS + (PLOT_STYLE_HAS_ERRORBAR | PLOT_STYLE_HAS_FILL),
97 FINANCEBARS = 16*PLOT_STYLE_BITS + PLOT_STYLE_HAS_LINE,
98 XERRORLINES = 17*PLOT_STYLE_BITS + (PLOT_STYLE_HAS_LINE | PLOT_STYLE_HAS_POINT | PLOT_STYLE_HAS_ERRORBAR),
99 YERRORLINES = 18*PLOT_STYLE_BITS + (PLOT_STYLE_HAS_LINE | PLOT_STYLE_HAS_POINT | PLOT_STYLE_HAS_ERRORBAR),
100 XYERRORLINES = 19*PLOT_STYLE_BITS + (PLOT_STYLE_HAS_LINE | PLOT_STYLE_HAS_POINT | PLOT_STYLE_HAS_ERRORBAR)
101 , FILLEDCURVES = 21*PLOT_STYLE_BITS + PLOT_STYLE_HAS_LINE + PLOT_STYLE_HAS_FILL
102 , PM3DSURFACE = 22*PLOT_STYLE_BITS + 0
103 #ifdef EAM_DATASTRINGS
104 , LABELPOINTS = 23*PLOT_STYLE_BITS + 0
106 #ifdef EAM_HISTOGRAMS
107 , HISTOGRAMS = 24*PLOT_STYLE_BITS + PLOT_STYLE_HAS_FILL
110 , IMAGE = 25*PLOT_STYLE_BITS + 0
111 , RGBIMAGE = 26*PLOT_STYLE_BITS + 0
115 typedef enum PLOT_SMOOTH {
125 /* FIXME HBB 20000521: 'struct value' and its part, 'cmplx', should go
126 * into one of scanner/internal/standard/util .h, but I've yet to
127 * decide which of them */
129 #if !(defined(ATARI)&&defined(__GNUC__)&&defined(_MATH_H)) && !(defined(MTOS)&&defined(__GNUC__)&&defined(_MATH_H)) /* FF's math.h has the type already */
135 typedef struct value {
136 enum DATA_TYPES type;
139 struct cmplx cmplx_val;
140 #ifdef GP_STRING_VARS
146 /* Defines the type of a coordinate */
147 /* INRANGE and OUTRANGE points have an x,y point associated with them */
148 typedef enum coord_type {
149 INRANGE, /* inside plot boundary */
150 OUTRANGE, /* outside plot boundary, but defined */
151 UNDEFINED /* not defined at all */
155 /* The field of 'struct coordinate' used for storing the color of 3D data
156 * points (if requested by NEED_PALETTE(this_plot), for instance).
158 #define CRD_COLOR ylow
159 /* The field of 'struct coordinate' used for storing the point size in plot
160 * style POINTSTYLE with variable point size
162 #define CRD_PTSIZE xlow
165 typedef struct coordinate {
166 enum coord_type type; /* see above */
168 coordval ylow, yhigh; /* ignored in 3d */
169 coordval xlow, xhigh; /* also ignored in 3d */
171 /* color as a separate field can be only useful if colors are really
172 * used everywhere, but not in 3D, where CRD_COLOR maps it to the first
173 * 2D field unused by 3D. This saves 8 B, which may be finally a lot of
174 * memory for large surfaces.
175 * Another proposal is to completely separate 2d and 3d coordinates and
176 * change the data storage.
178 coordval color; /* PM3D's color value to be used */
179 /* Note: accessed only if NEED_PALETTE(this_plot) */
181 #if defined(WIN16) || (defined(MSDOS) && defined(__TURBOC__))
182 /* FIXME HBB 20020301: addition of 'color' probably broke this */
183 char pad[2]; /* pad to 32 byte boundary */
187 #endif /* GNUPLOT_GPTYPES_H */