Icons are changed
[gnuplot] / src / gp_types.h
1 /*
2  * $Id: gp_types.h,v 1.32 2005/10/22 05:50:13 sfeam Exp $
3  */
4
5 /* GNUPLOT - gp_types.h */
6
7 /*[
8  * Copyright 2000, 2004   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 #ifndef GNUPLOT_GPTYPES_H
38 #define GNUPLOT_GPTYPES_H
39
40 #include "syscfg.h"
41
42 #define MAX_ID_LEN 50           /* max length of an identifier */
43 #define MAX_LINE_LEN 1024       /* maximum number of chars allowed on line */
44
45 #define DEG2RAD (M_PI / 180.0)
46
47 /* type_udv() will return 0 rather than type if udv does not exist */
48 enum DATA_TYPES {
49         INTGR=1,
50         CMPLX
51 #ifdef GP_STRING_VARS
52         , STRING
53 #endif
54 };
55
56 enum MODE_PLOT_TYPE {
57         MODE_QUERY, MODE_PLOT, MODE_SPLOT
58 };
59
60 enum PLOT_TYPE {
61         FUNC, DATA, FUNC3D, DATA3D, NODATA
62 };
63
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,
68  * for example.
69  */
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)
78 } PLOT_STYLE_FLAGS;
79
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
105 #endif
106 #ifdef EAM_HISTOGRAMS
107     , HISTOGRAMS   = 24*PLOT_STYLE_BITS + PLOT_STYLE_HAS_FILL
108 #endif
109 #ifdef WITH_IMAGE
110     , IMAGE        = 25*PLOT_STYLE_BITS + 0
111     , RGBIMAGE     = 26*PLOT_STYLE_BITS + 0
112 #endif
113 } PLOT_STYLE;
114
115 typedef enum PLOT_SMOOTH {
116     SMOOTH_NONE,
117     SMOOTH_ACSPLINES,
118     SMOOTH_BEZIER,
119     SMOOTH_CSPLINES,
120     SMOOTH_SBEZIER,
121     SMOOTH_UNIQUE,
122     SMOOTH_FREQUENCY
123 } PLOT_SMOOTH;
124
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 */
128
129 #if !(defined(ATARI)&&defined(__GNUC__)&&defined(_MATH_H)) &&  !(defined(MTOS)&&defined(__GNUC__)&&defined(_MATH_H)) /* FF's math.h has the type already */
130 struct cmplx {
131         double real, imag;
132 };
133 #endif
134
135 typedef struct value {
136     enum DATA_TYPES type;
137     union {
138         int int_val;
139         struct cmplx cmplx_val;
140 #ifdef GP_STRING_VARS
141         char *string_val;
142 #endif
143     } v;
144 } t_value;
145
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 */
152 } coord_type;
153
154
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).
157  */
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
161  */
162 #define CRD_PTSIZE xlow
163
164
165 typedef struct coordinate {
166     enum coord_type type;       /* see above */
167     coordval x, y, z;
168     coordval ylow, yhigh;       /* ignored in 3d */
169     coordval xlow, xhigh;       /* also ignored in 3d */
170 #if 0
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.
177      */
178     coordval color;             /* PM3D's color value to be used */
179                                 /* Note: accessed only if NEED_PALETTE(this_plot) */
180 #endif
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 */
184 #endif
185 } coordinate;
186
187 #endif /* GNUPLOT_GPTYPES_H */