1 | /*
|
---|
2 | * $Id: gp_types.h,v 1.2 2001-12-30 22:09:34 ansari Exp $
|
---|
3 | */
|
---|
4 |
|
---|
5 | /* GNUPLOT - gp_types.h */
|
---|
6 |
|
---|
7 | /*[
|
---|
8 | * Copyright 2000 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 | /***
|
---|
41 | #include "syscfg.h"
|
---|
42 | ***/
|
---|
43 | #include "gpc_misc.h"
|
---|
44 |
|
---|
45 | #define MAX_ID_LEN 50 /* max length of an identifier */
|
---|
46 | #define MAX_LINE_LEN 1024 /* maximum number of chars allowed on line */
|
---|
47 |
|
---|
48 | #define DEG2RAD (M_PI / 180.0)
|
---|
49 |
|
---|
50 | /* These used to be #defines in plot.h. For easier debugging, I've
|
---|
51 | * converted most of them into enum's. */
|
---|
52 | enum DATA_TYPES {
|
---|
53 | INTGR, CMPLX
|
---|
54 | };
|
---|
55 |
|
---|
56 | enum PLOT_TYPE {
|
---|
57 | FUNC, DATA, FUNC3D, DATA3D
|
---|
58 | };
|
---|
59 |
|
---|
60 | /* we explicitly assign values to the types, such that we can
|
---|
61 | * perform bit tests to see if the style involves points and/or lines
|
---|
62 | * bit 0 (val 1) = line, bit 1 (val 2) = point, bit 2 (val 4)= error
|
---|
63 | * This allows rapid decisions about the sample drawn into the key,
|
---|
64 | * for example.
|
---|
65 | */
|
---|
66 | /* HBB 20010610: new enum, to make mnemonic names for these flags
|
---|
67 | * accessible everywhere */
|
---|
68 | typedef enum e_PLOT_STYLE_FLAGS {
|
---|
69 | PLOT_STYLE_HAS_LINE = (1<<0),
|
---|
70 | PLOT_STYLE_HAS_POINT = (1<<1),
|
---|
71 | PLOT_STYLE_HAS_ERRORBAR = (1<<2)
|
---|
72 | } PLOT_STYLE_FLAGS;
|
---|
73 |
|
---|
74 | typedef enum PLOT_STYLE {
|
---|
75 | LINES = 0*(1<<3) + PLOT_STYLE_HAS_LINE,
|
---|
76 | POINTSTYLE = 1*(1<<3) + PLOT_STYLE_HAS_POINT,
|
---|
77 | IMPULSES = 2*(1<<3) + PLOT_STYLE_HAS_LINE,
|
---|
78 | LINESPOINTS = 3*(1<<3) + (PLOT_STYLE_HAS_POINT | PLOT_STYLE_HAS_LINE),
|
---|
79 | DOTS = 4*(1<<3) + 0,
|
---|
80 | XERRORBARS = 5*(1<<3) + (PLOT_STYLE_HAS_POINT | PLOT_STYLE_HAS_ERRORBAR),
|
---|
81 | YERRORBARS = 6*(1<<3) + (PLOT_STYLE_HAS_POINT | PLOT_STYLE_HAS_ERRORBAR),
|
---|
82 | XYERRORBARS = 7*(1<<3) + (PLOT_STYLE_HAS_POINT | PLOT_STYLE_HAS_ERRORBAR),
|
---|
83 | BOXXYERROR = 8*(1<<3) + PLOT_STYLE_HAS_LINE,
|
---|
84 | BOXES = 9*(1<<3) + PLOT_STYLE_HAS_LINE,
|
---|
85 | BOXERROR = 10*(1<<3) + PLOT_STYLE_HAS_LINE,
|
---|
86 | STEPS = 11*(1<<3) + PLOT_STYLE_HAS_LINE,
|
---|
87 | FSTEPS = 12*(1<<3) + PLOT_STYLE_HAS_LINE,
|
---|
88 | HISTEPS = 13*(1<<3) + PLOT_STYLE_HAS_LINE,
|
---|
89 | VECTOR = 14*(1<<3) + PLOT_STYLE_HAS_LINE,
|
---|
90 | CANDLESTICKS = 15*(1<<3) + PLOT_STYLE_HAS_ERRORBAR,
|
---|
91 | /* FIXME HBB 20010214: shouldn't fincancebars have 4 or 5?
|
---|
92 | * They behave very much like errorbars, with the sole
|
---|
93 | * exception of the key entry ... */
|
---|
94 | FINANCEBARS = 16*(1<<3) + PLOT_STYLE_HAS_LINE,
|
---|
95 | XERRORLINES = 17*(1<<3) + (PLOT_STYLE_HAS_LINE | PLOT_STYLE_HAS_POINT | PLOT_STYLE_HAS_ERRORBAR),
|
---|
96 | YERRORLINES = 18*(1<<3) + (PLOT_STYLE_HAS_LINE | PLOT_STYLE_HAS_POINT | PLOT_STYLE_HAS_ERRORBAR),
|
---|
97 | XYERRORLINES = 19*(1<<3) + (PLOT_STYLE_HAS_LINE | PLOT_STYLE_HAS_POINT | PLOT_STYLE_HAS_ERRORBAR)
|
---|
98 | } PLOT_STYLE;
|
---|
99 |
|
---|
100 | typedef enum PLOT_SMOOTH {
|
---|
101 | SMOOTH_NONE,
|
---|
102 | SMOOTH_ACSPLINES,
|
---|
103 | SMOOTH_BEZIER,
|
---|
104 | SMOOTH_CSPLINES,
|
---|
105 | SMOOTH_SBEZIER,
|
---|
106 | SMOOTH_UNIQUE
|
---|
107 | } PLOT_SMOOTH;
|
---|
108 |
|
---|
109 | /* FIXME HBB 20000521: 'struct value' and its part, 'cmplx', should go
|
---|
110 | * into one of scanner/internal/standard/util .h, but I've yet to
|
---|
111 | * decide which of them */
|
---|
112 |
|
---|
113 | #if !(defined(ATARI)&&defined(__GNUC__)&&defined(_MATH_H)) && !(defined(MTOS)&&defined(__GNUC__)&&defined(_MATH_H)) /* FF's math.h has the type already */
|
---|
114 | struct cmplx {
|
---|
115 | double real, imag;
|
---|
116 | };
|
---|
117 | #endif
|
---|
118 |
|
---|
119 | typedef struct value {
|
---|
120 | enum DATA_TYPES type;
|
---|
121 | union {
|
---|
122 | int int_val;
|
---|
123 | struct cmplx cmplx_val;
|
---|
124 | } v;
|
---|
125 | } t_value;
|
---|
126 |
|
---|
127 | #if 0 /* HBB 20000521: move to command.h */
|
---|
128 | typedef struct lexical_unit { /* produced by scanner */
|
---|
129 | TBOOLEAN is_token; /* true if token, false if a value */
|
---|
130 | struct value l_val;
|
---|
131 | int start_index; /* index of first char in token */
|
---|
132 | int length; /* length of token in chars */
|
---|
133 | } lexical_unit;
|
---|
134 | #endif /* 0 */
|
---|
135 |
|
---|
136 | #if 0 /* HBB 20000521: move to eval.h */
|
---|
137 | typedef struct udft_entry { /* user-defined function table entry */
|
---|
138 | struct udft_entry *next_udf; /* pointer to next udf in linked list */
|
---|
139 | char *udf_name; /* name of this function entry */
|
---|
140 | struct at_type *at; /* pointer to action table to execute */
|
---|
141 | char *definition; /* definition of function as typed */
|
---|
142 | struct value dummy_values[MAX_NUM_VAR]; /* current value of dummy variables */
|
---|
143 | } udft_entry;
|
---|
144 |
|
---|
145 |
|
---|
146 | typedef struct udvt_entry { /* user-defined value table entry */
|
---|
147 | struct udvt_entry *next_udv; /* pointer to next value in linked list */
|
---|
148 | char *udv_name; /* name of this value entry */
|
---|
149 | TBOOLEAN udv_undef; /* true if not defined yet */
|
---|
150 | struct value udv_value; /* value it has */
|
---|
151 | } udvt_entry;
|
---|
152 |
|
---|
153 | typedef union argument { /* p-code argument */
|
---|
154 | int j_arg; /* offset for jump */
|
---|
155 | struct value v_arg; /* constant value */
|
---|
156 | struct udvt_entry *udv_arg; /* pointer to dummy variable */
|
---|
157 | struct udft_entry *udf_arg; /* pointer to udf to execute */
|
---|
158 | } argument;
|
---|
159 |
|
---|
160 |
|
---|
161 | /* This type definition has to come after union argument has been declared. */
|
---|
162 | #ifdef __ZTC__
|
---|
163 | typedef int (*FUNC_PTR)(...);
|
---|
164 | #else
|
---|
165 | typedef int (*FUNC_PTR) __PROTO((union argument *arg));
|
---|
166 | #endif
|
---|
167 |
|
---|
168 | typedef struct ft_entry { /* standard/internal function table entry */
|
---|
169 | const char *f_name; /* pointer to name of this function */
|
---|
170 | FUNC_PTR func; /* address of function to call */
|
---|
171 | } ft_entry;
|
---|
172 | #endif /* 0 */
|
---|
173 |
|
---|
174 |
|
---|
175 | /* Defines the type of a coordinate */
|
---|
176 | /* INRANGE and OUTRANGE points have an x,y point associated with them */
|
---|
177 | typedef enum coord_type {
|
---|
178 | INRANGE, /* inside plot boundary */
|
---|
179 | OUTRANGE, /* outside plot boundary, but defined */
|
---|
180 | UNDEFINED /* not defined at all */
|
---|
181 | } coord_type;
|
---|
182 |
|
---|
183 |
|
---|
184 | typedef struct coordinate {
|
---|
185 | enum coord_type type; /* see above */
|
---|
186 | double x, y, z;
|
---|
187 | double ylow, yhigh; /* ignored in 3d */
|
---|
188 | double xlow, xhigh; /* also ignored in 3d */
|
---|
189 | } coordinate;
|
---|
190 |
|
---|
191 | #endif /* GNUPLOT_GPTYPES_H */
|
---|