Applying patch from Iztok for old gcc versions
authorlaurent
Wed, 02 Sep 2009 13:38:47 +0200
changeset 386 2932b0dd437c
parent 385 49cd52914a6f
child 387 2cc48e356902
Applying patch from Iztok for old gcc versions
targets/Linux/plc_Linux_main.c
targets/plc_common_main.c
targets/plc_debug.c
--- a/targets/Linux/plc_Linux_main.c	Tue Sep 01 10:45:07 2009 +0200
+++ b/targets/Linux/plc_Linux_main.c	Wed Sep 02 13:38:47 2009 +0200
@@ -124,6 +124,7 @@
     pthread_mutex_destroy(&debug_wait_mutex);
     pthread_mutex_unlock(&python_wait_mutex);
     pthread_mutex_destroy(&python_wait_mutex);
+    return 0;
 }
 
 extern int __tick;
--- a/targets/plc_common_main.c	Tue Sep 01 10:45:07 2009 +0200
+++ b/targets/plc_common_main.c	Wed Sep 02 13:38:47 2009 +0200
@@ -58,12 +58,12 @@
  **/
 int __init(int argc,char **argv)
 {
-    int res;
+    int res = 0;
     setlocale(LC_NUMERIC, "C");
     config_init__();
     __init_debug();
     %(init_calls)s
-    return 0;
+    return res;
 }
 /*
  * Calls plugin cleanup proc.
--- a/targets/plc_debug.c	Tue Sep 01 10:45:07 2009 +0200
+++ b/targets/plc_debug.c	Wed Sep 02 13:38:47 2009 +0200
@@ -67,6 +67,8 @@
 
 extern int TryEnterDebugSection(void);
 extern void LeaveDebugSection(void);
+extern long AtomicCompareExchange(long*, long, long);
+extern void InitiateDebugTransfer(void);
 
 extern int __tick;
 void __publish_debug()
@@ -152,13 +154,15 @@
 
 void* IterDebugData(int* idx, const char **type_name)
 {
+	struct_plcvar* my_var;
+	USINT size;
     if(subscription_cursor < latest_subscription){
         char* old_cursor = buffer_cursor;
         *idx = *subscription_cursor;
-        struct_plcvar* my_var = &variable_table[*(subscription_cursor++)];
+        my_var = &variable_table[*(subscription_cursor++)];
         *type_name = __get_type_enum_name(my_var->type);
         /* get variable size*/
-        USINT size = __get_type_enum_size(my_var->type);
+        size = __get_type_enum_size(my_var->type);
         /* compute next cursor position*/
         buffer_cursor = buffer_cursor + size;
         if(old_cursor < debug_buffer + BUFFER_SIZE)