Revision 36
logic/trunk/src/logics/conditions.c | ||
---|---|---|
1 |
#include "conditions.h" |
|
2 |
|
|
3 |
int getConditionsResult(cond_lst *cl) |
|
4 |
{ |
|
5 |
// TODO dodaj izracun stanja, vrne naj 1 ali 0 |
|
6 |
//* |
|
7 |
while(cl) |
|
8 |
{ |
|
9 |
/* |
|
10 |
printf("=== cl address \t\t%d\n",&cl->OPERATOR_TYPE); |
|
11 |
printf("cl->OPERATOR_TYPE \t%d\n",cl->OPERATOR_TYPE); |
|
12 |
printf("cl->dev \t\t%s\n",cl->dev); |
|
13 |
printf("cl->nxt_lst \t\t%d\n",cl->nxt_lst); |
|
14 |
printf("cl->sub_lst \t\t%d\n",cl->sub_lst); |
|
15 |
printf("cl->value \t\t%d\n",cl->value); |
|
16 |
/**/ |
|
17 |
if(cl->sub_lst) |
|
18 |
{ |
|
19 |
//cl2=cl->sub_lst; |
|
20 |
getConditionsResult(cl->sub_lst); |
|
21 |
} |
|
22 |
cl=cl->nxt_lst; |
|
23 |
} |
|
24 |
return 0; |
|
25 |
} |
|
26 |
|
|
27 |
/*TODO morda dodaj preverbo pravilnosti conditionov (kot podatkov v strukturi)*/ |
logic/trunk/src/logics/device_threads.c | ||
---|---|---|
1 |
#include "device_threads.h" |
|
2 |
#include "../init/devicelist.h" |
|
3 |
|
|
4 |
|
logic/trunk/src/logics/scenario_threads.c | ||
---|---|---|
1 |
#include "scenario_threads.h" |
|
2 |
#include "../init/scenariolist.h" |
|
3 |
|
logic/trunk/src/logics/conditions.h | ||
---|---|---|
4 | 4 |
#include "../logics/operators.h" |
5 | 5 |
#include "../init/devicelist.h" |
6 | 6 |
|
7 |
typedef struct condition_list_leaf |
|
8 |
{ |
|
9 |
int OPERATOR_TYPE; |
|
10 |
int val; |
|
11 |
struct condition_list_leaf *nxt; |
|
12 |
struct device_d *dev; |
|
13 |
}cond_lst_leaf; |
|
14 |
|
|
15 | 7 |
typedef struct condition_list |
16 | 8 |
{ |
17 |
int OPERATOR_TYPE; |
|
18 |
struct condition_list *sub_lst; |
|
19 |
struct condition_list_leaf *sub_leaf; |
|
9 |
int OPERATOR_TYPE; |
|
10 |
int value; |
|
11 |
struct device_d *dev; |
|
12 |
struct condition_list *nxt_lst; |
|
13 |
struct condition_list *sub_lst; |
|
20 | 14 |
}cond_lst; |
21 |
|
|
15 |
|
|
16 |
int getConditionsResult(cond_lst *cl); |
|
22 | 17 |
#endif // CONDITIONS_H_INCLUDED |
logic/trunk/src/logics/device_threads.h | ||
---|---|---|
1 |
#ifndef DEVICE_THREADS_H_INCLUDED |
|
2 |
#define DEVICE_THREADS_H_INCLUDED |
|
3 |
|
|
4 |
void *randomValThread_routine(void *dummy); |
|
5 |
|
|
6 |
#endif // DEVICE_THREADS_H_INCLUDED |
logic/trunk/src/logics/scenario_threads.h | ||
---|---|---|
1 |
#ifndef SCENARIO_THREADS_H_INCLUDED |
|
2 |
#define SCENARIO_THREADS_H_INCLUDED |
|
3 |
#include "../init/scenariolist.h" |
|
4 |
|
|
5 |
void *scenarioThread_routine(void *dummy); |
|
6 |
|
|
7 |
#endif // SCENARIO_THREADS_H_INCLUDED |
logic/trunk/src/logics/operators.h | ||
---|---|---|
1 | 1 |
#ifndef OPERATORS_H_INCLUDED |
2 | 2 |
#define OPERATORS_H_INCLUDED |
3 | 3 |
|
4 |
#define TOP_NODE -1 |
|
4 | 5 |
#define AND 0 |
5 | 6 |
#define NOT_AND 1 |
6 | 7 |
#define OR 2 |
... | ... | |
19 | 20 |
int operator_LESS (int a, int b); |
20 | 21 |
int operator_LESS_OR_EQUAL (int a, int b); |
21 | 22 |
|
22 |
#endif // OPERATORS_H_INCLUDED |
|
23 |
#endif // OPERATORS_H_INCLUDED |
Also available in: Unified diff