Updated tests so that they compile again :-)
authoretisserant
Thu, 17 Jul 2008 19:08:28 +0200
changeset 132 39f88c3d803d
parent 131 f55ef301e14c
child 133 fff75b8283be
Updated tests so that they compile again :-)
tests/.cvsignore
tests/build.sh
tests/build_win32.sh
tests/plc.c
--- a/tests/.cvsignore	Thu Jul 17 19:07:28 2008 +0200
+++ b/tests/.cvsignore	Thu Jul 17 19:08:28 2008 +0200
@@ -7,3 +7,5 @@
 SFC_TEST.st
 test.exe
 plc.st
+POUS.h
+VARIABLES.csv
--- a/tests/build.sh	Thu Jul 17 19:07:28 2008 +0200
+++ b/tests/build.sh	Thu Jul 17 19:08:28 2008 +0200
@@ -10,7 +10,7 @@
 CC=gcc
 #CC=i686-mingw32-gcc
 
-../iec2cc $STFILE -I ../lib 
+../iec2c $STFILE -I ../lib 
 #2>/dev/null
 
 $CC -I ../lib -c STD_RESSOURCE.c $CFLAGS
--- a/tests/build_win32.sh	Thu Jul 17 19:07:28 2008 +0200
+++ b/tests/build_win32.sh	Thu Jul 17 19:08:28 2008 +0200
@@ -10,7 +10,7 @@
 #CC=gcc
 CC=i686-mingw32-gcc
 
-../iec2cc $STFILE -I ../lib 
+../iec2c $STFILE -I ../lib 
 #2>/dev/null
 
 $CC -I ../lib -c STD_RESSOURCE.c $CFLAGS
--- a/tests/plc.c	Thu Jul 17 19:07:28 2008 +0200
+++ b/tests/plc.c	Thu Jul 17 19:08:28 2008 +0200
@@ -1,6 +1,26 @@
 #include "iec_std_lib.h"
 #include <stdio.h>
 
+#define __print_BOOL(name) printf("  %s = (BOOL) %s\n",#name, name?"TRUE":"FALSE");
+#define __print_SINT(name) printf("  %s = (SINT) %d\n",#name, name);
+#define __print_INT(name) printf("  %s = (INT) %d\n",#name, name);
+#define __print_DINT(name) printf("  %s = (DINT) %d\n",#name, name);
+#define __print_LINT(name) printf("  %s = (LINT) %d\n",#name, name);
+#define __print_USINT(name) printf("  %s = (USINT) %u\n",#name, name);
+#define __print_UINT(name) printf("  %s = (UINT) %u\n",#name, name);
+#define __print_UDINT(name) printf("  %s = (UDINT) %u\n",#name, name);
+#define __print_ULINT(name) printf("  %s = (ULINT) %lu\n",#name, name);
+#define __print_REAL(name) printf("  %s = (REAL) %f\n",#name, (double)name);
+#define __print_LREAL(name) printf("  %s = (LREAL) %f\n",#name, (double)name);
+#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);}
+#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);}
+#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);}
+#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);}
+#define __print_STRING(name) printf("  %s = (STRING) {%d, \"%*s\"}\n",#name, name->len, name->len, &name->body);
+#define __print_BYTE(name) printf("  %s = (BYTE) 0x%2.2x\n",#name, name);
+#define __print_WORD(name) printf("  %s = (WORD) 0x%4.4x\n",#name, name);
+#define __print_DWORD(name) printf("  %s = (DWORD) 0x%8.8x\n",#name, name);
+#define __print_LWORD(name) printf("  %s = (LWORD) 0x%16.16lx\n",#name, name);
 /*
  * Functions and variables provied by generated C softPLC
  **/ 
@@ -13,7 +33,10 @@
  
 TIME __CURRENT_TIME;
 
-#define __LOCATED_VAR(type, name, ...) type name;
+#define __LOCATED_VAR(type, name, ...) type __##name;
+#include "LOCATED_VARIABLES.h"
+#undef __LOCATED_VAR
+#define __LOCATED_VAR(type, name, ...) type* name = &__##name;
 #include "LOCATED_VARIABLES.h"
 #undef __LOCATED_VAR