author | laurent |
Mon, 21 Sep 2009 12:04:15 +0200 | |
changeset 210 | 8387cac2aba6 |
parent 132 | 39f88c3d803d |
child 279 | c0453b7f99df |
permissions | -rw-r--r-- |
57
db9cadaab2ea
Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
diff
changeset
|
1 |
#include "iec_std_lib.h" |
db9cadaab2ea
Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
diff
changeset
|
2 |
#include <stdio.h> |
db9cadaab2ea
Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
diff
changeset
|
3 |
|
132 | 4 |
#define __print_BOOL(name) printf(" %s = (BOOL) %s\n",#name, name?"TRUE":"FALSE"); |
5 |
#define __print_SINT(name) printf(" %s = (SINT) %d\n",#name, name); |
|
6 |
#define __print_INT(name) printf(" %s = (INT) %d\n",#name, name); |
|
7 |
#define __print_DINT(name) printf(" %s = (DINT) %d\n",#name, name); |
|
8 |
#define __print_LINT(name) printf(" %s = (LINT) %d\n",#name, name); |
|
9 |
#define __print_USINT(name) printf(" %s = (USINT) %u\n",#name, name); |
|
10 |
#define __print_UINT(name) printf(" %s = (UINT) %u\n",#name, name); |
|
11 |
#define __print_UDINT(name) printf(" %s = (UDINT) %u\n",#name, name); |
|
12 |
#define __print_ULINT(name) printf(" %s = (ULINT) %lu\n",#name, name); |
|
13 |
#define __print_REAL(name) printf(" %s = (REAL) %f\n",#name, (double)name); |
|
14 |
#define __print_LREAL(name) printf(" %s = (LREAL) %f\n",#name, (double)name); |
|
15 |
#define __print_TIME(name) {STRING __tmp = __time_to_string(name);__tmp.body[__tmp.len] = 0; printf(" %s = (TIME) %*s\n",#name, __tmp.len, &__tmp.body);} |
|
16 |
#define __print_DATE(name) {STRING __tmp = __date_to_string(name);__tmp.body[__tmp.len] = 0; printf(" %s = (DATE) %*s\n",#name, __tmp.len, &__tmp.body);} |
|
17 |
#define __print_TOD(name) {STRING __tmp = __tod_to_string(name);__tmp.body[__tmp.len] = 0; printf(" %s = (TOD) %*s\n",#name, __tmp.len, &__tmp.body);} |
|
18 |
#define __print_DT(name) {STRING __tmp = __dt_to_string(name);__tmp.body[__tmp.len] = 0; printf(" %s = (DT) %*s\n",#name, __tmp.len, &__tmp.body);} |
|
19 |
#define __print_STRING(name) printf(" %s = (STRING) {%d, \"%*s\"}\n",#name, name->len, name->len, &name->body); |
|
20 |
#define __print_BYTE(name) printf(" %s = (BYTE) 0x%2.2x\n",#name, name); |
|
21 |
#define __print_WORD(name) printf(" %s = (WORD) 0x%4.4x\n",#name, name); |
|
22 |
#define __print_DWORD(name) printf(" %s = (DWORD) 0x%8.8x\n",#name, name); |
|
23 |
#define __print_LWORD(name) printf(" %s = (LWORD) 0x%16.16lx\n",#name, name); |
|
57
db9cadaab2ea
Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
diff
changeset
|
24 |
/* |
db9cadaab2ea
Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
diff
changeset
|
25 |
* Functions and variables provied by generated C softPLC |
db9cadaab2ea
Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
diff
changeset
|
26 |
**/ |
db9cadaab2ea
Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
diff
changeset
|
27 |
void config_run__(int tick); |
db9cadaab2ea
Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
diff
changeset
|
28 |
void config_init__(void); |
db9cadaab2ea
Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
diff
changeset
|
29 |
|
db9cadaab2ea
Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
diff
changeset
|
30 |
/* |
db9cadaab2ea
Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
diff
changeset
|
31 |
* Functions and variables to export to generated C softPLC |
db9cadaab2ea
Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
diff
changeset
|
32 |
**/ |
db9cadaab2ea
Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
diff
changeset
|
33 |
|
db9cadaab2ea
Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
diff
changeset
|
34 |
TIME __CURRENT_TIME; |
db9cadaab2ea
Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
diff
changeset
|
35 |
|
132 | 36 |
#define __LOCATED_VAR(type, name, ...) type __##name; |
37 |
#include "LOCATED_VARIABLES.h" |
|
38 |
#undef __LOCATED_VAR |
|
39 |
#define __LOCATED_VAR(type, name, ...) type* name = &__##name; |
|
57
db9cadaab2ea
Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
diff
changeset
|
40 |
#include "LOCATED_VARIABLES.h" |
db9cadaab2ea
Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
diff
changeset
|
41 |
#undef __LOCATED_VAR |
db9cadaab2ea
Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
diff
changeset
|
42 |
|
db9cadaab2ea
Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
diff
changeset
|
43 |
static int tick = 0; |
db9cadaab2ea
Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
diff
changeset
|
44 |
|
db9cadaab2ea
Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
diff
changeset
|
45 |
void run() |
db9cadaab2ea
Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
diff
changeset
|
46 |
{ |
db9cadaab2ea
Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
diff
changeset
|
47 |
printf("Tick %d\n",tick); |
db9cadaab2ea
Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
diff
changeset
|
48 |
config_run__(tick++); |
db9cadaab2ea
Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
diff
changeset
|
49 |
printf(" Located variables : \n"); |
db9cadaab2ea
Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
diff
changeset
|
50 |
#define __LOCATED_VAR(type, name,...) __print_##type(name); |
db9cadaab2ea
Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
diff
changeset
|
51 |
#include "LOCATED_VARIABLES.h" |
db9cadaab2ea
Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
diff
changeset
|
52 |
#undef __LOCATED_VAR |
db9cadaab2ea
Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
diff
changeset
|
53 |
} |
db9cadaab2ea
Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
diff
changeset
|
54 |