File: xgraph.h

package info (click to toggle)
xgraph 12.1-13
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 1,472 kB
  • ctags: 1,937
  • sloc: ansic: 7,924; sh: 3,464; makefile: 55
file content (218 lines) | stat: -rwxr-xr-x 5,696 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
/*
 * Globally accessible information from xgraph
 */

#ifndef _XGRAPH_H_
#define _XGRAPH_H_

#include "autoconf.h"

#include <X11/Xos.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/cursorfont.h>
#include <X11/Xresource.h>

/*
 * Get definitions from headers.
 */
#include <stdio.h>   /* sprintf */

#ifdef HAVE_STRING_H
#include <string.h>  /* str* */
#else
#ifdef HAVE_STRINGS_H
#include <strings.h>  /* str* */
#else
extern char *strcpy();
extern char *strcat();
extern char *rindex();
extern char *index();
#endif /* HAVE_STRINGS_H */
#endif /* HAVE_STRING_H */

#ifdef HAVE_UNISTD_H
#include <unistd.h>  /* exit, abort */
#endif /* HAVE_UNISTD_H */
#ifdef HAVE_STDLIB_H
#include <stdlib.h>  /* atof */
#endif /* HAVE_STDLIB_H */

#include "xgout.h"

#define VERSION_STRING	"12.1 December 1999 "

#define MAXKEYS		50
#define MAXATTR 	8
#define MAXSETS		112
#define MAXBUFSIZE 	120
#define MAXLS		50

#define STRDUP(xx)	(strcpy(Malloc((unsigned) (strlen(xx)+1)), (xx)))
#define SCREENX(ws, userX) \
    (((int) (((userX) - ws->UsrOrgX)/ws->XUnitsPerPixel + 0.5)) + ws->XOrgX)
#define SCREENY(ws, userY) \
    (ws->XOppY - ((int) (((userY) - ws->UsrOrgY)/ws->YUnitsPerPixel + 0.5)))
#define HARDCOPY_IN_PROGRESS	0x01

/* Portability */
/* try to get those constants */
#include <math.h>
#ifdef HAVE_LIMITS_H
#include <limits.h>
#endif /* HAVE_LIMITS */
#ifdef HAVE_FLOAT_H
#include <float.h>
#endif /* HAVE_FLOAT_H */

#ifdef  CRAY
#undef  MAXFLOAT
#define MAXFLOAT 10.e300
#endif				/* CRAY */

#ifndef MAXFLOAT
#if defined(FLT_MAX)
#define MAXFLOAT	FLT_MAX
#elif defined(HUGE)
#define MAXFLOAT	HUGE
#endif
#endif

#ifndef BIGINT
#if defined(INT_MAX)
#define BIGINT		INT_MAX
#elif defined(MAXINT)
#define BIGINT MAXINT
#else
#define BIGINT 0xffffffff
#endif
#endif

#define GRIDPOWER 	10
#define INITSIZE 	128

#define CONTROL_D	'\004'
#define CONTROL_C	'\003'
#define TILDE		'~'

#define BTNPAD		1
#define BTNINTER	3

#ifndef MAX
#define MAX(a,b)	((a) > (b) ? (a) : (b))
#endif
#ifndef MIN
#define MIN(a,b)	((a) < (b) ? (a) : (b))
#endif
#ifndef ABS
#define ABS(x)		((x) < 0 ? -(x) : (x))
#endif
#define ZERO_THRES	1.0E-07

/* To get around an inaccurate log */
#define nlog10(x)	(x == 0.0 ? 0.0 : log10(x) + 1e-15)

#define ISCOLOR		(wi->dev_info.dev_flags & D_COLOR)

#define PIXVALUE(set) 	((set) % MAXATTR)

#define LINESTYLE(set) \
(ISCOLOR ?  ((set)/MAXATTR) : ((set) % MAXATTR))

#define MARKSTYLE(set) \
(colorMark ? COLMARK(set) : BWMARK(set))

#define COLMARK(set) \
((set) / MAXATTR)

#define BWMARK(set) \
((set) % MAXATTR)

#define LOG_X	0x01
#define LOG_Y	0x02
#define STK	0x04
#define FITX	0x08
#define FITY	0x10
typedef unsigned long Pixel;

/* Globally accessible values */
extern Display *disp;		/* Open display            */
extern Visual *vis;		/* Standard visual         */
extern Colormap cmap;		/* Standard colormap       */
extern int screen;		/* Screen number           */
extern int depth;		/* Depth of screen         */

extern void do_hardcopy();	/* Carries out hardcopy    */
extern void ho_dialog();	/* Hardcopy dialog         */
extern void set_X();		/* Initializes X device    */

typedef struct point_list {
    int     numPoints;		/* Number of points in group */
    int     allocSize;		/* Allocated size            */
    double *xvec;		/* X values                  */
    double *yvec;		/* Y values                  */
    struct point_list *next;	/* Next set of points        */
}       PointList;

typedef struct new_data_set {
    char   *setName;		/* Name of data set     */
    PointList *list;		/* List of point arrays */
}       NewDataSet;

typedef struct local_win {
    double  loX,
            loY,
            hiX,
            hiY;		/* Local bounding box of window         */
    int     XOrgX,
            XOrgY;		/* Origin of bounding box on screen     */
    int     XOppX,
            XOppY;		/* Other point defining bounding box    */
    double  UsrOrgX,
            UsrOrgY;		/* Origin of bounding box in user space */
    double  UsrOppX,
            UsrOppY;		/* Other point of bounding box          */
    double  XUnitsPerPixel;	/* X Axis scale factor                  */
    double  YUnitsPerPixel;	/* Y Axis scale factor                  */
    struct xg_out   dev_info;	/* Device information                   */
    Window  close,
            hardcopy;		/* Buttons for closing and hardcopy     */
    Window  about;		/* Version information                  */
    Window  rewind;             /* PW Added this, for animation.        */
    Window  replot;             /* PW Added this, for animation.        */
    Window  deriv;             /* PW Added this, for animation.        */
    int     flags;		/* Window flags                         */
    int     DOrder;             /* Which order of Derivative is being set? */
}       LocalWin;

extern NewDataSet PlotData[MAXSETS], DataD1[MAXSETS], DataD2[MAXSETS];
extern  XSegment *Xsegs[2];		/* Point space for X */
extern double llx, lly, urx, ury;	/* Bounding box of all data */
extern int numFiles;			/* Number of input files   */
extern char *inFileNames[MAXSETS];	/* File names              */

/* Total number of active windows */
extern int Num_Windows;
extern char *Prog_Name;
extern char *disp_name;

/* To make lint happy */
extern char *Malloc();
extern char *Realloc();
extern char *Calloc();
extern void Free();

#ifndef _POSIX_SOURCE
/* extern int sprintf(); ---conflicts with sunos */
extern void exit();
extern double atof();
extern void abort();
#endif /* _POSIX_SOURCE */

/* Extra include files to quash warnings, by Barak A. Pearlmutter */
#include "init.h"
#include "read.h"
#include "draw.h"
#include "dialog.h"

#endif				/* _XGRAPH_H_ */