Blame src/gp_types.h

Packit 0986c0
/*
Packit 0986c0
 * $Id: gp_types.h,v 1.73 2016/11/05 21:21:07 sfeam Exp $
Packit 0986c0
 */
Packit 0986c0
Packit 0986c0
/* GNUPLOT - gp_types.h */
Packit 0986c0
Packit 0986c0
/*[
Packit 0986c0
 * Copyright 2000, 2004   Thomas Williams, Colin Kelley
Packit 0986c0
 *
Packit 0986c0
 * Permission to use, copy, and distribute this software and its
Packit 0986c0
 * documentation for any purpose with or without fee is hereby granted,
Packit 0986c0
 * provided that the above copyright notice appear in all copies and
Packit 0986c0
 * that both that copyright notice and this permission notice appear
Packit 0986c0
 * in supporting documentation.
Packit 0986c0
 *
Packit 0986c0
 * Permission to modify the software is granted, but not the right to
Packit 0986c0
 * distribute the complete modified source code.  Modifications are to
Packit 0986c0
 * be distributed as patches to the released version.  Permission to
Packit 0986c0
 * distribute binaries produced by compiling modified sources is granted,
Packit 0986c0
 * provided you
Packit 0986c0
 *   1. distribute the corresponding source modifications from the
Packit 0986c0
 *    released version in the form of a patch file along with the binaries,
Packit 0986c0
 *   2. add special version identification to distinguish your version
Packit 0986c0
 *    in addition to the base release version number,
Packit 0986c0
 *   3. provide your name and address as the primary contact for the
Packit 0986c0
 *    support of your modified version, and
Packit 0986c0
 *   4. retain our contact information in regard to use of the base
Packit 0986c0
 *    software.
Packit 0986c0
 * Permission to distribute the released version of the source code along
Packit 0986c0
 * with corresponding source modifications in the form of a patch file is
Packit 0986c0
 * granted with same provisions 2 through 4 for binary distributions.
Packit 0986c0
 *
Packit 0986c0
 * This software is provided "as is" without express or implied warranty
Packit 0986c0
 * to the extent permitted by applicable law.
Packit 0986c0
]*/
Packit 0986c0
Packit 0986c0
#ifndef GNUPLOT_GPTYPES_H
Packit 0986c0
#define GNUPLOT_GPTYPES_H
Packit 0986c0
Packit 0986c0
#include "syscfg.h"
Packit 0986c0
Packit 0986c0
#define MAX_ID_LEN 50		/* max length of an identifier */
Packit 0986c0
#define MAX_LINE_LEN 1024	/* maximum number of chars allowed on line */
Packit 0986c0
Packit 0986c0
#define DEG2RAD (M_PI / 180.0)
Packit 0986c0
Packit 0986c0
/* type_udv() will return 0 rather than type if udv does not exist */
Packit 0986c0
enum DATA_TYPES {
Packit 0986c0
	INTGR=1,
Packit 0986c0
	CMPLX,
Packit 0986c0
	STRING,
Packit 0986c0
	DATABLOCK,
Packit 0986c0
	ARRAY,
Packit 0986c0
	NOTDEFINED,	/* exists, but value is currently undefined */
Packit 0986c0
	INVALID_VALUE,	/* used only for error return by external functions */
Packit 0986c0
	INVALID_NAME	/* used only to trap errors in linked axis function definition */
Packit 0986c0
};
Packit 0986c0
Packit 0986c0
enum MODE_PLOT_TYPE {
Packit 0986c0
	MODE_QUERY, MODE_PLOT, MODE_SPLOT
Packit 0986c0
};
Packit 0986c0
Packit 0986c0
enum PLOT_TYPE {
Packit 0986c0
	FUNC, DATA, FUNC3D, DATA3D, NODATA
Packit 0986c0
};
Packit 0986c0
Packit 0986c0
/* we explicitly assign values to the types, such that we can
Packit 0986c0
 * perform bit tests to see if the style involves points and/or lines
Packit 0986c0
 * bit 0 (val 1) = line, bit 1 (val 2) = point, bit 2 (val 4)= error
Packit 0986c0
 * This allows rapid decisions about the sample drawn into the key,
Packit 0986c0
 * for example.
Packit 0986c0
 */
Packit 0986c0
/* HBB 20010610: new enum, to make mnemonic names for these flags
Packit 0986c0
 * accessible everywhere */
Packit 0986c0
typedef enum e_PLOT_STYLE_FLAGS {
Packit 0986c0
    PLOT_STYLE_HAS_LINE      = (1<<0),
Packit 0986c0
    PLOT_STYLE_HAS_POINT     = (1<<1),
Packit 0986c0
    PLOT_STYLE_HAS_ERRORBAR  = (1<<2),
Packit 0986c0
    PLOT_STYLE_HAS_FILL      = (1<<3),
Packit 0986c0
    PLOT_STYLE_BITS          = (1<<4)
Packit 0986c0
} PLOT_STYLE_FLAGS;
Packit 0986c0
Packit 0986c0
typedef enum PLOT_STYLE {
Packit 0986c0
    LINES        =  0*PLOT_STYLE_BITS + PLOT_STYLE_HAS_LINE,
Packit 0986c0
    POINTSTYLE   =  1*PLOT_STYLE_BITS + PLOT_STYLE_HAS_POINT,
Packit 0986c0
    IMPULSES     =  2*PLOT_STYLE_BITS + PLOT_STYLE_HAS_LINE,
Packit 0986c0
    LINESPOINTS  =  3*PLOT_STYLE_BITS + (PLOT_STYLE_HAS_POINT | PLOT_STYLE_HAS_LINE),
Packit 0986c0
    DOTS         =  4*PLOT_STYLE_BITS + 0,
Packit 0986c0
    XERRORBARS   =  5*PLOT_STYLE_BITS + (PLOT_STYLE_HAS_POINT | PLOT_STYLE_HAS_ERRORBAR),
Packit 0986c0
    YERRORBARS   =  6*PLOT_STYLE_BITS + (PLOT_STYLE_HAS_POINT | PLOT_STYLE_HAS_ERRORBAR),
Packit 0986c0
    XYERRORBARS  =  7*PLOT_STYLE_BITS + (PLOT_STYLE_HAS_POINT | PLOT_STYLE_HAS_ERRORBAR),
Packit 0986c0
    BOXXYERROR   =  8*PLOT_STYLE_BITS + (PLOT_STYLE_HAS_LINE | PLOT_STYLE_HAS_FILL),
Packit 0986c0
    BOXES        =  9*PLOT_STYLE_BITS + (PLOT_STYLE_HAS_LINE | PLOT_STYLE_HAS_FILL),
Packit 0986c0
    BOXERROR     = 10*PLOT_STYLE_BITS + (PLOT_STYLE_HAS_LINE | PLOT_STYLE_HAS_FILL),
Packit 0986c0
    STEPS        = 11*PLOT_STYLE_BITS + PLOT_STYLE_HAS_LINE,
Packit 0986c0
    FILLSTEPS    = 11*PLOT_STYLE_BITS + PLOT_STYLE_HAS_FILL,
Packit 0986c0
    FSTEPS       = 12*PLOT_STYLE_BITS + PLOT_STYLE_HAS_LINE,
Packit 0986c0
    HISTEPS      = 13*PLOT_STYLE_BITS + PLOT_STYLE_HAS_LINE,
Packit 0986c0
    VECTOR       = 14*PLOT_STYLE_BITS + PLOT_STYLE_HAS_LINE,
Packit 0986c0
    CANDLESTICKS = 15*PLOT_STYLE_BITS + (PLOT_STYLE_HAS_ERRORBAR | PLOT_STYLE_HAS_FILL),
Packit 0986c0
    FINANCEBARS  = 16*PLOT_STYLE_BITS + PLOT_STYLE_HAS_LINE,
Packit 0986c0
    XERRORLINES  = 17*PLOT_STYLE_BITS + (PLOT_STYLE_HAS_LINE | PLOT_STYLE_HAS_POINT | PLOT_STYLE_HAS_ERRORBAR),
Packit 0986c0
    YERRORLINES  = 18*PLOT_STYLE_BITS + (PLOT_STYLE_HAS_LINE | PLOT_STYLE_HAS_POINT | PLOT_STYLE_HAS_ERRORBAR),
Packit 0986c0
    XYERRORLINES = 19*PLOT_STYLE_BITS + (PLOT_STYLE_HAS_LINE | PLOT_STYLE_HAS_POINT | PLOT_STYLE_HAS_ERRORBAR),
Packit 0986c0
    FILLEDCURVES = 21*PLOT_STYLE_BITS + PLOT_STYLE_HAS_LINE + PLOT_STYLE_HAS_FILL,
Packit 0986c0
    PM3DSURFACE  = 22*PLOT_STYLE_BITS + 0,
Packit 0986c0
    LABELPOINTS  = 23*PLOT_STYLE_BITS + 0,
Packit 0986c0
    HISTOGRAMS   = 24*PLOT_STYLE_BITS + PLOT_STYLE_HAS_FILL,
Packit 0986c0
    IMAGE        = 25*PLOT_STYLE_BITS + 0,
Packit 0986c0
    RGBIMAGE     = 26*PLOT_STYLE_BITS + 0,
Packit 0986c0
    RGBA_IMAGE   = 27*PLOT_STYLE_BITS + 0,
Packit 0986c0
    CIRCLES      = 28*PLOT_STYLE_BITS + PLOT_STYLE_HAS_LINE + PLOT_STYLE_HAS_FILL,
Packit 0986c0
    BOXPLOT      = 29*PLOT_STYLE_BITS + PLOT_STYLE_HAS_FILL + PLOT_STYLE_HAS_POINT,
Packit 0986c0
    ELLIPSES     = 30*PLOT_STYLE_BITS + PLOT_STYLE_HAS_LINE + PLOT_STYLE_HAS_FILL,
Packit 0986c0
    SURFACEGRID  = 31*PLOT_STYLE_BITS + PLOT_STYLE_HAS_LINE,
Packit 0986c0
    PARALLELPLOT = 32*PLOT_STYLE_BITS + PLOT_STYLE_HAS_LINE,
Packit 0986c0
    TABLESTYLE   = 33*PLOT_STYLE_BITS,
Packit 0986c0
    ZERRORFILL   = 34*PLOT_STYLE_BITS + PLOT_STYLE_HAS_FILL,
Packit 0986c0
    PLOT_STYLE_NONE = -1
Packit 0986c0
} PLOT_STYLE;
Packit 0986c0
Packit 0986c0
typedef enum PLOT_SMOOTH {
Packit 0986c0
    SMOOTH_NONE = 0,
Packit 0986c0
    SMOOTH_ACSPLINES,
Packit 0986c0
    SMOOTH_BEZIER,
Packit 0986c0
    SMOOTH_CSPLINES,
Packit 0986c0
    SMOOTH_SBEZIER,
Packit 0986c0
    SMOOTH_UNIQUE,
Packit 0986c0
    SMOOTH_UNWRAP,
Packit 0986c0
    SMOOTH_FREQUENCY,
Packit 0986c0
    SMOOTH_CUMULATIVE,
Packit 0986c0
    SMOOTH_KDENSITY,
Packit 0986c0
    SMOOTH_CUMULATIVE_NORMALISED,
Packit 0986c0
    SMOOTH_MONOTONE_CSPLINE,
Packit 0986c0
    SMOOTH_BINS,
Packit 0986c0
    SMOOTH_FREQUENCY_NORMALISED
Packit 0986c0
} PLOT_SMOOTH;
Packit 0986c0
Packit 0986c0
/* FIXME HBB 20000521: 'struct value' and its part, 'cmplx', should go
Packit 0986c0
 * into one of scanner/internal/standard/util .h, but I've yet to
Packit 0986c0
 * decide which of them */
Packit 0986c0
Packit 0986c0
struct cmplx {
Packit 0986c0
	double real, imag;
Packit 0986c0
};
Packit 0986c0
Packit 0986c0
typedef struct value {
Packit 0986c0
    enum DATA_TYPES type;
Packit 0986c0
    union {
Packit 0986c0
	int int_val;
Packit 0986c0
	struct cmplx cmplx_val;
Packit 0986c0
	char *string_val;
Packit 0986c0
	char **data_array;
Packit 0986c0
	struct value *value_array;
Packit 0986c0
    } v;
Packit 0986c0
} t_value;
Packit 0986c0
Packit 0986c0
/* Defines the type of a coordinate */
Packit 0986c0
/* INRANGE and OUTRANGE points have an x,y point associated with them */
Packit 0986c0
typedef enum coord_type {
Packit 0986c0
    INRANGE,			/* inside plot boundary */
Packit 0986c0
    OUTRANGE,			/* outside plot boundary, but defined */
Packit 0986c0
    UNDEFINED,			/* not defined at all */
Packit 0986c0
    EXCLUDEDRANGE		/* would be inside plot, but excluded for other reasons */
Packit 0986c0
				/* e.g. in polar mode and outside of trange[tmin:tmax] */
Packit 0986c0
} coord_type;
Packit 0986c0
Packit 0986c0
Packit 0986c0
/* These fields of 'struct coordinate' hold extra properties of 3D data points */
Packit 0986c0
/* Used by splot styles RGBIMAGE and RGBA_IMAGE */
Packit 0986c0
#define CRD_R yhigh
Packit 0986c0
#define CRD_G xlow
Packit 0986c0
#define CRD_B xhigh
Packit 0986c0
#define CRD_A ylow
Packit 0986c0
/* Used by all splot style with variable line/point color */
Packit 0986c0
#define CRD_COLOR yhigh
Packit 0986c0
/* Used by splot styles POINTSTYLE and LINESPOINTS with variable point size */
Packit 0986c0
#define CRD_PTSIZE xlow
Packit 0986c0
/* Used by splot styles POINTSTYLE and LINESPOINTS with variable point type */
Packit 0986c0
#define CRD_PTTYPE xhigh
Packit 0986c0
/* Used by splot style ZERRORFILL */
Packit 0986c0
#define CRD_ZLOW xlow
Packit 0986c0
#define CRD_ZHIGH xhigh
Packit 0986c0
Packit 0986c0
Packit 0986c0
typedef struct coordinate {
Packit 0986c0
    enum coord_type type;	/* see above */
Packit 0986c0
    coordval x, y, z;
Packit 0986c0
    coordval ylow, yhigh;	/* ignored in 3d */
Packit 0986c0
    coordval xlow, xhigh;	/* also ignored in 3d */
Packit 0986c0
} coordinate;
Packit 0986c0
Packit 0986c0
typedef enum lp_class {
Packit 0986c0
	LP_TYPE   = 0,	/* lp_style_type defined by 'set linetype' */
Packit 0986c0
	LP_STYLE  = 1,	/* lp_style_type defined by 'set style line' */
Packit 0986c0
	LP_ADHOC  = 2,	/* lp_style_type used for single purpose */
Packit 0986c0
	LP_NOFILL = 3	/* special treatment of fillcolor */
Packit 0986c0
} lp_class;
Packit 0986c0
Packit 0986c0
/* Classes of time data */
Packit 0986c0
typedef enum {
Packit 0986c0
    DT_NORMAL=0,		/* default; treat values as pure numeric */
Packit 0986c0
    DT_TIMEDATE,		/* old datatype */
Packit 0986c0
    DT_DMS,			/* degrees minutes seconds */
Packit 0986c0
    DT_UNINITIALIZED,
Packit 0986c0
    DT_BAD			/* something went wrong (e.g. in gstrptime) */
Packit 0986c0
} td_type;
Packit 0986c0
Packit 0986c0
/*
Packit 0986c0
 * Introduction of nonlinear axes makes it possible for an axis-mapping function
Packit 0986c0
 * to return "undefined" or NaN. These cannot be encoded as an integer coordinate.
Packit 0986c0
 * So we introduce an integer equivalent to NaN and provide a macro to test for
Packit 0986c0
 * whether a coordinate mapping returned it.
Packit 0986c0
 */
Packit 0986c0
#define intNaN (~((unsigned int)(~0)>>1))
Packit 0986c0
Packit 0986c0
#endif /* GNUPLOT_GPTYPES_H */