-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtranslator.h
523 lines (461 loc) · 9.69 KB
/
translator.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
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
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
#include <cstdio>
#include <string>
#include <libgen.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <iostream>
#include <fstream>
#ifdef HPUX
#include <ostream>
#endif
#include <list>
#include <vector>
#include <algorithm>
//shell command in shell_cmd.h
#define SHCMDC_MAJOR_VERSION 4
#define SHCMDC_MINOR_VERSION 0
#define SHCMDC_RELEASE 0
//message button in message_button.h
#define MSGBTC_MAJOR_VERSION 4
#define MSGBTC_MINOR_VERSION 0
#define MSGBTC_RELEASE 0
//choice button in button.h
#define BTC_MAJOR_VERSION 4
#define BTC_MINOR_VERSION 0
#define BTC_RELEASE 0
// byte monitor in pvFactory/byte.h
#define BYTE_MAJOR 4
#define BYTE_MINOR 0
#define BYTE_RELEASE 0
//related_display.h
#define RDC_MAJOR_VERSION 4
#define RDC_MINOR_VERSION 0
#define RDC_RELEASE 0
//xygraph.h xyplot
#define XYGC_MAJOR_VERSION 4
#define XYGC_MINOR_VERSION 0
#define XYGC_RELEASE 0
//bar.h bar
#define BARC_MAJOR_VERSION 4
#define BARC_MINOR_VERSION 0
#define BARC_RELEASE 0
//meter.h meter
#define METERC_MAJOR_VERSION 4
#define METERC_MINOR_VERSION 0
#define METERC_RELEASE 0
// text entry(adl) text control(edl)
// text update(adl) text monitor(edl)
//x_text_dsp_obj.h text monitor
#define XTDC_MAJOR_VERSION 4
#define XTDC_MINOR_VERSION 7
#define XTDC_RELEASE 0
//x_text_obj.h text
// for static text(edl)
#define AXTC_MAJOR_VERSION 4
#define AXTC_MINOR_VERSION 1
#define AXTC_RELEASE 1
//line_obj.h polyline
#define ALC_MAJOR_VERSION 4
#define ALC_MINOR_VERSION 0
#define ALC_RELEASE 0
//circle_obj.h circle
#define ACC_MAJOR_VERSION 2
#define ACC_MINOR_VERSION 1
#define ACC_RELEASE 0
//arc_obj.h arc
#define AAC_MAJOR_VERSION 2
#define AAC_MINOR_VERSION 1
#define AAC_RELEASE 0
// rectangle_obj.h
#define ARC_MAJOR_VERSION 4
#define ARC_MINOR_VERSION 0
#define ARC_RELEASE 0
// menu_button.h
#define MBTC_MAJOR_VERSION 4
#define MBTC_MINOR_VERSION 0
#define MBTC_RELEASE 0
//act_win.h header
#define AWC_MAJOR_VERSION 4
#define AWC_MINOR_VERSION 0
#define AWC_RELEASE 1
//group.h text
#define AGC_MAJOR_VERSION 4
#define AGC_MINOR_VERSION 0
#define AGC_RELEASE 0
//pip.h text
#define PIP_MAJOR_VERSION 4
#define PIP_MINOR_VERSION 1
#define PIP_RELEASE 0
struct battr {
int clr;
int style;
int fill;
int width;
};
struct dattr {
int colormode; // static, alarm, or discrete
int vis;
std::string calc;
std::string chan;
std::string chanB;
std::string chanC;
std::string chanD;
};
class parseclass
{
public:
parseclass();
virtual ~parseclass();
void stripQs(std::string &str);
std::string line;
int pos;
int eq_pos;
int open;
std::string bopen;
std::string bclose;
std::string eq;
std::string space;
std::string nil;
std::string squote;
int snum;
char s1[256], s2[256];
};
class comclass
{
public:
comclass();
virtual ~comclass();
void fill_attrs(int attr);
int x;
int y;
int wid;
int hgt;
int clr;
int style;
int fill;
int linewidth;
int colormode; // static, alarm, or discrete
int vis; // static, if not zero, if zero, calc
int visInverted;
std::string calc;
std::string chan;
std::string chanB;
std::string chanC;
std::string chanD;
};
class shellclass : public comclass, public parseclass
{
public:
shellclass(int attr);
virtual ~shellclass();
int parse(std::ifstream&, std::ostream&, std::ostream&);
int bclr;
};
class valclass : public comclass, parseclass
{
public:
valclass(int attr);
virtual ~valclass();
int parse(std::ifstream&, std::ostream&, std::ostream&);
int bclr;
};
class mbuttonclass : public comclass, parseclass
{
public:
mbuttonclass(int attr);
virtual ~mbuttonclass();
int parse(std::ifstream&, std::ostream&, std::ostream&);
int bclr;
std::string label;
std::string press_msg;
std::string release_msg;
};
class buttonclass : public comclass, parseclass
{
public:
buttonclass(int attr);
virtual ~buttonclass();
int parse(std::ifstream&, std::ostream&, std::ostream&);
int bclr;
};
class byteclass : public comclass, public parseclass
{
public:
byteclass(int attr);
virtual ~byteclass();
int parse(std::ifstream&, std::ostream&, std::ostream&);
int bclr;
int direction;
int sbit;
int ebit;
};
class shellnode
{
public:
shellnode();
virtual ~shellnode();
std::string name;
std::string label;
std::string args;
};
class relnode
{
public:
relnode();
virtual ~relnode();
std::string name;
std::string label;
std::string args;
std::string policy;
};
class tnode{
public:
tnode();
virtual ~tnode();
std::string xdata;
std::string ydata;
int color;
};
class relatedclass : public comclass, public parseclass
{
public:
relatedclass(int attr);
virtual ~relatedclass();
int parse(std::ifstream&, std::ostream&, std::ostream&);
std::string look_for_file(std::ostream&, std::string tname);
int bclr;
};
class xyclass :public comclass, public parseclass
{
public:
xyclass(int attr);
virtual ~xyclass();
int parse(std::ifstream&, std::ostream&, std::ostream&);
//int clr;
int bgColor;
int plotMode;
int border;
int count;
int updateTimerValue;
int xAxis;
int xAxisStyle;
int xAxisSource;
int xMin1;
int xMin2;
int xMax1;
int xMax2;
int xAxisTimeFormat;
int symbol;
std::string title;
std::string xlabel;
std::string ylabel;
std::string squote;
int erase;
// Axes:
// if range is "from pv", that value is not in adl file
int xrangeStyle;
int y1rangeStyle;
int y2rangeStyle;
// if min = 0 or max = 1, that value is not in adl file
double xmin;
double xmax;
double y1min;
double y1max;
double y2min;
double y2max;
};
class stripclass :public comclass, public parseclass
{
public:
stripclass(int attr);
virtual ~stripclass();
int parse(std::ifstream&, std::ostream&, std::ostream&);
//int clr;
int bgColor;
int plotMode;
int border;
int count;
int updateTimerValue;
int xAxis;
int xAxisStyle;
int xAxisSource;
int xMin1;
int xMin2;
int xMax1;
int xMax2;
int xAxisTimeFormat;
int symbol;
std::string title;
std::string xlabel;
std::string ylabel;
std::string squote;
int erase;
// Axes:
// if range is "from pv", that value is not in adl file
int xrangeStyle;
int y1rangeStyle;
int y2rangeStyle;
// if min = 0 or max = 1, that value is not in adl file
double xmin;
double xmax;
double y1min;
double y1max;
double y2min;
double y2max;
};
class barclass : public comclass, public parseclass
{
public:
barclass(int attr);
virtual ~barclass();
int parse(std::ifstream&, std::ostream&, std::ostream&);
int bgColor;
std::string label;
};
class meterclass :public comclass, public parseclass
{
public:
meterclass(int attr);
virtual ~meterclass();
int parse(std::ifstream&, std::ostream&, std::ostream&);
int meterColorMode;
int scaleColor;
int scaleColorMode;
int labelColor;
int fgColor;
int bgColor;
int tsColor;
int bsColor;
std::string controlPvExpStr;
std::string readPvExpStr;
std::string literalLabel;
std::string label;
int labelType;
int showScale;
std::string scaleFormat;
int scalePrecision;
int scaleLimitsFromDb;
int useDisplayBg;
int majorIntervals;
int minorIntervals;
int needleType;
int shadowMode;
int scaleMin;
int scaleMax;
std::string labelFontTag;
std::string scaleFontTag;
int meterAngle;
};
class menuclass :public comclass, public parseclass
{
public:
menuclass(int attr);
virtual ~menuclass();
int parse(std::ifstream&, std::ostream&, std::ostream&);
int bclr;
};
class textmonclass :public comclass, public parseclass
{
public:
textmonclass(int attr);
virtual ~textmonclass();
int parse(std::ifstream&, std::ostream&, std::ostream&, int noedit);
int bclr;
std::string format;
};
class polyclass : public comclass, public parseclass
{
public:
polyclass(int attr);
virtual ~polyclass();
int parse(std::ifstream&, std::ostream&, std::ostream&, int close);
int fillColor;
int close;
int arrows;
};
class circleclass : public comclass, public parseclass
{
public:
circleclass(int attr);
virtual ~circleclass();
int parse(std::ifstream&, std::ostream&, std::ostream&);
int width;
int fillColor;
};
class arcclass : public comclass, public parseclass
{
public:
arcclass(int attr);
virtual ~arcclass();
int parse(std::ifstream&, std::ostream&, std::ostream&);
int fillColorMode;
int startAng;
int startAng2;
int totalAng;
int totalAng2;
int fillMode;
};
class cmapclass : public comclass, public parseclass
{
public:
cmapclass();
virtual ~cmapclass();
int parse(std::ifstream&, std::ostream&, std::ostream&);
std::string& getRGB(int index) ;
private:
std::vector <std::string> rgbvec;
int numColors;
};
class rectclass : public comclass, public parseclass
{
public:
rectclass(int attr);
virtual ~rectclass();
int parse(std::ifstream&, std::ostream&, std::ostream&);
};
class textclass : public comclass, public parseclass
{
public:
textclass(int attrs);
virtual ~textclass();
int parse(std::ifstream&, std::ostream&, std::ostream&);
int bkClr;
std::string textstr;
};
class headclass :public comclass, public parseclass
{
public:
headclass();
virtual ~headclass();
int parse(std::ifstream&, std::ostream&, std::ostream&);
int fgClr;
int bkClr;
int gridShow; // gridShow 0, Active 0, Spacing 10, orthogonal 0
int gridSpacing; //5
int gridOn; //0
int snapToGrid; //0
};
class translator
{
public:
translator();
~translator();
int processFile (char *in, char *out);
int parseComposite(std::ifstream&, std::ostream&,
std::ostream&, std::ostream&);
int parseCompositeClose(std::ifstream&, std::ostream&,
std::ostream&, std::ostream&);
int read_battr(std::ifstream&, std::ostream&);
int read_dattr(std::ifstream&, std::ostream&);
std::ifstream inf;
std::ofstream toutf;
static std::string dir;
static int line_ctr;
static bool debug;
static struct battr ba;
static struct dattr da;
private:
std::string medmfile;
std::string edmfile;
};
static cmapclass cmap;