author | etisserant |
Fri, 23 May 2008 18:48:03 +0200 | |
changeset 150 | 204d515df3dd |
parent 137 | 187a4e2412e5 |
child 178 | 2390b409eb93 |
permissions | -rw-r--r-- |
49
45dc6a944ab6
On the long wat towards generated code comilation...
etisserant
parents:
diff
changeset
|
1 |
/* |
45dc6a944ab6
On the long wat towards generated code comilation...
etisserant
parents:
diff
changeset
|
2 |
* Functions and variables provied by generated C softPLC |
45dc6a944ab6
On the long wat towards generated code comilation...
etisserant
parents:
diff
changeset
|
3 |
**/ |
45dc6a944ab6
On the long wat towards generated code comilation...
etisserant
parents:
diff
changeset
|
4 |
extern int common_ticktime__; |
45dc6a944ab6
On the long wat towards generated code comilation...
etisserant
parents:
diff
changeset
|
5 |
|
45dc6a944ab6
On the long wat towards generated code comilation...
etisserant
parents:
diff
changeset
|
6 |
/* |
45dc6a944ab6
On the long wat towards generated code comilation...
etisserant
parents:
diff
changeset
|
7 |
* Functions and variables provied by plc.c |
45dc6a944ab6
On the long wat towards generated code comilation...
etisserant
parents:
diff
changeset
|
8 |
**/ |
45dc6a944ab6
On the long wat towards generated code comilation...
etisserant
parents:
diff
changeset
|
9 |
void run(long int tv_sec, long int tv_nsec); |
45dc6a944ab6
On the long wat towards generated code comilation...
etisserant
parents:
diff
changeset
|
10 |
|
45dc6a944ab6
On the long wat towards generated code comilation...
etisserant
parents:
diff
changeset
|
11 |
#define maxval(a,b) ((a>b)?a:b) |
45dc6a944ab6
On the long wat towards generated code comilation...
etisserant
parents:
diff
changeset
|
12 |
|
45dc6a944ab6
On the long wat towards generated code comilation...
etisserant
parents:
diff
changeset
|
13 |
#include "iec_types.h" |
45dc6a944ab6
On the long wat towards generated code comilation...
etisserant
parents:
diff
changeset
|
14 |
|
45dc6a944ab6
On the long wat towards generated code comilation...
etisserant
parents:
diff
changeset
|
15 |
/* |
45dc6a944ab6
On the long wat towards generated code comilation...
etisserant
parents:
diff
changeset
|
16 |
* Functions and variables provied by generated C softPLC |
45dc6a944ab6
On the long wat towards generated code comilation...
etisserant
parents:
diff
changeset
|
17 |
**/ |
45dc6a944ab6
On the long wat towards generated code comilation...
etisserant
parents:
diff
changeset
|
18 |
void config_run__(int tick); |
45dc6a944ab6
On the long wat towards generated code comilation...
etisserant
parents:
diff
changeset
|
19 |
void config_init__(void); |
45dc6a944ab6
On the long wat towards generated code comilation...
etisserant
parents:
diff
changeset
|
20 |
|
45dc6a944ab6
On the long wat towards generated code comilation...
etisserant
parents:
diff
changeset
|
21 |
/* |
45dc6a944ab6
On the long wat towards generated code comilation...
etisserant
parents:
diff
changeset
|
22 |
* Functions and variables to export to generated C softPLC |
45dc6a944ab6
On the long wat towards generated code comilation...
etisserant
parents:
diff
changeset
|
23 |
**/ |
45dc6a944ab6
On the long wat towards generated code comilation...
etisserant
parents:
diff
changeset
|
24 |
|
45dc6a944ab6
On the long wat towards generated code comilation...
etisserant
parents:
diff
changeset
|
25 |
IEC_TIME __CURRENT_TIME; |
45dc6a944ab6
On the long wat towards generated code comilation...
etisserant
parents:
diff
changeset
|
26 |
|
45dc6a944ab6
On the long wat towards generated code comilation...
etisserant
parents:
diff
changeset
|
27 |
static int tick = 0; |
57 | 28 |
static int init_level=0; |
49
45dc6a944ab6
On the long wat towards generated code comilation...
etisserant
parents:
diff
changeset
|
29 |
|
54 | 30 |
/* |
137
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
57
diff
changeset
|
31 |
* Prototypes of functions exported by plugins |
54 | 32 |
**/ |
49
45dc6a944ab6
On the long wat towards generated code comilation...
etisserant
parents:
diff
changeset
|
33 |
%(calls_prototypes)s |
45dc6a944ab6
On the long wat towards generated code comilation...
etisserant
parents:
diff
changeset
|
34 |
|
54 | 35 |
/* |
137
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
57
diff
changeset
|
36 |
* Retrieve input variables, run PLC and publish output variables |
54 | 37 |
**/ |
49
45dc6a944ab6
On the long wat towards generated code comilation...
etisserant
parents:
diff
changeset
|
38 |
void __run() |
45dc6a944ab6
On the long wat towards generated code comilation...
etisserant
parents:
diff
changeset
|
39 |
{ |
137
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
57
diff
changeset
|
40 |
%(retrieve_calls)s |
54 | 41 |
|
49
45dc6a944ab6
On the long wat towards generated code comilation...
etisserant
parents:
diff
changeset
|
42 |
config_run__(tick++); |
54 | 43 |
|
49
45dc6a944ab6
On the long wat towards generated code comilation...
etisserant
parents:
diff
changeset
|
44 |
%(publish_calls)s |
45dc6a944ab6
On the long wat towards generated code comilation...
etisserant
parents:
diff
changeset
|
45 |
} |
45dc6a944ab6
On the long wat towards generated code comilation...
etisserant
parents:
diff
changeset
|
46 |
|
54 | 47 |
/* |
48 |
* Initialize variables according to PLC's defalut values, |
|
49 |
* and then init plugins with that values |
|
50 |
**/ |
|
57 | 51 |
int __init(int argc,char **argv) |
49
45dc6a944ab6
On the long wat towards generated code comilation...
etisserant
parents:
diff
changeset
|
52 |
{ |
57 | 53 |
int res; |
49
45dc6a944ab6
On the long wat towards generated code comilation...
etisserant
parents:
diff
changeset
|
54 |
config_init__(); |
45dc6a944ab6
On the long wat towards generated code comilation...
etisserant
parents:
diff
changeset
|
55 |
%(init_calls)s |
57 | 56 |
return 0; |
49
45dc6a944ab6
On the long wat towards generated code comilation...
etisserant
parents:
diff
changeset
|
57 |
} |
54 | 58 |
/* |
59 |
* Calls plugin cleanup proc. |
|
60 |
**/ |
|
49
45dc6a944ab6
On the long wat towards generated code comilation...
etisserant
parents:
diff
changeset
|
61 |
void __cleanup() |
45dc6a944ab6
On the long wat towards generated code comilation...
etisserant
parents:
diff
changeset
|
62 |
{ |
45dc6a944ab6
On the long wat towards generated code comilation...
etisserant
parents:
diff
changeset
|
63 |
%(cleanup_calls)s |
45dc6a944ab6
On the long wat towards generated code comilation...
etisserant
parents:
diff
changeset
|
64 |
} |
45dc6a944ab6
On the long wat towards generated code comilation...
etisserant
parents:
diff
changeset
|
65 |