targets/plc_common_main.c
changeset 280 f2ef79f3dba0
parent 245 60a221d72152
child 286 a2a8a52b0d4f
--- a/targets/plc_common_main.c	Tue Dec 23 19:31:28 2008 +0100
+++ b/targets/plc_common_main.c	Tue Dec 23 19:37:44 2008 +0100
@@ -1,41 +1,35 @@
-/*
- * Prototypes for function provided by arch-specific code (main)
- * concatained after this template
- ** /
+/**
+ * Code common to all C targets
+ **/ 
 
+#include "iec_types.h"
 
 /*
- * Functions and variables provied by generated C softPLC
- **/ 
-extern int common_ticktime__;
-
-/*
- * Functions and variables provied by plc.c
- **/ 
-void run(long int tv_sec, long int tv_nsec);
-
-#define maxval(a,b) ((a>b)?a:b)
-
-#include "iec_types.h"
-/*#include "stdio.h" /* For debug */
-
-/*
- * Functions and variables provied by generated C softPLC
+ * Prototypes of functions provied by generated C softPLC
  **/ 
 void config_run__(int tick);
 void config_init__(void);
+
+/*
+ * Prototypes of functions provied by generated target C code
+ * */
 void __init_debug(void);
 void __cleanup_debug(void);
+/*void __retrieve_debug(void);*/
+void __publish_debug(void);
 
+void __init_python(void);
+void __cleanup_python(void);
+void __retrieve_python(void);
+void __publish_python(void);
 
 /*
- *  Functions and variables to export to generated C softPLC and plugins
+ *  Variables used by generated C softPLC and plugins
  **/
- 
 IEC_TIME __CURRENT_TIME;
-IEC_BOOL __DEBUG;
 int __tick = -1;
 
+/* Help to quit cleanly when init fail at a certain level */
 static int init_level = 0;
 
 /*
@@ -52,10 +46,14 @@
 
     %(retrieve_calls)s
 
+    __retrieve_python();
+
     /*__retrieve_debug();*/
     
     config_run__(__tick);
 
+    __publish_python();
+
     __publish_debug();
     
     %(publish_calls)s
@@ -169,3 +167,8 @@
 		}
 	}
 }
+
+/**
+ * Prototypes for function provided by arch-specific code (main)
+ * is concatained hereafter
+ **/
\ No newline at end of file