-
Notifications
You must be signed in to change notification settings - Fork 6
/
StripCurve.h
151 lines (128 loc) · 4.65 KB
/
StripCurve.h
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
/*************************************************************************\
* Copyright (c) 1994-2004 The University of Chicago, as Operator of Argonne
* National Laboratory.
* Copyright (c) 1997-2003 Southeastern Universities Research Association,
* as Operator of Thomas Jefferson National Accelerator Facility.
* Copyright (c) 1997-2002 Deutches Elektronen-Synchrotron in der Helmholtz-
* Gemelnschaft (DESY).
* This file is distributed subject to a Software License Agreement found
* in the file LICENSE that is included with this distribution.
\*************************************************************************/
#ifndef _StripCurve
#define _StripCurve
#include "StripDefines.h"
#include "StripConfig.h"
#include <stdlib.h>
#include <stdarg.h>
#ifdef WIN32
#if defined(_WIN32) && !defined(_MINGW) && (_MSC_VER < 1800 )
/* In MSVC timeval is in winsock.h, winsock2.h, ws2spi.h, nowhere else */
#include <X11/Xwinsock.h>
#else
#include <X11/Xos.h>
#endif
#else
#include <sys/time.h>
#include <time.h>
#endif
#ifndef NO_X11_HERE /* Albert */
#include <X11/Xlib.h>
#include <X11/Intrinsic.h>
#endif /* Albert */
#define STRIPCURVE_PENDOWN 1
#define STRIPCURVE_PLOTTED 1
/* ======= Data Types ======= */
typedef void * StripCurve;
typedef double (*StripCurveSampleFunc) (void *);
/* ======= Attributes ======= */
typedef enum
{
STRIPCURVE_NAME = 1, /* (char *) rw */
STRIPCURVE_EGU, /* (char *) rw */
STRIPCURVE_COMMENT, /* (char *) rw */
STRIPCURVE_PRECISION, /* (int) rw */
STRIPCURVE_MIN, /* (double) rw */
STRIPCURVE_MAX, /* (double) rw */
STRIPCURVE_SCALE, /* (StripScaleType) rw */
STRIPCURVE_PLOTSTAT, /* (int) curve data plotted? rw */
STRIPCURVE_WAITSTAT, /* (int) waiting for connection? rw */
STRIPCURVE_CONNECTSTAT, /* (int) curve connected? rw */
STRIPCURVE_COLOR, /* (cColor *) r */
STRIPCURVE_FUNCDATA, /* (void *) rw */
STRIPCURVE_SAMPLEFUNC, /* (StripCurveSampleFunc) rw */
STRIPCURVE_LAST_ATTRIBUTE
}
StripCurveAttribute;
enum _scidx
{
SCIDX_WAITING = 0,
SCIDX_CHECK_CONNECT,
SCIDX_CONNECTED,
SCIDX_EGU_SET,
SCIDX_COMMENT_SET,
SCIDX_PRECISION_SET,
SCIDX_MIN_SET,
SCIDX_MAX_SET,
SCIDX_SCALE_SET,
SCIDX_COUNT
};
typedef enum
{
STRIPCURVE_WAITING = (1 << SCIDX_WAITING),
STRIPCURVE_CHECK_CONNECT = (1 << SCIDX_CHECK_CONNECT),
STRIPCURVE_CONNECTED = (1 << SCIDX_CONNECTED),
STRIPCURVE_EGU_SET = (1 << SCIDX_EGU_SET),
STRIPCURVE_COMMENT_SET = (1 << SCIDX_COMMENT_SET),
STRIPCURVE_PRECISION_SET = (1 << SCIDX_PRECISION_SET),
STRIPCURVE_MIN_SET = (1 << SCIDX_MIN_SET),
STRIPCURVE_MAX_SET = (1 << SCIDX_MAX_SET),
STRIPCURVE_SCALE_SET = (1 << SCIDX_SCALE_SET)
}
StripCurveStatus;
/* ======= Functions ======= */
/* StripCurve_set/getattr
*
* Sets or gets the specified attributes, returning true on success,
* false otherwise.
*/
int StripCurve_setattr (StripCurve, ...);
int StripCurve_getattr (StripCurve, ...);
/*
* StripCurve_update
*
* Causes outstanding modifications to be propagated via the StripConfig
* component.
*/
void StripCurve_update (StripCurve);
/*
* StripCurve_set/getattr_val
*
* Gets the specified attribute, returning a void pointer to it (must
* be casted before being accessed).
*/
void *StripCurve_getattr_val (StripCurve, StripCurveAttribute);
/*
* StripCurve_set/get/clearstat
*
* Set: sets the specified status bit high.
* Get: returns true iff the specified status bit is high.
* Clear: sets the specified status bit low.
*/
void StripCurve_setstat (StripCurve, unsigned);
StripCurveStatus StripCurve_getstat (StripCurve, unsigned);
void StripCurve_clearstat (StripCurve, unsigned);
/* ======= Private Data (not for client program use) ======= */
#ifndef NO_X11_HERE /* Albert */
typedef struct
{
StripConfig *scfg;
StripCurveDetail *details;
void *id;
struct timeval connect_request;
void *func_data;
StripCurveSampleFunc get_value; /* must pass func_data when calling */
unsigned status;
}
StripCurveInfo;
#endif /* Albert */
#endif