summaryrefslogtreecommitdiff
path: root/other/burneye/src/conf/tmp/condition.h
blob: fffc486d70a375866825242cd867a9a14caa2d22 (plain)
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
/* fornax - distributed network
 *
 * by team teso
 *
 * scripting condition includes
 */

#ifndef	FNX_CONDITION_H
#define	FNX_CONDITION_H


#define	LO_OR		1
#define	LO_AND		2

#define	EQ_EQUAL	1
#define	EQ_GREATEQ	2
#define	EQ_LOWEREQ	3
#define	EQ_NOTEQ	4


typedef struct condition {
	struct condition *	cond1;
	int			logoper;
	struct condition *	cond2;

	char *			val1;
	int			eqop;
	char *			val2;
} condition;


/* cond_verify
 *
 * verify whether a condition is met or not
 *
 * return 1 if the condition is met
 * return 0 if not or an error was experienced during parsing
 */

int	cond_verify (condition *cnd);


/* cond_create
 *
 * condition constructor. create a new condition structure
 *
 * return a pointer to the new structure
 */

condition *	cond_create (void);


/* cond_free
 *
 * free the whole condition pointed to by `c'
 *
 * return in any case
 */

void	cond_free (condition *c);


/* cond_set_cond1
 *
 * set subcondition condition `c1' for condition `c'
 *
 * return pointer to structure
 */

condition *	cond_set_cond1 (condition *c, condition *c1);


/* cond_set_cond2
 *
 * set subcondition condition `c2' for condition `c'
 *
 * return pointer to structure
 */

condition *	cond_set_cond2 (condition *c, condition *c2);


/* cond_set_logoper
 *
 * set logical operator `lo' for the two subconditions in condition `c'.
 *
 * return pointer to structure
 */

condition *	cond_set_logoper (condition *c, int lo);


/* cond_set_eqop
 *
 * set equeality operator `eo' for the comparison in condition `c'.
 *
 * return pointer to structure
 */

condition *	cond_set_eqop (condition *c, int eo);


/* cond_set_val1
 *
 * set first value `val' in condition `c'
 *
 * return pointer to structure
 */

condition *	cond_set_val1 (condition *c, char *val);


/* cond_set_val2
 *
 * set second value `val' in condition `c'
 *
 * return pointer to structure
 */

condition *	cond_set_val2 (condition *c, char *val);


#endif